MCA Data Server Reference |
|||||||||||||
wxMCA PackageSupported DevicesApplication Examples |
MCA ServerSummaryThe MCA-3K Server (mca_server.py) is the recommended interface to the world. When using emorpho_api.py directly, the client is bound to using the programming language Python and can avoid using TCP/IP and ZMQ as the protocol layer. When using the mca_server.py the client gains network access via ZMQ and can now write their own code in over 40 different programming languages. Via ZMQ and network access, the MDS acts as a bridge between detectors on USB and the Internet. The server also acts a bridge between programming languages. Server Start UpOn start up the server first reads some configuration data from "../rad_config/mds/mds_config.json". For the MCA-1K devices, the ARM controller has immediate access to the device settings stored in the ARM non-volatile memory and no further steps are necessary. In the MCA-3K devices, which have an FPGA, the ARM controllare will load the applicable settings into the FPGA RAM. In the eMorpho, there is no ARM processor and the FPGA settings data are storedin an on-board non-volatile memory. In this case, the MDS has to read the contents of that memry and apply it to the FPGA in order to boot the MCA. Server OperationThe server then enters an infinite loop listening to commands and processing them in the order received. Commands with a name of "mca_cmd" will be sent to mca_api.process_cmd(). The server also has a service interface which responds to commands with a name of "server_cmd". The service interface is used by the MCA Data Daemon (MDD), or a similar client agent, to manage the mca_server. The MDD can find out if the server is up and running, or if it has stalled or crashed. In that case, the MDD can kill an unresponsive server and spawn a new copy.
DebuggingTo test for interference of commands or other hard to trace bugs, the client can set mca_server.MDS_DO_LOG to 1 or True. When this parameter is set, the MDS logs each incoming request and its own answer in a file named "log_path"+"mds_log.txt" where log_path points to the current director for logging data. Often that directory will be "../log/" and the logger data will reside in "../log/mds_log.txt". |