コード例 #1
0
 def parse_record(self, record):
     """
     determine if this is a engineering or data record and parse
     FLORT and PARAD can copy paste this and insert their own data particle class
     needs extending for WFP_ENG
     """
     raise NotImplementedException("parse_record must be implemented")
コード例 #2
0
 def regex_compiled():
     """
     Return a regex compiled regex of the regex
     Static methods  because it is called outside this class.
     @return: compiled regex
     """
     NotImplementedException()
コード例 #3
0
 def get_resource_state(self, *args, **kwargs):
     """
     Return the current state of the driver.
     @retval str current driver state.
     @raises NotImplementedException if not implemented by subclass.        
     """
     raise NotImplementedException('get_resource_state() is not implemented.')        
コード例 #4
0
 def regex_multiline(self):
     """
     return a dictionary containing uncompiled regex used to match patterns
     in SBE multiline results. includes an encoder method.
     @return: dictionary of uncompiled regexs
     """
     NotImplementedException()
コード例 #5
0
 def disconnect(self, *args, **kwargs):
     """
     Disconnect from device via port agent / logger.
     @raises InstrumentStateException if command not allowed in current state
     @raises NotImplementedException if not implemented by subclass.
     """
     raise NotImplementedException('disconnect() not implemented.')
コード例 #6
0
 def encoders(self):
     """
     return a dictionary containing encoder methods for parameters
     a special key 'default' can be used to name the default mechanism
     @return: dictionary containing encoder callbacks
     """
     NotImplementedException()
コード例 #7
0
 def stop_direct(self, *args, **kwargs):
     """
     Stop direct access mode
     @param timeout=timeout Optional command timeout.        
     @ retval Command specific.
     @raises NotImplementedException if not implemented by subclass.
     """
     raise NotImplementedException('execute_resource() not implemented.')
コード例 #8
0
 def initialize(self, *args, **kwargs):
     """
     Initialize driver connection, bringing communications parameters
     into unconfigured state (no connection object).
     @raises InstrumentStateException if command not allowed in current state        
     @raises NotImplementedException if not implemented by subclass.
     """
     raise NotImplementedException('initialize() not implemented.')
コード例 #9
0
    def _verify_config(self):
        """
        virtual method to verify the supplied driver configuration is value.  Must
        be overloaded in sub classes.

        raises an ConfigurationException when a configuration error is detected.
        """
        raise NotImplementedException('virtual methond needs to be specialized')
コード例 #10
0
 def set_state(self, state):
     """
     Set the state of the last published data block.
     @param state The structure that indicates what state the parser should
        be in for this state. This structure should look like what was
        published for the last state.
     """
     raise NotImplementedException("get_records() not overridden!")
コード例 #11
0
ファイル: dataset_driver.py プロジェクト: GrimJ/mi-dataset
    def _build_parser(self, stream_handle):
        """
        abstract method that must be provided by derived classes to build a parser
        :param stream_handle: an open fid created from the sourceFilePath passed in from edex
        :return: A properly configured parser object
        """

        raise NotImplementedException("_build_parser must be implemented")
コード例 #12
0
 def regex():
     """
     Return a regex string to use in matching functions.  This can be used
     for parsing too if more complex parsing isn't needed.
     Static methods  because it is called outside this class.
     @return: uncompiled regex string
     """
     NotImplementedException()
コード例 #13
0
    def data_particle_type(self):
        """
        Return the data particle type (aka stream name)
        @raise: NotImplementedException if _data_particle_type is not set
        """
        if self._data_particle_type is None:
            raise NotImplementedException("_data_particle_type not initialized")

        return self._data_particle_type
コード例 #14
0
 def _is_sampling(self):
     """
     Currently the drivers only have two states, command and streaming and
     all resource commands are common, either start or stop autosample.
     Therefore we didn't implement an enitre state machine to manage states
     and commands.  If it does get more complex than this we should take the
     time to implement a state machine to add some flexibility
     """
     raise NotImplementedException('virtual method needs to be specialized')
コード例 #15
0
 def connect(self, *args, **kwargs):
     """
     Establish communications with the device via port agent / logger
     (connected connection object).
     @raises InstrumentStateException if command not allowed in current state
     @throws InstrumentConnectionException if the connection failed.
     @raises NotImplementedException if not implemented by subclass.
     """
     raise NotImplementedException('connect() not implemented.')
コード例 #16
0
 def configure(self, *args, **kwargs):
     """
     Configure the driver for communications with the device via
     port agent / logger (valid but unconnected connection object).
     @param arg[0] comms config dict.
     @raises InstrumentStateException if command not allowed in current state        
     @throws InstrumentParameterException if missing comms or invalid config dict.
     @raises NotImplementedException if not implemented by subclass.
     """
     raise NotImplementedException('configure() not implemented.')
