can send one UDP packet; repeated tx fails ENOMEM b/c we're taking out of a TakeCell for the kbuf in the driver
@@ -25,29 +25,22 @@ int main(void) {
int temp, lux;
char packet[64];
- /* { IEEE802.15.4 configuration... temporary until we have full IP
+ /*
ieee802154_set_address(0x1540);
ieee802154_set_pan(0xABCD);
ieee802154_config_commit();
ieee802154_up();
- } IEEE802.15.4 configuration */
+ */
ipv6_addr_t ifaces[10];
udp_list_ifaces(ifaces, 10);
- /*
- printf("Listed %d out of 10 possible interfaces.\n", n);
- for(int i = 0; i < n; i++) {
- printf("Interface %d: ", i);
- print_ipv6(&ifaces[i]);
- printf("\n");
- }
- */
sock_handle_t handle;
sock_addr_t addr = {
ifaces[0],
15123
};
+
printf("Opening socket on ");
print_ipv6(&ifaces[0]);
printf(" : %d\n", addr.port);
@@ -58,7 +51,7 @@ char packet[64];
16123
};
- // while (1) {
+ while (1) {
temperature_read_sync(&temp);
humidity_read_sync(&humi);
ambient_light_read_intensity_sync(&lux);
@@ -66,14 +59,6 @@ char packet[64];
int len = snprintf(packet, sizeof(packet), "%d deg C; %d%%; %d lux;\n",
temp, humi, lux);
- /*
- int err = ieee802154_send(0x0802, // destination address (short MAC address)
- SEC_LEVEL_NONE, // No encryption
- 0, // unused since SEC_LEVEL_NONE
- NULL, // unused since SEC_LEVEL_NONE
- packet,
- len);
- */
printf("Sending packet (length %d) --> ", len);
print_ipv6(&(destination.addr));
printf(" : %d\n", destination.port);
@@ -98,7 +83,7 @@ char packet[64];
*/
delay_ms(1000);
- // }
+ }
udp_close(&handle);
}
