Skip to content

Commit

Permalink
fixup! opendsme: add initial support
Browse files Browse the repository at this point in the history
  • Loading branch information
jia200x committed Jun 29, 2022
1 parent cf1bdcb commit 1cf723b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/opendsme/contrib/opendsme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ static int _get(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)
gnrc_netif_acquire(netif);
int res;
network_uint16_t addr;
le_uint64_t ext_addr;
uint8_t *addr_ptr = static_cast<uint8_t*>(ext_addr.u8);
switch (opt->opt) {
case NETOPT_MAX_PDU_SIZE:
*((uint16_t *)opt->data) = IEEE802154_FRAME_LEN_MAX;
Expand All @@ -57,11 +59,18 @@ static int _get(gnrc_netif_t *netif, gnrc_netapi_opt_t *opt)
res = sizeof(uint16_t);
break;
case NETOPT_ADDRESS:
assert(opt->data_len >= sizeof(network_uint16_t));
assert(opt->data_len >= IEEE802154_SHORT_ADDRESS_LEN);
m_dsme.getShortAddress(&addr);
memcpy(opt->data, &addr, IEEE802154_SHORT_ADDRESS_LEN);
res = IEEE802154_SHORT_ADDRESS_LEN;
break;
case NETOPT_ADDRESS_LONG: {
assert(opt->data_len >= IEEE802154_LONG_ADDRESS_LEN);
addr_ptr << m_dsme.getAddress();
*((be_uint64_t*) opt->data) = byteorder_ltobll(ext_addr);
res = IEEE802154_LONG_ADDRESS_LEN;
break;
}
case NETOPT_LINK:
assert(opt->data_len >= sizeof(netopt_enable_t));
*((netopt_enable_t*) opt->data) = m_dsme.isAssociated()
Expand Down

0 comments on commit 1cf723b

Please sign in to comment.