コード例 #17
0
 def parse_chunks(self):
     """
     Parse out any pending data chunks in the chunker. If
     it is a valid data piece, build a particle, update the position and
     timestamp. Go until the chunker has no more valid data.
     @retval a list of tuples with sample particles encountered in this
         parsing, plus the state (ie "(sample, state)"). An empty list of
         nothing was parsed.
     """
     raise NotImplementedException("Must write parse_chunks()!")
コード例 #18
0
 def get_resource_capabilities(self, *args, **kwargs):
     """
     Return driver commands and parameters.
     @param current_state True to retrieve commands available in current
     state, otherwise reutrn all commands.
     @retval list of AgentCapability objects representing the drivers
     capabilities.
     @raises NotImplementedException if not implemented by subclass.        
     """
     raise NotImplementedException('get_resource_capabilities() is not implemented.')
コード例 #19
0
 def get_resource(self, *args, **kwargs):
     """
     Retrieve device parameters.
     @param args[0] DriverParameter.ALL or a list of parameters to retrive.
     @retval parameter : value dict.
     @raises InstrumentParameterException if missing or invalid get parameters.
     @raises InstrumentStateException if command not allowed in current state
     @raises NotImplementedException if not implemented by subclass.
     """
     raise NotImplementedException('get_resource() is not implemented.')
コード例 #20
0
    def get_value(self, id):
        """ Return a stored value

        @param id The ID (from DataParticleKey) for the parameter to return
        @raises NotImplementedException If there is an invalid id
        """
        if DataParticleKey.has(id):
            return self.contents[id]
        else:
            raise NotImplementedException("Value %s not available in particle!", id)
コード例 #21
0
 def execute_resource(self, *args, **kwargs):
     """
     Execute a driver command.
     @param timeout=timeout Optional command timeout.
     @ retval Command specific.
     @raises InstrumentTimeoutException if could not wake device or no response.
     @raises InstrumentProtocolException if command not recognized.
     @raises InstrumentStateException if command not allowed in current state.
     @raises NotImplementedException if not implemented by subclass.
     """
     raise NotImplementedException('execute_resource() not implemented.')
コード例 #22
0
 def discover_state(self, *args, **kwargs):
     """
     Determine initial state upon establishing communications.
     @param timeout=timeout Optional command timeout.        
     @retval Current device state.
     @raises InstrumentTimeoutException if could not wake device.
     @raises InstrumentStateException if command not allowed in current state or if
     device state not recognized.
     @raises NotImplementedException if not implemented by subclass.
     """
     raise NotImplementedException('discover_state() is not implemented.')
コード例 #23
0
 def set_resource(self, *args, **kwargs):
     """
     Set device parameters.
     @param args[0] parameter : value dict of parameters to set.
     @param timeout=timeout Optional command timeout.
     @raises InstrumentParameterException if missing or invalid set parameters.
     @raises InstrumentTimeoutException if could not wake device or no response.
     @raises InstrumentProtocolException if set command not recognized.
     @raises InstrumentStateException if command not allowed in current state.
     @raises NotImplementedException if not implemented by subclass.
     """
     raise NotImplementedException('set_resource() not implemented.')
コード例 #24
0
    def __init__(self,
                 raw_data,
                 port_timestamp=None,
                 internal_timestamp=None,
                 preferred_timestamp=DataParticleKey.PORT_TIMESTAMP,
                 quality_flag=DataParticleValue.OK,
                 new_sequence=None):

        if self._param_map is None:
            raise NotImplementedException("_param_map not provided")

        super(SunaDataParticle,
              self).__init__(raw_data, port_timestamp, internal_timestamp,
                             preferred_timestamp, quality_flag, new_sequence)
コード例 #25
0
 def _update_params(self):
     """
     Send instrument commands to get data to refresh the param_dict cache
     """
     raise NotImplementedException()
コード例 #26
0
 def _is_logging(self):
     """
     Is the instrument in logging or command mode.
     @return: True if streaming, False if in command, None if we don't know
     """
     raise NotImplementedException()
コード例 #27
0
 def _stop_logging(self):
     """
     Issue the instrument command to stop logging data
     """
     raise NotImplementedException()
コード例 #28
0
 def _map_param_to_xml_tag(self, parameter_name):
     """
     @return: a string containing the xml tag name for a parameter
     """
     NotImplementedException()
コード例 #29
0
 def _handler(self):
     "The actual handler to which the client is connected.  Must be implemented in any server that inherits from this class"
     log.debug("TcpServer._handler(): not implemented")
     raise NotImplementedException('TcpServer._handler() not implemented.')        
コード例 #30
0
 def _build_harvester(self, memento):
     raise NotImplementedException(
         'virtual methond needs to be specialized')