def start_Program(): #Using a try-exept-keyboardinterrupt the loop can be broken anytime which leads to program end try: while True: data_list = get_gps_location() #print('data_list_start_Program = '+data_list) read_qr_codes(data_list) read_rfid_codes(data_list) #adjusting the final list information_list_cleared = [] #We use 'e' keyboard input as the exit command. Since it is registered as a tag id, we have to kick it out of the list again for e in information_list: if e not in information_list_cleared: information_list_cleared.append(e) #print(information_list_cleared) #That would be the point when the information are either sent to the database or saved in a general list insert_table_batch(information_list_cleared) if keyboard.is_pressed('CTRL+ESC'): break except KeyboardInterrupt: pass
def start_Program(): try: while True: data_list = get_gps_location() #print('data_list_start_Program = '+data_list) read_qr_codes(data_list) read_rfid_codes(data_list) information_list_cleared = [] for e in information_list: if e not in information_list_cleared: information_list_cleared.append(e) print(information_list_cleared) #That would be the point when the information are either sent to the database or saved in a general list insert_table_batch(information_list_cleared) if keyboard.is_pressed('CTRL+ESC'): break except KeyboardInterrupt: pass
'date': '2020.03.04 08:32:08', 'GPS': '50.749797, 6.097067, 23, 2' }, { 'device_id': 'Pi222222', 'tag_id': 'TId:000001', 'date': '2020.03.04 14:32:08', 'GPS': '50.750673, 6.098043, 23, 2' }, { 'device_id': 'Pi333333', 'tag_id': 'TId:000001', 'date': '2020.03.10 10:00:08', 'GPS': '50.7866478, 6.1277060, 23, 2' }, { 'device_id': 'Pi333333', 'tag_id': 'TId:000001', 'date': '2020.03.11 11:00:00', 'GPS': '50.816026, 6.152972, 23, 2' }] tag_id = 'TId:000001' delete_table_id(tag_id) print(baums) insert_table_batch(baums) i = query_table_id(tag_id) for ii in i: print(ii) # g = query_table_ele('GPS', '50.783392, 6.046476, 23, 2') # print(g) gps_map_marker(i)
'device_id': 'rgs23451', 'GPS': '50.785067, 6.047786', 'date': '09.01.2020 9:50:23' } baum3 = { 'tag_id': 'id00001', 'device_id': '23did1204', 'GPS': '50.783667, 6.049786', 'date': '09.01.2020 10:46:23' } baum4 = { 'tag_id': 'id00001', 'device_id': '34523', 'GPS': '50.783067, 6.055786', 'date': '09.01.2020 18:46:23' } baum_list = [] baum_list.extend([baum, baum2, baum3, baum4]) tag_id = 'id00001' delete_table_id(tag_id) insert_table_batch(baum_list) print(query_table(table_name)) print(query_table_ele('device_id', 'rgs23451')) i = query_table_id(tag_id) gps_map_marker(i)