![]() |
eMorpho Data Server Reference |
||||||||||||
eMorphoUSB driverData structuresAPIData Server |
eMorpho ServerSummaryThe eMorpho Server (emorpho_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 emorpho_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". After that it boots all attached eMorpho units. This means the server transfers the content of the non-volatile memory from each unit into its fpga_ctrl registers. That way the detectors come alive with the last settings written to their nv-mem. Server OperationThe server then enters an infinite loop listening to commands and processing them in the order received. Commands with a name of "em_cmd" will be sent to emorpho_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 Morpho Data Daemon (MDD), or a similar client agent, to manage the emorpho_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 emorpho_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". |