Beispiel #1
0
def generate_data(q, q_alert, q_data):
    print("======****** Welcome to Use Patient Monitor ******======")
    print("========================================================")
    print("***************** Copyright Jing Li ********************")
    print("========================================================")
    print("=============", time.ctime(time.time()), "===========")
    while 1:
        times = random.randint(4, 7)
        patientData = input_module.genSensorData()
        patientDic = json.loads(patientData)
        patientInfo = input_module.genPatientInfo()
        alert_mes = alertt.alertCheck(patientData)
        #print(patientInfo)
        storage.insert(patientInfo, patientData)

        evt = threading.Event()
        q.put((patientInfo, evt))
        print('... ...Waiting for data to be sent to Info... ...\n')
        evt.wait()

        evt_data = threading.Event()
        q_data.put((patientData, evt_data))
        print("... ...Waiting for data to be sent to display... ...\n")
        evt_data.wait()

        evt_alert = threading.Event()
        q_alert.put((alert_mes, evt_alert))
        print("... ...Waiting for alert check... ...\n")
        evt_alert.wait()

        time.sleep(times)
    def generate_data(self, q, q_alert, q_data):
        print("======****** Welcome to Use Patient Monitor ******======")
        print("========================================================")
        print("***************** Copyright Jing Li ********************")
        print("========================================================")
        print("=============", time.ctime(time.time()), "===========")
        while 1:
            times = random.randint(4, 7)
            patientData = input_module.genSensorData()
            patientInfo = input_module.genPatientInfo()
            alert_mes = alertt.alertCheck(patientData)
            #print(patientInfo)
            storage.insert(patientInfo, patientData)

            q.put(patientInfo)
            print('... ...Waiting for data to be sent to Info... ...\n')

            q_data.put(patientData)
            print("... ...Waiting for data to be sent to display... ...\n")

            q_alert.put(alert_mes)
            print("... ...Waiting for alert check... ...\n")

            time.sleep(times)