[riot-users] drivers/xbee: how to send packets without shell

Francesco Ermini francescoermini8 at gmail.com
Wed Jul 8 18:14:49 CEST 2015


Hi,

The Xbee driver test uses the shell to send packets.  Because I don't need
the shell, what's the correct code to send data through the Xbee?

I try this:
```
      char data[] = " hello";
      size_t addr_len = 8;
      uint8_t addr[8]={0x00, 0x13, 0xa2, 0x00, 0x40, 0xc4, 0x36, 0x57};
      ng_pktsnip_t *pkt;
      ng_netif_hdr_t *nethdr;
      pkt = ng_pktbuf_add(NULL,(char *)data, strlen(data),
NG_NETTYPE_UNDEF);
      pkt = ng_pktbuf_add(pkt, NULL, sizeof(ng_netif_hdr_t) + addr_len,
                                NG_NETTYPE_NETIF);
      nethdr = (ng_netif_hdr_t *)pkt->data;
      ng_netif_hdr_init(nethdr, 0, addr_len);
      ng_netif_hdr_set_dst_addr(nethdr, addr, addr_len);
      ng_netapi_send( dev.mac_pid, pkt);
```
But It don't works.

Thanks, Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/users/attachments/20150708/02ef0e65/attachment.html>


More information about the users mailing list