mirror of https://github.com/ARMmbed/mbed-os.git
Resolving comments
parent
c5386c0cee
commit
72c28ee497
|
@ -21,10 +21,10 @@
|
||||||
* \brief Struct br_information Border router dynamic information.
|
* \brief Struct br_information Border router dynamic information.
|
||||||
*/
|
*/
|
||||||
typedef struct ws_br_info {
|
typedef struct ws_br_info {
|
||||||
/** Mesh Interface Global Address */
|
/** Address prefix given to devices in network set to 0 if not available*/
|
||||||
uint8_t global_addr[16];
|
uint8_t ipv6_prefix[8];
|
||||||
/** Mesh Interface Link Local Address */
|
/** IID of Border router */
|
||||||
uint8_t link_local_addr[16];
|
uint8_t ipv6_iid[8];
|
||||||
/** Border router dodag id */
|
/** Border router dodag id */
|
||||||
uint8_t rpl_dodag_id[16];
|
uint8_t rpl_dodag_id[16];
|
||||||
/** Border router instance identifier defined in RPL */
|
/** Border router instance identifier defined in RPL */
|
||||||
|
@ -35,8 +35,6 @@ typedef struct ws_br_info {
|
||||||
uint64_t host_timestamp;
|
uint64_t host_timestamp;
|
||||||
/** Amount of devices in the network. */
|
/** Amount of devices in the network. */
|
||||||
uint16_t device_count;
|
uint16_t device_count;
|
||||||
/** Backbone IPv6 Global Address */
|
|
||||||
uint8_t backbone_global_addr[16];
|
|
||||||
/** Gateway Local Address */
|
/** Gateway Local Address */
|
||||||
uint8_t gateway_addr[16];
|
uint8_t gateway_addr[16];
|
||||||
} ws_br_info_t;
|
} ws_br_info_t;
|
||||||
|
@ -213,7 +211,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int8_t _mesh_if_id = -1;
|
int8_t _mesh_if_id = -1;
|
||||||
int8_t _backbone_if_id = -1;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,6 @@
|
||||||
* \brief Struct ws_rpl_info Wi-SUN router RPL information.
|
* \brief Struct ws_rpl_info Wi-SUN router RPL information.
|
||||||
*/
|
*/
|
||||||
typedef struct ws_rpl_info {
|
typedef struct ws_rpl_info {
|
||||||
/** IPv6 Global Address of Router Node*/
|
|
||||||
uint8_t global_addr[16];
|
|
||||||
/** IPv6 Link Local Address of Router Node*/
|
|
||||||
uint8_t link_local_addr[16];
|
|
||||||
/** Router dodag id */
|
/** Router dodag id */
|
||||||
uint8_t rpl_dodag_id[16];
|
uint8_t rpl_dodag_id[16];
|
||||||
/** Router instance identifier */
|
/** Router instance identifier */
|
||||||
|
@ -37,19 +33,27 @@ typedef struct ws_rpl_info {
|
||||||
uint16_t curent_rank;
|
uint16_t curent_rank;
|
||||||
/** RPL Primary Parent Rank */
|
/** RPL Primary Parent Rank */
|
||||||
uint16_t primary_parent_rank;
|
uint16_t primary_parent_rank;
|
||||||
/** RPL Primary Parent Address */
|
|
||||||
uint8_t rpl_parent_addr[16];
|
|
||||||
} ws_rpl_info_t;
|
} ws_rpl_info_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Struct ws_radio_info Wi-SUN router Radio Quality information.
|
* \brief Struct ws_stack_state Wi-SUN stack information.
|
||||||
*/
|
*/
|
||||||
typedef struct ws_radio_info {
|
typedef struct ws_stack_state {
|
||||||
/** parent RSSI in measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/
|
/** Mesh Interface Global IPv6 Address */
|
||||||
uint8_t rsl_in;
|
uint8_t global_addr[16];
|
||||||
|
/** Mesh Interface Link Local IPv6 Address */
|
||||||
|
uint8_t link_local_addr[16];
|
||||||
|
/** Parent link local address */
|
||||||
|
uint8_t parent_addr[16];
|
||||||
/** parent RSSI Out measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/
|
/** parent RSSI Out measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/
|
||||||
uint8_t rsl_out;
|
uint8_t rsl_out;
|
||||||
} ws_radio_info_t;
|
/** parent RSSI in measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/
|
||||||
|
uint8_t rsl_in;
|
||||||
|
/** Wi-SUN join state defined by Wi-SUN specification 1-5 */
|
||||||
|
uint8_t join_state;
|
||||||
|
/** Network PAN ID */
|
||||||
|
uint16_t pan_id;
|
||||||
|
} ws_stack_state_t;
|
||||||
|
|
||||||
/** Wi-SUN mesh network interface class
|
/** Wi-SUN mesh network interface class
|
||||||
*
|
*
|
||||||
|
@ -479,17 +483,17 @@ public:
|
||||||
mesh_error_t info_get(ws_rpl_info_t *info_ptr);
|
mesh_error_t info_get(ws_rpl_info_t *info_ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get Wi-SUN Radio Quality information.
|
* \brief Get Wi-SUN Stack information.
|
||||||
*
|
*
|
||||||
* Function reads Stack information from nanostack.
|
* Function reads Stack information from nanostack.
|
||||||
* Mesh interface must be initialized before calling this function.
|
* Mesh interface must be initialized before calling this function.
|
||||||
*
|
*
|
||||||
* \param radio_info_ptr Structure given to stack where information will be stored
|
* \param stack_info_ptr Structure given to stack where information will be stored
|
||||||
*
|
*
|
||||||
* \return MESH_ERROR_NONE on success.
|
* \return MESH_ERROR_NONE on success.
|
||||||
* \return MESH_ERROR_UNKNOWN in case of failure.
|
* \return MESH_ERROR_UNKNOWN in case of failure.
|
||||||
* */
|
* */
|
||||||
mesh_error_t radio_info_get(ws_radio_info_t *radio_info_ptr);
|
mesh_error_t stack_info_get(ws_stack_state_t *stack_info_ptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Nanostack::WisunInterface *get_interface() const;
|
Nanostack::WisunInterface *get_interface() const;
|
||||||
|
|
|
@ -52,7 +52,6 @@ mesh_error_t WisunBorderRouter::start(NetworkInterface *mesh_if, NetworkInterfac
|
||||||
if (backbone_if_id < 0) {
|
if (backbone_if_id < 0) {
|
||||||
return MESH_ERROR_UNKNOWN;
|
return MESH_ERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
_backbone_if_id = backbone_if_id;
|
|
||||||
|
|
||||||
int ret = ws_bbr_start(mesh_if_id, backbone_if_id);
|
int ret = ws_bbr_start(mesh_if_id, backbone_if_id);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -159,8 +158,6 @@ mesh_error_t WisunBorderRouter::validate_pan_configuration(uint16_t pan_id)
|
||||||
mesh_error_t WisunBorderRouter::info_get(ws_br_info_t *info_ptr)
|
mesh_error_t WisunBorderRouter::info_get(ws_br_info_t *info_ptr)
|
||||||
{
|
{
|
||||||
bbr_information_t bbr_info = {0};
|
bbr_information_t bbr_info = {0};
|
||||||
uint8_t mesh_link_local_addr[16] = {0};
|
|
||||||
uint8_t backbone_global_addr[16] = {0};
|
|
||||||
|
|
||||||
if (info_ptr == NULL) {
|
if (info_ptr == NULL) {
|
||||||
return MESH_ERROR_PARAM;
|
return MESH_ERROR_PARAM;
|
||||||
|
@ -171,24 +168,14 @@ mesh_error_t WisunBorderRouter::info_get(ws_br_info_t *info_ptr)
|
||||||
return MESH_ERROR_UNKNOWN;
|
return MESH_ERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arm_net_address_get(_mesh_if_id, ADDR_IPV6_LL, mesh_link_local_addr) != 0) {
|
|
||||||
// No global prefix available, Nothing to do.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arm_net_address_get(_backbone_if_id, ADDR_IPV6_GP, backbone_global_addr) != 0) {
|
|
||||||
// No global prefix available, Nothing to do.
|
|
||||||
}
|
|
||||||
|
|
||||||
info_ptr->device_count = bbr_info.devices_in_network;
|
info_ptr->device_count = bbr_info.devices_in_network;
|
||||||
info_ptr->host_timestamp = bbr_info.timestamp;
|
info_ptr->host_timestamp = bbr_info.timestamp;
|
||||||
info_ptr->instance_id = bbr_info.instance_id;
|
info_ptr->instance_id = bbr_info.instance_id;
|
||||||
info_ptr->version = bbr_info.version;
|
info_ptr->version = bbr_info.version;
|
||||||
memcpy(info_ptr->rpl_dodag_id, bbr_info.dodag_id, 16);
|
memcpy(info_ptr->rpl_dodag_id, bbr_info.dodag_id, 16);
|
||||||
memcpy(info_ptr->global_addr, bbr_info.prefix, 8);
|
memcpy(info_ptr->ipv6_prefix, bbr_info.prefix, 8);
|
||||||
memcpy(info_ptr->global_addr + 8, bbr_info.IID, 8);
|
memcpy(info_ptr->ipv6_iid, bbr_info.IID, 8);
|
||||||
memcpy(info_ptr->gateway_addr, bbr_info.gateway, 16);
|
memcpy(info_ptr->gateway_addr, bbr_info.gateway, 16);
|
||||||
memcpy(info_ptr->link_local_addr, mesh_link_local_addr, 16);
|
|
||||||
memcpy(info_ptr->backbone_global_addr, backbone_global_addr, 16);
|
|
||||||
|
|
||||||
return MESH_ERROR_NONE;
|
return MESH_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -551,9 +551,6 @@ mesh_error_t WisunInterface::info_get(ws_rpl_info_t *info_ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl_dodag_info_t dodag_ptr = {0};
|
rpl_dodag_info_t dodag_ptr = {0};
|
||||||
ws_stack_info_t stack_info = {0};
|
|
||||||
uint8_t global_address[16] = {0};
|
|
||||||
uint8_t link_local_address[16] = {0};
|
|
||||||
uint8_t rpl_instance_count;
|
uint8_t rpl_instance_count;
|
||||||
uint8_t instance_id_list[10];
|
uint8_t instance_id_list[10];
|
||||||
uint8_t instance_id = RPL_INSTANCE_LOCAL;
|
uint8_t instance_id = RPL_INSTANCE_LOCAL;
|
||||||
|
@ -587,6 +584,25 @@ mesh_error_t WisunInterface::info_get(ws_rpl_info_t *info_ptr)
|
||||||
return MESH_ERROR_UNKNOWN;
|
return MESH_ERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info_ptr->instance_id = dodag_ptr.instance_id;
|
||||||
|
info_ptr->version = dodag_ptr.version_num;
|
||||||
|
info_ptr->curent_rank = dodag_ptr.curent_rank;
|
||||||
|
info_ptr->primary_parent_rank = dodag_ptr.primary_parent_rank;
|
||||||
|
memcpy(info_ptr->rpl_dodag_id, dodag_ptr.dodag_id, 16);
|
||||||
|
|
||||||
|
return MESH_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
mesh_error_t WisunInterface::stack_info_get(ws_stack_state_t *stack_info_ptr)
|
||||||
|
{
|
||||||
|
if (stack_info_ptr == NULL) {
|
||||||
|
return MESH_ERROR_PARAM;
|
||||||
|
}
|
||||||
|
|
||||||
|
ws_stack_info_t stack_info = {0};
|
||||||
|
uint8_t global_address[16] = {0};
|
||||||
|
uint8_t link_local_address[16] = {0};
|
||||||
|
|
||||||
if (ws_stack_info_get(get_interface_id(), &stack_info)) {
|
if (ws_stack_info_get(get_interface_id(), &stack_info)) {
|
||||||
return MESH_ERROR_UNKNOWN;
|
return MESH_ERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -599,32 +615,13 @@ mesh_error_t WisunInterface::info_get(ws_rpl_info_t *info_ptr)
|
||||||
// No local prefix available, Nothing to do.
|
// No local prefix available, Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
info_ptr->instance_id = dodag_ptr.instance_id;
|
stack_info_ptr->join_state = stack_info.join_state;
|
||||||
info_ptr->version = dodag_ptr.version_num;
|
stack_info_ptr->pan_id = stack_info.pan_id;
|
||||||
info_ptr->curent_rank = dodag_ptr.curent_rank;
|
stack_info_ptr->rsl_in = stack_info.rsl_in;
|
||||||
info_ptr->primary_parent_rank = dodag_ptr.primary_parent_rank;
|
stack_info_ptr->rsl_out = stack_info.rsl_out;
|
||||||
memcpy(info_ptr->rpl_dodag_id, dodag_ptr.dodag_id, 16);
|
memcpy(stack_info_ptr->parent_addr, stack_info.parent, 16);
|
||||||
memcpy(info_ptr->global_addr, global_address, 16);
|
memcpy(stack_info_ptr->global_addr, global_address, 16);
|
||||||
memcpy(info_ptr->link_local_addr, link_local_address, 16);
|
memcpy(stack_info_ptr->link_local_addr, link_local_address, 16);
|
||||||
memcpy(info_ptr->rpl_parent_addr, stack_info.parent, 16);
|
|
||||||
|
|
||||||
return MESH_ERROR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
mesh_error_t radio_info_get(ws_radio_info_t *radio_info_ptr)
|
|
||||||
{
|
|
||||||
if (radio_info_ptr == NULL) {
|
|
||||||
return MESH_ERROR_PARAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
ws_stack_info_t stack_info = {0};
|
|
||||||
|
|
||||||
if (ws_stack_info_get(get_interface_id(), &stack_info)) {
|
|
||||||
return MESH_ERROR_UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
radio_info_ptr->rsl_in = stack_info.rsl_in;
|
|
||||||
radio_info_ptr->rsl_out = stack_info.rsl_out;
|
|
||||||
|
|
||||||
return MESH_ERROR_NONE;
|
return MESH_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue