def log_upload(self): ''' log the serial port stream into a file ''' while self.ser.isOpen(): try: line = self.ser.readline() self.file.write(bytes(line)) except: print('Port disconnected') break self.close() time.sleep(30) print('Pushing to Azure ...') toCloud = push2azure() toCloud.push2AzureAsBlobs()
stopbits=1, timeout=None) # need to confirm port while True: if ser.isOpen(): break print('\Port is open now\n') configFRII(ser) ser.flushInput() fname = './data/ins2000-' fname += time.strftime("%Y_%m_%d_%H_%M_%S", time.localtime()) + '.bin' fmode = 'wb' with open(fname, fmode) as outf: while True: try: line = ser.readline() outf.write(bytes(line)) except: print('Port disconnected') break outf.close() time.sleep(30) print('Pushing to Azure ...') toCloud = push2azure() toCloud.push2AzureAsBlobs()