def __init__(self, receiver=None, spawnArgs=None, **kwargs): self.connected = False self.instrument = None self.command = None self.topicDefined = False self.publish_to = None """ A translation dictionary to translate from the commands being sent from the agent to the actual command understood by the instrument. """ self.sbeParmCommands = { "baudrate" : "Baud", "outputformat" : "outputformat" } self.__instrument_parameters = { "baudrate": 9600, "outputformat": 0, "outputsal": "Y", "outputsv": "Y", "navg": 0, "mincondfreq": 0, "pumpdelay": 0, "tadvance": 0.0625, "alpha": 0.03, "tau": 7.0, "autorun": "Y", "tcaldate": "1/1/01", "ta0": 0.0, "ta1": 0.0, "ta2": 0.0, "ta3": 0.0, "toffset": 0.0, "ccaldate": "1/1/01", "cg": 0.0, "ch": 0.0, "ci": 0.0, "cj": 0.0, "cpcor": 0.0, "ctcor": 0.0, "cslope": 0.0, "pcaldate": "1/1/01", "prange": 100.0, "poffset": 0.0, "pa0": 0.0, "pa1": 0.0, "pa2": 0.0, "ptempa0": 0.0, "ptempa1": 0.0, "ptempa2": 0.0, "ptca0": 0.0, "ptca1": 0.0, "ptca2": 0.0, "ptcb0": 0.0, "ptcb1": 0.0, "ptcb2": 0.0 } InstrumentDriver.__init__(self, receiver, spawnArgs, **kwargs)
def __init__(self, receiver=None, spawnArgs=None, **kwargs): self.connected = False self.instrument = None self.command = None self.topicDefined = False self.publish_to = None """ A translation dictionary to translate from the commands being sent from the agent to the actual command understood by the instrument. """ self.sbeParmCommands = { "baudrate": "Baud", "outputformat": "outputformat" } self.__instrument_parameters = { "baudrate": 9600, "outputformat": 0, "outputsal": "Y", "outputsv": "Y", "navg": 0, "mincondfreq": 0, "pumpdelay": 0, "tadvance": 0.0625, "alpha": 0.03, "tau": 7.0, "autorun": "Y", "tcaldate": "1/1/01", "ta0": 0.0, "ta1": 0.0, "ta2": 0.0, "ta3": 0.0, "toffset": 0.0, "ccaldate": "1/1/01", "cg": 0.0, "ch": 0.0, "ci": 0.0, "cj": 0.0, "cpcor": 0.0, "ctcor": 0.0, "cslope": 0.0, "pcaldate": "1/1/01", "prange": 100.0, "poffset": 0.0, "pa0": 0.0, "pa1": 0.0, "pa2": 0.0, "ptempa0": 0.0, "ptempa1": 0.0, "ptempa2": 0.0, "ptca0": 0.0, "ptca1": 0.0, "ptca2": 0.0, "ptcb0": 0.0, "ptcb1": 0.0, "ptcb2": 0.0 } InstrumentDriver.__init__(self, receiver, spawnArgs, **kwargs)
def __init__(self, *args, **kwargs): """ Creates an instance of the driver. This instance will be initially unconfigured (ie., with no specific instrument associated) until the configure operation is called and completed. """ InstrumentDriver.__init__(self, *args, **kwargs) if log.getEffectiveLevel() <= logging.DEBUG: log.debug("\nSiamDriver __init__: spawn_args = " + str(self.spawn_args)) """ A flag indicating whether notifications to self.proc_supid should be sent when entering states. It is assigned the value returned by self.spawn_args.get('notify_agent', False). @NOTE: This is to avoid "ERROR:Process does not define op=driver_event_occurred" messages when self.proc_supid does not correspond to an instrument agent. There might be a more appropriate way to accomplish this behavior. I'm using this mechanism in test_siam_agent.py to include the corresponding spawn arg. """ self.notify_agent = self.spawn_args.get('notify_agent', False) """ Used to connect to the SIAM-CI adapter service. More specifically, this is the routing key (queue) where the SIAM-CI adapter service (java) is listening for requests. """ self.pid = None """ Instrument port. A concrete instrument in the SIAM node is identified by its corresponding port. """ self.port = None """ Will be a SiamCiAdapterProxy(pid, port) instance upon configuration """ self.siamci = None """ Used in certain operations to enable handling of notifications from the SIAM-CI adapter service in lieu of InstrumentAgent """ self.publish_stream = None """ Instrument state handlers. Note, I have followed SBE37_driver to some extent here but this is very preliminary in general. """ self.state_handlers = { SiamDriverState.UNCONFIGURED: self.state_handler_unconfigured, SiamDriverState.DISCONNECTED: self.state_handler_disconnected, SiamDriverState.CONNECTING: self.state_handler_connecting, SiamDriverState.DISCONNECTING: self.state_handler_disconnecting, SiamDriverState.CONNECTED: self.state_handler_connected, # SiamDriverState.ACQUIRE_SAMPLE : self.state_handler_acquire_sample, # SiamDriverState.UPDATE_PARAMS : self.state_handler_update_params, # SiamDriverState.SET : self.state_handler_set, # SiamDriverState.AUTOSAMPLE : self.state_handler_autosample } """ Instrument state machine. """ self.fsm = InstrumentFSM(SiamDriverState, SiamDriverEvent, self.state_handlers, SiamDriverEvent.ENTER, SiamDriverEvent.EXIT)
def __init__(self, *args, **kwargs): """ Creates an instance of the driver. This instance will be initially unconfigured (ie., with no specific instrument associated) until the configure operation is called and completed. """ InstrumentDriver.__init__(self, *args, **kwargs) if log.getEffectiveLevel() <= logging.DEBUG: log.debug("\nSiamDriver __init__: spawn_args = " +str(self.spawn_args)) """ A flag indicating whether notifications to self.proc_supid should be sent when entering states. It is assigned the value returned by self.spawn_args.get('notify_agent', False). @NOTE: This is to avoid "ERROR:Process does not define op=driver_event_occurred" messages when self.proc_supid does not correspond to an instrument agent. There might be a more appropriate way to accomplish this behavior. I'm using this mechanism in test_siam_agent.py to include the corresponding spawn arg. """ self.notify_agent = self.spawn_args.get('notify_agent', False) """ Used to connect to the SIAM-CI adapter service. More specifically, this is the routing key (queue) where the SIAM-CI adapter service (java) is listening for requests. """ self.pid = None """ Instrument port. A concrete instrument in the SIAM node is identified by its corresponding port. """ self.port = None """ Will be a SiamCiAdapterProxy(pid, port) instance upon configuration """ self.siamci = None """ Used in certain operations to enable handling of notifications from the SIAM-CI adapter service in lieu of InstrumentAgent """ self.publish_stream = None """ Instrument state handlers. Note, I have followed SBE37_driver to some extent here but this is very preliminary in general. """ self.state_handlers = { SiamDriverState.UNCONFIGURED : self.state_handler_unconfigured, SiamDriverState.DISCONNECTED : self.state_handler_disconnected, SiamDriverState.CONNECTING : self.state_handler_connecting, SiamDriverState.DISCONNECTING : self.state_handler_disconnecting, SiamDriverState.CONNECTED : self.state_handler_connected, # SiamDriverState.ACQUIRE_SAMPLE : self.state_handler_acquire_sample, # SiamDriverState.UPDATE_PARAMS : self.state_handler_update_params, # SiamDriverState.SET : self.state_handler_set, # SiamDriverState.AUTOSAMPLE : self.state_handler_autosample } """ Instrument state machine. """ self.fsm = InstrumentFSM(SiamDriverState, SiamDriverEvent, self.state_handlers, SiamDriverEvent.ENTER, SiamDriverEvent.EXIT)