result_array = result_array1[2].split(" ") msg_to_save = str(result_array[0]) print("Recieved = " + msg_to_save) try: reciever_dongle.at_dual() ready = input( "Press enter to connect to the repeater dongle. (This should be connected first)." ) print("Connecting...") reciever_dongle.at_gapconnect(mac_addr_to_repeater) time.sleep(5) while not connected: connected_status = reciever_dongle.ati() if "\r\nConnected" in connected_status[0]: connected = True break if "\r\nNot Connected" in connected_status[0]: reciever_dongle.at_gapconnect(mac_addr_to_repeater) time.sleep(5) print("Trying to connect...") time.sleep(2) print("Connected.") print("Waiting to recieve...") while 1: buffer = reciever_dongle.rx_buffer.decode("utf-8", "ignore") if "\r\nhandle_evt_gattc_notification:" in buffer:
return_data = "" return return_data print("Dongle found.") try: sender_dongle.at_dual() ready = input( "Press enter to connect to the repeater dongle. (This should be connected last)." ) print("Connecting...") sender_dongle.at_gapconnect(mac_addr_to_repeater) time.sleep(5) while not connected: connected_status = sender_dongle.ati() if "\r\nConnected" in connected_status[0]: connected = True break if "\r\nNot Connected" in connected_status[0]: sender_dongle.at_gapconnect(mac_addr_to_repeater) time.sleep(5) print("Trying to connect...") time.sleep(2) print("Connected.") print("Getting services...") get_services = sender_dongle.at_get_services() sender_dongle.rx_state = "rx_waiting" time.sleep(2) ready = input("Press enter to start sending data to the repeater dongle.")