def setUp(self):
     ''' Sets up the test environment '''
     self.client = None
     self.decoder = ServerDecoder()
     self._tcp = ModbusSocketFramer(decoder=self.decoder)
     self._rtu = ModbusRtuFramer(decoder=self.decoder)
     self._ascii = ModbusAsciiFramer(decoder=self.decoder)
     self._binary = ModbusBinaryFramer(decoder=self.decoder)
     self._manager = DictTransactionManager(self.client)
     self._queue_manager = FifoTransactionManager(self.client)
     self._tm = ModbusTransactionManager(self.client)
Пример #2
0
    def __implementation(method):
        ''' Returns the requested framer

        :method: The serial framer to instantiate
        :returns: The requested serial framer
        '''
        method = method.lower()
        if   method == 'ascii':  return ModbusAsciiFramer(ClientDecoder())
        elif method == 'rtu':    return ModbusRtuFramer(ClientDecoder())
        elif method == 'binary': return ModbusBinaryFramer(ClientDecoder())
        raise ParameterException("Invalid framer method requested")
Пример #3
0
 def _framer(method):
     if method == "ascii":
         framer = ModbusAsciiFramer(ClientDecoder())
     elif method == "rtu":
         framer = ModbusRtuFramer(ClientDecoder())
     elif method == "binary":
         framer = ModbusBinaryFramer(ClientDecoder())
     elif method == "socket":
         framer = ModbusSocketFramer(ClientDecoder())
     else:
         framer = None
     return framer
Пример #4
0
    def _framer(cls, method):
        """
        Returns the requested framer

        :method: The serial framer to instantiate
        :returns: The requested serial framer
        """
        method = method.lower()
        if method == 'ascii':
            return ModbusAsciiFramer(ClientDecoder())
        elif method == 'rtu':
            return ModbusRtuFramer(ClientDecoder())
        elif method == 'binary':
            return ModbusBinaryFramer(ClientDecoder())
        elif method == 'socket':
            return ModbusSocketFramer(ClientDecoder())

        raise ParameterException("Invalid framer method requested")