def send_ack(ser_conn,pause=0): '''Send C12.19 ack packet''' # Pause for just a bit in case blind ack if pause: c12packet.delay(pause) #Send Blind ACK if not ser_conn.write_bytes(data = c12packet.ACK): print "send_ack: Serial Write Failed" sys.exit() print " Sent ACK"
def send_ack(ser_conn, pause=0): '''Send C12.19 ack packet''' # Pause for just a bit in case blind ack if pause: c12packet.delay(pause) #Send Blind ACK if not ser_conn.write_bytes(data=c12packet.ACK): print "send_ack: Serial Write Failed" sys.exit() print " Sent ACK"
# Initialize Comm Port SER_CONN0 = c12serial.SERCONN(debug = DEBUG) SER_CONN0.serInit(port = COMM_PORT,baud = COMM_BAUD, invert = INVERT) # Setup and configure packet packet = c12packet.C1218_packet() packet.set_debug(DEBUG) packet.set_nego(NEGO_ON) if action == "test_login": '''Test login to determine if password works''' print "Running test_login function" if DEBUG: print "Start Delay:",start_delay c12packet.delay(start_delay) if not packet.login_setup(ser_conn0): print action,': login_setup failed.' sys.exit() if not packet.login_seq_passwd(ser_conn0,USER_NUM,PASSWD): print action,': login_seq_passwd failed.' sys.exit() # Close gracefully print action,": Successful" ser_conn0.close() if action == "read_table": '''Reads all tables in a decade. STD tables should be between 0 and 169. MFG decades should be between 2040 and 2200, (MFG dependant).'''
# Initialize Comm Port SER_CONN0 = c12serial.SERCONN(debug=DEBUG) SER_CONN0.serInit(port=COMM_PORT, baud=COMM_BAUD, invert=INVERT) # Setup and configure packet packet = c12packet.C1218_packet() packet.set_debug(DEBUG) packet.set_nego(NEGO_ON) if action == "test_login": '''Test login to determine if password works''' print "Running test_login function" if DEBUG: print "Start Delay:", start_delay c12packet.delay(start_delay) if not packet.login_setup(ser_conn0): print action, ': login_setup failed.' sys.exit() if not packet.login_seq_passwd(ser_conn0, USER_NUM, PASSWD): print action, ': login_seq_passwd failed.' sys.exit() # Close gracefully print action, ": Successful" ser_conn0.close() if action == "read_table": '''Reads all tables in a decade. STD tables should be between 0 and 169. MFG decades should be between 2040 and 2200, (MFG dependant).'''