Skip to content

Commit 72c28ee

Browse files
debdeep-armArto Kinnunen
authored andcommitted
Resolving comments
1 parent c5386c0 commit 72c28ee

File tree

4 files changed

+43
-58
lines changed

4 files changed

+43
-58
lines changed

features/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

features/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
*
@@ -479,17 +483,17 @@ class WisunInterface : public MeshInterfaceNanostack {
479483
mesh_error_t info_get(ws_rpl_info_t *info_ptr);
480484

481485
/**
482-
* \brief Get Wi-SUN Radio Quality information.
486+
* \brief Get Wi-SUN Stack information.
483487
*
484488
* Function reads Stack information from nanostack.
485489
* Mesh interface must be initialized before calling this function.
486490
*
487-
* \param radio_info_ptr Structure given to stack where information will be stored
491+
* \param stack_info_ptr Structure given to stack where information will be stored
488492
*
489493
* \return MESH_ERROR_NONE on success.
490494
* \return MESH_ERROR_UNKNOWN in case of failure.
491495
* */
492-
mesh_error_t radio_info_get(ws_radio_info_t *radio_info_ptr);
496+
mesh_error_t stack_info_get(ws_stack_state_t *stack_info_ptr);
493497

494498
protected:
495499
Nanostack::WisunInterface *get_interface() const;

features/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
}

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

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

553553
rpl_dodag_info_t dodag_ptr = {0};
554-
ws_stack_info_t stack_info = {0};
555-
uint8_t global_address[16] = {0};
556-
uint8_t link_local_address[16] = {0};
557554
uint8_t rpl_instance_count;
558555
uint8_t instance_id_list[10];
559556
uint8_t instance_id = RPL_INSTANCE_LOCAL;
@@ -587,44 +584,44 @@ mesh_error_t WisunInterface::info_get(ws_rpl_info_t *info_ptr)
587584
return MESH_ERROR_UNKNOWN;
588585
}
589586

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

611593
return MESH_ERROR_NONE;
612594
}
613595

614-
mesh_error_t radio_info_get(ws_radio_info_t *radio_info_ptr)
596+
mesh_error_t WisunInterface::stack_info_get(ws_stack_state_t *stack_info_ptr)
615597
{
616-
if (radio_info_ptr == NULL) {
598+
if (stack_info_ptr == NULL) {
617599
return MESH_ERROR_PARAM;
618600
}
619601

620602
ws_stack_info_t stack_info = {0};
603+
uint8_t global_address[16] = {0};
604+
uint8_t link_local_address[16] = {0};
621605

622606
if (ws_stack_info_get(get_interface_id(), &stack_info)) {
623607
return MESH_ERROR_UNKNOWN;
624608
}
625609

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

629626
return MESH_ERROR_NONE;
630627
}

0 commit comments

Comments
 (0)