Esempio n. 1
0
    def decode(self, message):
        ''' Wrapper to decode a given packet

        :param message: The raw modbus request packet
        :return: The decoded modbus message or None if error
        '''
        raise NotImplementedException("Method not implemented by derived class")
Esempio n. 2
0
 def advanceFrame(self):
     ''' Skip over the current framed message
     This allows us to skip over the current message after we have processed
     it or determined that it contains an error. It also has to reset the
     current frame header handle
     '''
     raise NotImplementedException("Method not implemented by derived class")
Esempio n. 3
0
    def isFrameReady(self):
        ''' Check if we should continue decode logic

        This is meant to be used in a while loop in the decoding phase to let
        the decoder know that there is still data in the buffer.

        :returns: True if ready, False otherwise
        '''
        raise NotImplementedException("Method not implemented by derived class")
Esempio n. 4
0
    def addToFrame(self, message):
        ''' Add the next message to the frame buffer

        This should be used before the decoding while loop to add the received
        data to the buffer handle.

        :param message: The most recent packet
        '''
        raise NotImplementedException("Method not implemented by derived class")
Esempio n. 5
0
    def populateResult(self, result):
        ''' Populates the modbus result with current frame header

        We basically copy the data back over from the current header
        to the result header. This may not be needed for serial messages.

        :param result: The response packet
        '''
        raise NotImplementedException("Method not implemented by derived class")
Esempio n. 6
0
    def buildPacket(self, message):
        ''' Creates a ready to send modbus packet

        The raw packet is built off of a fully populated modbus
        request / response message.

        :param message: The request/response to send
        :returns: The built packet
        '''
        raise NotImplementedException("Method not implemented by derived class")
Esempio n. 7
0
    def processIncomingPacket(self, data, callback):
        ''' The new packet processing pattern

        This takes in a new request packet, adds it to the current
        packet stream, and performs framing on it. That is, checks
        for complete messages, and once found, will process all that
        exist.  This handles the case when we read N + 1 or 1 / N
        messages at a time instead of 1.

        The processed and decoded messages are pushed to the callback
        function to process and send.

        :param data: The new packet data
        :param callback: The function to send results to
        '''
        raise NotImplementedException("Method not implemented by derived class")
Esempio n. 8
0
    def getFrame(self):
        ''' Get the next frame from the buffer

        :returns: The frame data or ''
        '''
        raise NotImplementedException("Method not implemented by derived class")
Esempio n. 9
0
    def checkFrame(self):
        ''' Check and decode the next frame

        :returns: True if we successful, False otherwise
        '''
        raise NotImplementedException("Method not implemented by derived class")
Esempio n. 10
0
 def execute(self):
     ''' Base function to raise if not implemented '''
     raise NotImplementedException(
         "Diagnostic Message Has No Execute Method")