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.") while 1: data = scan_and_get_results() time.sleep(1) if not data == "": sent = sender_dongle.at_spssend(data) time.sleep(0.1) if len(sent) == 1: if "[Sent]" in sent[0]: print("Data = (" + data + ") sent.") time.sleep(1) data = "" time.sleep(1)
from bleuio_lib.bleuio_funcs import BleuIo repeter_dongle_port = "COM38" # Change this to your dongle's COM port repeter_dongle = BleuIo(port=repeter_dongle_port) repeter_dongle.start_daemon() buffer = "" num_of_connected_devices = 0 connection_list = [] print("Dongle found.") repeter_dongle.at_dual() repeter_dongle.at_advstart() repeter_dongle.rx_state = "rx_waiting" print("Waiting for other dongles to connect...") def send_msg(buffer): """ Parses incomming data string for just the data and sends it forward via the Serial Port Service. """ try: result = buffer msg_to_send = "" result_array1 = result.split("\r\n") for line in result_array1: if "[Received]:" in line: msg_to_send = line.split(" ") msg_to_send = msg_to_send[1]