Skip to content

Commit cdd7f2d

Browse files
author
Juha Heiskanen
committed
Added API for configure supported Phy capability.
1 parent a00a3c0 commit cdd7f2d

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

nanostack/ws_management_api.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,28 @@ typedef struct ws_neighbour_info {
225225
ws_management_neighbor_type_e type;
226226
} ws_neighbour_info_t;
227227

228+
229+
/**
230+
* @brief ws_management_pcap_t Wi-SUN FAN 1.1 Phy Capability type and opeartion mode
231+
*/
232+
typedef struct ws_management_pcap {
233+
/** Phy type */
234+
uint8_t phy_type;
235+
/** Phy operation mode */
236+
uint16_t operation_mode;
237+
} ws_management_pcap_t;
238+
239+
/**
240+
* @brief ws_management_pcap_info_t Wi-SUN FAN 1.1 Phy Capability list for MDR support
241+
*/
242+
typedef struct ws_management_pcap_info {
243+
/** Length of the capability */
244+
uint8_t length_of_list: 3;
245+
/** Capability information */
246+
ws_management_pcap_t pcap[7];
247+
} ws_management_pcap_info_t;
248+
249+
228250
/**
229251
* Initialize Wi-SUN stack.
230252
*
@@ -875,6 +897,20 @@ int ws_device_min_sens_set(
875897
int8_t interface_id,
876898
uint8_t device_min_sens);
877899

900+
/**
901+
* Set Phy Capability support for MDR, FAN 1.1 feature
902+
*
903+
*
904+
* \param interface_id Network interface ID.
905+
* \param pcap_list pointer to supported list
906+
*
907+
* \return 0 Success.
908+
* \return <0 Failure.
909+
*/
910+
int ws_management_phy_capability_set(
911+
int8_t interface_id,
912+
ws_management_pcap_info_t *pcap_list);
913+
878914
#ifdef __cplusplus
879915
}
880916
#endif

source/6LoWPAN/ws/ws_empty_functions.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,5 +503,14 @@ int ws_test_procedure_trigger(int8_t interface_id, ws_test_proc_t procedure, voi
503503
return -1;
504504
}
505505

506+
int ws_management_phy_capability_set(
507+
int8_t interface_id,
508+
ws_management_pcap_info_t *pcap_list)
509+
{
510+
(void)interface_id;
511+
(void)pcap_list;
512+
return -1;
513+
}
514+
506515

507516
#endif // no HAVE_WS

source/6LoWPAN/ws/ws_management_api.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,4 +957,33 @@ int ws_device_min_sens_set(
957957
return 0;
958958
}
959959

960+
int ws_management_phy_capability_set(
961+
int8_t interface_id,
962+
ws_management_pcap_info_t *pcap_list)
963+
{
964+
#ifdef HAVE_WS_VERSION_1_1
965+
protocol_interface_info_entry_t *cur;
966+
cur = protocol_stack_interface_info_get_by_id(interface_id);
967+
if (!cur || !ws_info(cur) || pcap_list->length_of_list > 7) {
968+
return -1;
969+
}
970+
971+
//Set supported configure for MDR
972+
//TODO add validation for Phy_type and operation modes
973+
cur->ws_info->phy_cap_info.length_of_list = pcap_list->length_of_list;
974+
for (int i = 0; i < pcap_list->length_of_list; i++) {
975+
cur->ws_info->phy_cap_info.pcap[i].phy_type = pcap_list->pcap[i].phy_type;
976+
cur->ws_info->phy_cap_info.pcap[i].operation_mode = pcap_list->pcap[i].operation_mode;
977+
}
978+
979+
return 0;
980+
981+
#else
982+
(void)interface_id;
983+
(void)pcap_list;
984+
return -1;
985+
#endif
986+
}
987+
988+
960989
#endif // HAVE_WS

test/nanostack/unittest/stub/ws_ie_lib_stub.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,8 @@ uint8_t *ws_wp_nested_pcap_write(uint8_t *ptr, struct ws_phy_cap_info *pcap_list
227227
ptr += 2 + 1;
228228
return ptr;
229229
}
230+
231+
bool ws_wp_nested_pcap_read(uint8_t *data, uint16_t length, struct ws_phy_cap_info *ws_pcap_list)
232+
{
233+
return false;
234+
}

0 commit comments

Comments
 (0)