def main(): global server global run print(hex(id(server))) radar_queue = queue.Queue() interrupt_queue = queue.Queue() # heart_rate_queue = queue.Queue() # resp_rate_queue = queue.Queue() radar = Radar.Radar(radar_queue, interrupt_queue) radar.start() timeout = time.time() + 10 * 60 # signalprocessing = signalprocessing.HeartRate(radar_queue,heart_rate_queue,resp_rate_queue) # signalprocessing.start() # bluetooth = Bluetooth(heart_rate_queue,resp_rate_queue) # bluetooth.start() # bluetooth send data # for i in range(1, 2000): # time.sleep(1) # while len(clientList) == 0 and run == True: # pass # data = addData(sinvalue) # # print('Write data: ' + data) # data_pulse, data_breath = data.split(' ') # write_data_to_app(data_pulse, 'heart rate') # write_data_to_app(data_breath, 'breath rate') # sinvalue += 0.157 for i in range(1, 2000): time.sleep(1) if time.time() > timeout: interrupt_queue.put(1) while len(clientList) == 0 and go == True: pass data = getDatafromQueue(test_queue) print('Write data: ' + data) data_pulse, data_breath = data.split(' ') write_data_to_app(data_pulse, 'heart rate') write_data_to_app(data_breath, 'breath rate') #sinvalue += 0.157 server.close() print("S**T") #TODO Stänga ner raspberry ConnectDevicesThread.join( ) # Waits for the thread to close. Implies all ReadDeviceThreads are also closed. subprocess.call(["sudo", "shutdown", "-h", "now"]) # shutdown of Raspberry Pi
return str(data[0]) + ' ' + str(data[1]) def getDataFromQueue(): test_queue.put(addData(1)) return test_queue.get() for thread in readThreadList: # Makes sure that all our client threads are closed before exiting thread thread.join() print(thread + " is closed") connectDevices = ConnectDevicesThread() connectDevices.start() radar = Radar.Radar(radar_queue, interrupt_queue) radar.start() for i in range(1, 2000): time.sleep(1) while len(clientList) == 0: pass #data = addData(sinvalue) data = getDataFromQueue() #print('Write data: ' + data) data_pulse, data_breath = data.split(' ') write_data_to_app(data_pulse, 'heart rate') write_data_to_app(data_breath, 'breath rate') #sinvalue += 0.157 interrupt_queue.put(1)