import config ser = serial.Serial(port=config.SYSMEX_XN_350_COMPORT, baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=0) print("\n") print("- HOST STARTED ------------------------------------------------------") print(" COMMUNICATION PORT: " + ser.portstr) print("---------------------------------------------------------------------") print("\n") astm = Astm("sysmex350xn") block_message = b'' answer = {} order_response = "" order_sent = False sending_order = False def checkReadLine(message): print("\nInstrument Send: {}".format(message)) header = message.split(b'\x0d') h = 0 while h < len(header): hs = header[h].decode().split('|') if hs[0][-1] == 'Q': firstHeader = header[0].decode().split('|')
timeout=0) # ser = serial.Serial(port='/dev/cu.wchusbserial1410',baudrate=9600,parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,timeout=0) def printMsg(): return true print("connected to: " + ser.portstr) print("\n") count = 1 seq = [] astm = Astm("cobas411") # astm = Astm("urisys1100") def checkMessage(message): data = message.encode() stx = data.find(b'\x02') etx = data.find(b'\x03') lf = data.find(b'\x10') cr = data.find(b'\x13') crlf = lf + cr text = message[1:-6] checksum = message[-4:-2] print( "\n----------------------------------------------------------------------------------------------------" )
#ser = serial.Serial(port='/dev/ttys006', baudrate=9600, parity=serial.PARITY_NONE, # stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=0) ser = serial.Serial(port=config.COBAS_411_COMPORT, baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=0) print("\n") print("-| HOST STARTED |----------------------------------------------------") print(" COMMUNICATION PORT: " + ser.portstr) print("---------------------------------------------------------------------") print("\n") astm = Astm("cobas411") block_message = b'' answer = {} def checkReadLine(message): print(" INSTRUMENT : {}".format(message)) header = message.split(b'\x0d') h = 0 while h < len(header): hs = header[h].decode().split('|') if hs[0][-1] == 'Q': firstHeader = header[0].decode().split('|') query = hs[2].split('^') global answer answer = {
"[ENQ]", "[STX]1H|\^&|||cobas·u·411^8^3.2.0.1001^Int|||||||P||20110315101822[CR][ETX]71[CR][LF]", "[STX]2P|1[CR][ETX]3F[CR][LF]", "[STX]3O|1|001|1^^^^SAMPLE||R||||||X|||20110315101754[CR][ETX]F0[CR][LF]", "[STX]4R|1|1^SG|1.005|||||||service[CR][ETX]AD[CR][LF]", "[STX]5R|2|2^pH|7|||||||service[CR][ETX]11[CR][LF]", "[STX]6R|3|3^LEU|neg|||||||service[CR][ETX]45[CR][LF]", "[STX]7R|4|4^NIT|neg|||||||service[CR][ETX]4D[CR][LF]", "[STX]0R|5|5^PRO|neg|||||||service[CR][ETX]4E[CR][LF]", "[STX]1R|6|6^GLU|neg|||||||service[CR][ETX]48[CR][LF]", "[STX]2R|7|7^KET|neg|||||||service[CR][ETX]47[CR][LF]", "[STX]3R|8|8^UBG|neg|||||||service[CR][ETX]44[CR][LF]", "[STX]4R|9|9^BIL|neg|||||||service[CR][ETX]40[CR][LF]", "[STX]5R|10|10^ERY|neg|||||||service[CR][ETX]AA[CR][LF]", "[STX]6R|11|11^COL|p.yel|||||||service[CR][ETX]49[CR][LF]", "[STX]7R|12|12^CLA||||||||service[CR][ETX]56[CR][LF]", "[STX]0M|1|RC|||2001601|20111001|||[CR][ETX]8F[CR][LF]", "[STX]1L|1|N[CR][ETX]04[CR][LF]", "[EOT]") dummy_messages_2 = ( "[ENQ]" "[STX]1H|\^&|||cobas-e411^1|||||host|TSREQ^REAL|P|1[CR][EXT]00[CR][LF]", "[STX]2Q|1|^^000004^40^0^5^^S1^SC||ALL||||||||O[CR][EXT]00[CR][LF]", "[STX]L|1|N[CR][EXT]00[CR][LF]", "[EOT]") astm = Astm("cobas411") run = 0 while run < len(dummy_messages_2): astm.deviceSend(dummy_messages_2[run]) run = run + 1 time.sleep(1)
# "4R|01|01^ SG|1.020|gcm3|||||20090116|LNorman^A" # "5R|02|02^ pH| 7||||||20090116|LNorman^A" # "5R|10|10^ERY| 50^ 3+| Ery/ul|||||20090116|LNorman^A" ### machine sending sample dummy_messages = ( "[ENQ]", "[STX]1H|\^&|||URISYS1100^99305^SW5.31^INT|||||||P||20090116184200[CR][ETX]F8[CR][LF]", "[STX]2P|1[CR][ETX]3F[CR][LF]", "[STX]3O|1||001^00036^C10|Urinalysis^Incubated|R||||||X|||20090116184100[CR][ETX]00[CR][LF]", "[STX]4R|01|01^·SG|1.020|gcm3|||||20090116|LNorman^A[CR][ETX]BB[CR][LF]", "[STX]5R|02|02^·pH|····7||||||20090116|LNorman^A[CR][ETX]09[CR][LF]", "[STX]6R|03|03^LEU|··neg^··neg|·Leu/ul|||||20090116|LNorman^A[CR][ETX]0B[CR][LF]", "[STX]7R|04|04^NIT|··neg^··neg||||||20090116|LNorman^A[CR][ETX]BD[CR][LF]", "[STX]0R|05|05^PRO|··neg^··neg|·mg/dl·|||||20090116|LNorman^A[CR][ETX]D1[CR][LF]", "[STX]1R|06|06^GLU|·norm^··neg|·mg/dl·|||||20090116|LNorman^A[CR][ETX]2D[CR][LF]", "[STX]2R|07|07^KET|··neg^··neg|·mg/dl·|||||20090116|LNorman^A[CR][ETX]CA[CR][LF]", "[STX]3R|08|08^UBG|·norm^··neg|·mg/dl·|||||20090116|LNorman^A[CR][ETX]29[CR][LF]", "[STX]4R|09|09^BIL|··neg^··neg|·mg/dl·|||||20090116|LNorman^A[CR][ETX]C3[CR][LF]", "[STX]5R|10|10^ERY|···50^···3+|·Ery/ul|||||20090116|LNorman^A[CR][ETX]A9[CR][LF]", "[STX]6C|10|I|*|I[CR][ETX]96[CR][LF]", "[STX]7L|1|N[CR][ETX]0A[CR][LF]", "[EOT]", ) astm = Astm("urisys1100") run = 0 while run < len(dummy_messages): astm.deviceSend(dummy_messages[run]) run = run + 1 time.sleep(1)
stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=0) reply_processing = False reply_message = "" def printMsg(): return true print("connected to: " + ser.portstr) print("\n") astm = Astm("cobas311") def checkReadLine(message): print("\nDevice Send: {}".format(message)) astm.deviceSend(message) time.sleep(1) ser.write(b'\x06') def checkRequest(): print('check if any request is required') # response = astm.checkRequest() # print(response) # time.sleep(1) # sending_reply(response[0])