original_docstring: Encode and put packet string onto write buffer.
docstring: Encode and put packet string onto write buffer.
docstring_tokens: Encode and put packet string onto write buffer .
code: def pmSendPdu(self, instruction : VisonicListEntry):
          """Encode and put packet string onto write buffer."""
  
          if self.suspendAllOperations:
              return
              
          # Send a command to the panel     
          command = instruction.command
          data = command.data
          # push in the options in to the appropriate places in the message. Examples are the pin or the specific command
          if instruction.options != None:
              # the length of instruction.options has to be an even number
              # it is a list of couples:  bitoffset , bytearray to insert
              op = int(len(instruction.options) / 2)
              #log.debug("[pmSendPdu] Options {0} {1}".format(instruction.options, op))
              for o in range(0, op):
                  s = instruction.options[o * 2]      # bit offset as an integer
                  a = instruction.options[o * 2 + 1]  # the bytearray to insert
                  #log.debug("[pmSendPdu] Options {0} {1} {2} {3} {4}".format(type(s), type(a), s, a, len(a)))
                  for i in range(0, len(a)):
                      data[s + i] = a[i]
                      #log.debug("[pmSendPdu]        Inserting at {0}".format(s+i))
  
          #log.debug('[pmSendPdu] input data: %s', self.toString(packet))
          # First add header (0x0D), then the packet, then crc and footer (0x0A)
          sData = b'\x0D'
          sData += data
          sData += self.calculate_crc(data)
          sData += b'\x0A'
  
          # Log some usefull information in debug mode
          log.info("[pmSendPdu] Sending Command ({0})    raw data {1}".format(command.msg, self.toString(sData)))
          self.transport.write(sData)
          log.debug("[pmSendPdu]      waiting for message response {}".format([hex(no).upper() for no in self.pmExpectedResponse]))
          #yield from asyncio.sleep(0.25)
          #sleep(0.1)
code_tokens: def pmSendPdu ( self , instruction : VisonicListEntry ) : if self . suspendAllOperations : return command = instruction . command data = command . data if instruction . options != None : op = int ( len ( instruction . options ) / 2 ) for o in range ( 0 , op ) : s = instruction . options [ o * 2 ] a = instruction . options [ o * 2 + 1 ] for i in range ( 0 , len ( a ) ) : data [ s + i ] = a [ i ] sData = b'\x0D' sData += data sData += self . calculate_crc ( data ) sData += b'\x0A' log . info ( "[pmSendPdu] Sending Command ({0})    raw data {1}" . format ( command . msg , self . toString ( sData ) ) ) self . transport . write ( sData ) log . debug ( "[pmSendPdu]      waiting for message response {}" . format ( [ hex ( no ) . upper ( ) for no in self . pmExpectedResponse ] ) )
short_docstring: Encode and put packet string onto write buffer.
short_docstring_tokens: Encode and put packet string onto write buffer .
comment: """Encode and put packet string onto write buffer."""$SEP$# Send a command to the panel     $SEP$# push in the options in to the appropriate places in the message. Examples are the pin or the specific command$SEP$# the length of instruction.options has to be an even number$SEP$# it is a list of couples:  bitoffset , bytearray to insert$SEP$#log.debug("[pmSendPdu] Options {0} {1}".format(instruction.options, op))$SEP$# bit offset as an integer$SEP$# the bytearray to insert$SEP$#log.debug("[pmSendPdu] Options {0} {1} {2} {3} {4}".format(type(s), type(a), s, a, len(a)))$SEP$#log.debug("[pmSendPdu]        Inserting at {0}".format(s+i))$SEP$#log.debug('[pmSendPdu] input data: %s', self.toString(packet))$SEP$# First add header (0x0D), then the packet, then crc and footer (0x0A)$SEP$# Log some usefull information in debug mode$SEP$#yield from asyncio.sleep(0.25)$SEP$#sleep(0.1)