otaa_join(lora) s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) s.setblocking(True) s.bind(1) print('Sending...') # try all the datarates from 0 to 6 and toggle confirmed and non confirmed messages for i in range(7): s.setsockopt(socket.SOL_LORA, socket.SO_DR, i) s.setsockopt(socket.SOL_LORA, socket.SO_CONFIRMED, (i % 2) == 0) print(s.send("Sending pk #%d" % i)) time.sleep(0.5) print(s.recv(64).decode('ascii')) print(lora.events() == LoRa.RX_PACKET_EVENT | LoRa.TX_PACKET_EVENT) print(lora.events() == 0) s.close() # join again otaa_join(lora) print(lora.mac() == bytes(0xFF for i in range(8))) s = socket.socket(socket.AF_LORA, socket.SOCK_RAW) s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5) s.setblocking(False) s.bind(2) # try all the datarates from 0 to 6 and toggle confirmed and non confirmed messages
break print(neighbor_adresses) Broadcast_address='All' neighbor=0 ############# Contiki MAC ######################### while True: chrono.start() chrono3.start() channel_status=cca(chrono,cca_list) packet_status=packet_check(Awake_instance,packet_number) lora = LoRa(power_mode=LoRa.ALWAYS_ON,region=LoRa.EU868) while len(s.recv(packet_size))>0: ss=s.recv(packet_size) events=lora.events() if channel_status and packet_status and not only_listen: ########### Transmit Data ########################## lora = LoRa(power_mode=LoRa.ALWAYS_ON,region=LoRa.EU868) print('Sending Data') send_time=0 data = ' Data ' cca_time=chrono.read() cca_list.clear() if transmission_type=='Unicast': ########### Unicast Transmission ########################## send_time_updated=False