def start(self): """ Send an identity request and then a negotiation request. """ self.serial_h.flushOutput() self.serial_h.flushInput() self.send(C1218IdentRequest()) data = self.recv() if data[0] != 0x00: self.logger.error( 'received incorrect response to identification service request' ) return False self._initialized = True self.send( C1218NegotiateRequest(self.c1218_pktsize, self.c1218_nbrpkts, baudrate=9600)) data = self.recv() if data[0] != 0x00: self.logger.error( 'received incorrect response to negotiate service request') self.stop() raise C1218NegotiateError( 'received incorrect response to negotiate service request', data[0]) return True
def start(self): """ Send an identity request and then a negotiation request. """ #pdb.set_trace() #print("connection.py - 423 - inside start") self.serial_h.flushOutput() self.serial_h.flushInput() #print("\n\n\n\n\n******************Start of Indent******************\n\n\n\n\n\n") self.send(C1218IdentRequest()) #Debug code #print("Before data = self.recv()") # C12.18: # 4.2.2.2: Responses/ page 6 # 4.2.2.3: Identification Service data = self.recv() #Debug code #print("connection.py - 437: data: {}".format(data)) #print("************data: {}".format(data)) if data[0] != 0x00: self.logger.error('received incorrect response to identification service request') return False #print("\n\n\n\n\n******************End of Indent******************\n\n\n\n\n\n") #Modify: Comment the whole block line below #print("\n\n\n\n\n******************Start of Negotation******************\n\n\n\n\n\n") self._initialized = True self.send(C1218NegotiateRequest(self.c1218_pktsize, self.c1218_nbrpkts, baudrate=9600)) #Debug code #print("346: Before data = self.recv()") data = self.recv() #Debug code #print("349: After data = self.recv(): {}".format(data)) #print("350: After data = self.recv(): data[0] {}".format(data[0])) #data[0] = 1 != 0x00: #Original: if data[0] != 0x00: print("Hey! I touched this point") print(data[0]) if data[0] != 0x00: print("connection.py - 369 - Inside Received Incoonect Response") self.logger.error('received incorrect response to negotiate service request') self.stop() #Original Code: raise C1218NegotiateError('Heyyy received incorrect response to negotiate service request', data[0]) raise C1218NegotiateError('Heyyy received incorrect response to negotiate service request', data[0]) ''' Starting Modify ''' #print("\n\n\n\n\n******************End of Negotiation******************\n\n\n\n\n\n") #print("connection.py - 376 Starting Modifying code") #self.send(C1218IdentRequest()) #Debug code #print("Before data = self.recv()") # C12.18: # 4.2.2.2: Responses/ page 6 # 4.2.2.3: Identification Service #data = self.recv() Orginal #New code :data = self.recv2() #data = self.recv2() #print("connection.py-388 - Ending Modifying Code") ''' Ending Modify ''' return True