Skip to content

Commit c017215

Browse files
debdeep-armArto Kinnunen
authored and
Arto Kinnunen
committed
Resolving comments
1 parent 68cf724 commit c017215

File tree

4 files changed

+43
-58
lines changed

4 files changed

+43
-58
lines changed

connectivity/nanostack/mbed-mesh-api/mbed-mesh-api/WisunBorderRouter.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
* \brief Struct br_information Border router dynamic information.
2222
*/
2323
typedef struct ws_br_info {
24-
/** Mesh Interface Global Address */
25-
uint8_t global_addr[16];
26-
/** Mesh Interface Link Local Address */
27-
uint8_t link_local_addr[16];
24+
/** Address prefix given to devices in network set to 0 if not available*/
25+
uint8_t ipv6_prefix[8];
26+
/** IID of Border router */
27+
uint8_t ipv6_iid[8];
2828
/** Border router dodag id */
2929
uint8_t rpl_dodag_id[16];
3030
/** Border router instance identifier defined in RPL */
@@ -35,8 +35,6 @@ typedef struct ws_br_info {
3535
uint64_t host_timestamp;
3636
/** Amount of devices in the network. */
3737
uint16_t device_count;
38-
/** Backbone IPv6 Global Address */
39-
uint8_t backbone_global_addr[16];
4038
/** Gateway Local Address */
4139
uint8_t gateway_addr[16];
4240
} ws_br_info_t;
@@ -213,7 +211,6 @@ class WisunBorderRouter {
213211

214212
private:
215213
int8_t _mesh_if_id = -1;
216-
int8_t _backbone_if_id = -1;
217214

218215
};
219216

connectivity/nanostack/mbed-mesh-api/mbed-mesh-api/WisunInterface.h

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
* \brief Struct ws_rpl_info Wi-SUN router RPL information.
2424
*/
2525
typedef struct ws_rpl_info {
26-
/** IPv6 Global Address of Router Node*/
27-
uint8_t global_addr[16];
28-
/** IPv6 Link Local Address of Router Node*/
29-
uint8_t link_local_addr[16];
3026
/** Router dodag id */
3127
uint8_t rpl_dodag_id[16];
3228
/** Router instance identifier */
@@ -37,19 +33,27 @@ typedef struct ws_rpl_info {
3733
uint16_t curent_rank;
3834
/** RPL Primary Parent Rank */
3935
uint16_t primary_parent_rank;
40-
/** RPL Primary Parent Address */
41-
uint8_t rpl_parent_addr[16];
4236
} ws_rpl_info_t;
4337

4438
/**
45-
* \brief Struct ws_radio_info Wi-SUN router Radio Quality information.
39+
* \brief Struct ws_stack_state Wi-SUN stack information.
4640
*/
47-
typedef struct ws_radio_info {
48-
/** parent RSSI in measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/
49-
uint8_t rsl_in;
41+
typedef struct ws_stack_state {
42+
/** Mesh Interface Global IPv6 Address */
43+
uint8_t global_addr[16];
44+
/** Mesh Interface Link Local IPv6 Address */
45+
uint8_t link_local_addr[16];
46+
/** Parent link local address */
47+
uint8_t parent_addr[16];
5048
/** parent RSSI Out measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/
5149
uint8_t rsl_out;
52-
} ws_radio_info_t;
50+
/** parent RSSI in measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/
51+
uint8_t rsl_in;
52+
/** Wi-SUN join state defined by Wi-SUN specification 1-5 */
53+
uint8_t join_state;
54+
/** Network PAN ID */
55+
uint16_t pan_id;
56+
} ws_stack_state_t;
5357

5458
/** Wi-SUN mesh network interface class
5559
*
@@ -470,17 +474,17 @@ class WisunInterface final : public MeshInterfaceNanostack {
470474
mesh_error_t info_get(ws_rpl_info_t *info_ptr);
471475

472476
/**
473-
* \brief Get Wi-SUN Radio Quality information.
477+
* \brief Get Wi-SUN Stack information.
474478
*
475479
* Function reads Stack information from nanostack.
476480
* Mesh interface must be initialized before calling this function.
477481
*
478-
* \param radio_info_ptr Structure given to stack where information will be stored
482+
* \param stack_info_ptr Structure given to stack where information will be stored
479483
*
480484
* \return MESH_ERROR_NONE on success.
481485
* \return MESH_ERROR_UNKNOWN in case of failure.
482486
* */
483-
mesh_error_t radio_info_get(ws_radio_info_t *radio_info_ptr);
487+
mesh_error_t stack_info_get(ws_stack_state_t *stack_info_ptr);
484488

485489
protected:
486490
Nanostack::WisunInterface *get_interface() const;

connectivity/nanostack/mbed-mesh-api/source/WisunBorderRouter.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ mesh_error_t WisunBorderRouter::start(NetworkInterface *mesh_if, NetworkInterfac
5252
if (backbone_if_id < 0) {
5353
return MESH_ERROR_UNKNOWN;
5454
}
55-
_backbone_if_id = backbone_if_id;
5655

5756
int ret = ws_bbr_start(mesh_if_id, backbone_if_id);
5857
if (ret < 0) {
@@ -159,8 +158,6 @@ mesh_error_t WisunBorderRouter::validate_pan_configuration(uint16_t pan_id)
159158
mesh_error_t WisunBorderRouter::info_get(ws_br_info_t *info_ptr)
160159
{
161160
bbr_information_t bbr_info = {0};
162-
uint8_t mesh_link_local_addr[16] = {0};
163-
uint8_t backbone_global_addr[16] = {0};
164161

165162
if (info_ptr == NULL) {
166163
return MESH_ERROR_PARAM;
@@ -171,24 +168,14 @@ mesh_error_t WisunBorderRouter::info_get(ws_br_info_t *info_ptr)
171168
return MESH_ERROR_UNKNOWN;
172169
}
173170

174-
if (arm_net_address_get(_mesh_if_id, ADDR_IPV6_LL, mesh_link_local_addr) != 0) {
175-
// No global prefix available, Nothing to do.
176-
}
177-
178-
if (arm_net_address_get(_backbone_if_id, ADDR_IPV6_GP, backbone_global_addr) != 0) {
179-
// No global prefix available, Nothing to do.
180-
}
181-
182171
info_ptr->device_count = bbr_info.devices_in_network;
183172
info_ptr->host_timestamp = bbr_info.timestamp;
184173
info_ptr->instance_id = bbr_info.instance_id;
185174
info_ptr->version = bbr_info.version;
186175
memcpy(info_ptr->rpl_dodag_id, bbr_info.dodag_id, 16);
187-
memcpy(info_ptr->global_addr, bbr_info.prefix, 8);
188-
memcpy(info_ptr->global_addr + 8, bbr_info.IID, 8);
176+
memcpy(info_ptr->ipv6_prefix, bbr_info.prefix, 8);
177+
memcpy(info_ptr->ipv6_iid, bbr_info.IID, 8);
189178
memcpy(info_ptr->gateway_addr, bbr_info.gateway, 16);
190-
memcpy(info_ptr->link_local_addr, mesh_link_local_addr, 16);
191-
memcpy(info_ptr->backbone_global_addr, backbone_global_addr, 16);
192179

193180
return MESH_ERROR_NONE;
194181
}

connectivity/nanostack/mbed-mesh-api/source/WisunInterface.cpp

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,6 @@ mesh_error_t WisunInterface::info_get(ws_rpl_info_t *info_ptr)
553553
}
554554

555555
rpl_dodag_info_t dodag_ptr = {0};
556-
ws_stack_info_t stack_info = {0};
557-
uint8_t global_address[16] = {0};
558-
uint8_t link_local_address[16] = {0};
559556
uint8_t rpl_instance_count;
560557
uint8_t instance_id_list[10];
561558
uint8_t instance_id = RPL_INSTANCE_LOCAL;
@@ -589,44 +586,44 @@ mesh_error_t WisunInterface::info_get(ws_rpl_info_t *info_ptr)
589586
return MESH_ERROR_UNKNOWN;
590587
}
591588

592-
if (ws_stack_info_get(get_interface_id(), &stack_info)) {
593-
return MESH_ERROR_UNKNOWN;
594-
}
595-
596-
if (arm_net_address_get(get_interface_id(), ADDR_IPV6_GP, global_address) != 0) {
597-
// No global prefix available, Nothing to do.
598-
}
599-
600-
if (arm_net_address_get(get_interface_id(), ADDR_IPV6_LL, link_local_address) != 0) {
601-
// No local prefix available, Nothing to do.
602-
}
603-
604589
info_ptr->instance_id = dodag_ptr.instance_id;
605590
info_ptr->version = dodag_ptr.version_num;
606591
info_ptr->curent_rank = dodag_ptr.curent_rank;
607592
info_ptr->primary_parent_rank = dodag_ptr.primary_parent_rank;
608593
memcpy(info_ptr->rpl_dodag_id, dodag_ptr.dodag_id, 16);
609-
memcpy(info_ptr->global_addr, global_address, 16);
610-
memcpy(info_ptr->link_local_addr, link_local_address, 16);
611-
memcpy(info_ptr->rpl_parent_addr, stack_info.parent, 16);
612594

613595
return MESH_ERROR_NONE;
614596
}
615597

616-
mesh_error_t radio_info_get(ws_radio_info_t *radio_info_ptr)
598+
mesh_error_t WisunInterface::stack_info_get(ws_stack_state_t *stack_info_ptr)
617599
{
618-
if (radio_info_ptr == NULL) {
600+
if (stack_info_ptr == NULL) {
619601
return MESH_ERROR_PARAM;
620602
}
621603

622604
ws_stack_info_t stack_info = {0};
605+
uint8_t global_address[16] = {0};
606+
uint8_t link_local_address[16] = {0};
623607

624608
if (ws_stack_info_get(get_interface_id(), &stack_info)) {
625609
return MESH_ERROR_UNKNOWN;
626610
}
627611

628-
radio_info_ptr->rsl_in = stack_info.rsl_in;
629-
radio_info_ptr->rsl_out = stack_info.rsl_out;
612+
if (arm_net_address_get(get_interface_id(), ADDR_IPV6_GP, global_address) != 0) {
613+
// No global prefix available, Nothing to do.
614+
}
615+
616+
if (arm_net_address_get(get_interface_id(), ADDR_IPV6_LL, link_local_address) != 0) {
617+
// No local prefix available, Nothing to do.
618+
}
619+
620+
stack_info_ptr->join_state = stack_info.join_state;
621+
stack_info_ptr->pan_id = stack_info.pan_id;
622+
stack_info_ptr->rsl_in = stack_info.rsl_in;
623+
stack_info_ptr->rsl_out = stack_info.rsl_out;
624+
memcpy(stack_info_ptr->parent_addr, stack_info.parent, 16);
625+
memcpy(stack_info_ptr->global_addr, global_address, 16);
626+
memcpy(stack_info_ptr->link_local_addr, link_local_address, 16);
630627

631628
return MESH_ERROR_NONE;
632629
}

0 commit comments

Comments
 (0)