Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
ws_neighbor_class.h
00001 /* 00002 * Copyright (c) 2018-2019, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef WS_NEIGHBOR_CLASS_H_ 00019 #define WS_NEIGHBOR_CLASS_H_ 00020 00021 #include "fhss_ws_extension.h " 00022 #include "6LoWPAN/ws/ws_common_defines.h" 00023 00024 #define RSL_UNITITIALIZED 0x7fff 00025 00026 typedef struct ws_neighbor_class_entry { 00027 fhss_ws_neighbor_timing_info_t fhss_data; 00028 uint16_t rsl_in; /*!< RSL EWMA heard from neighbour*/ 00029 uint16_t rsl_out; /*!< RSL EWMA heard by neighbour*/ 00030 uint16_t routing_cost; /*!< ETX to border Router. */ 00031 bool candidate_parent: 1; 00032 bool broadcast_timing_info_stored: 1; 00033 bool broadcast_shedule_info_stored: 1; 00034 bool synch_done : 1; 00035 bool accelerated_etx_probe : 1; 00036 bool negative_aro_send : 1; 00037 bool unicast_data_rx : 1; 00038 } ws_neighbor_class_entry_t; 00039 00040 /** 00041 * Neighbor hopping info data base 00042 */ 00043 typedef struct ws_neighbor_class_s { 00044 ws_neighbor_class_entry_t *neigh_info_list ; /*!< Allocated hopping info array*/ 00045 uint8_t list_size ; /*!< List size*/ 00046 } ws_neighbor_class_t; 00047 00048 00049 /** 00050 * ws_neighbor_class_alloc a function for allocate giving list size 00051 * 00052 * \param class_data pointer to structure which will be initialized by this function 00053 * \param list_size define list size 00054 * 00055 * \return true Allocate Ok 00056 * \return false Allocate Fail 00057 * 00058 */ 00059 bool ws_neighbor_class_alloc(ws_neighbor_class_t *class_data, uint8_t list_size); 00060 00061 /** 00062 * ws_neighbor_class_dealloc a function for free allocated neighbor hopping info 00063 * 00064 * \param class_data pointer to structure which will be initialized by this function 00065 * 00066 */ 00067 void ws_neighbor_class_dealloc(ws_neighbor_class_t *class_data); 00068 00069 /** 00070 * ws_neighbor_class_entry_t a function for search hopping info for giving neighbor attribut 00071 * 00072 * \param class_data pointer to structure which will be initialized by this function 00073 * \param attribute_index define pointer to storage info 00074 * 00075 * \return NULL when Attribute is not correct 00076 * \return Pointer to neighbor hopping info 00077 * 00078 */ 00079 ws_neighbor_class_entry_t *ws_neighbor_class_entry_get(ws_neighbor_class_t *class_data, uint8_t attribute_index); 00080 00081 /** 00082 * ws_neighbor_class_entry_t a function for search hopping info for giving neighbor attribute index 00083 * 00084 * \param class_data pointer to structure which will be initialized by this function 00085 * \param entry which attribute index is counted. 00086 * 00087 * \return Attribute index of entry 00088 * 00089 */ 00090 uint8_t ws_neighbor_class_entry_index_get(ws_neighbor_class_t *class_data, ws_neighbor_class_entry_t *entry); 00091 00092 /** 00093 * ws_neighbor_class_entry_remove a function for clean information should be call when neighbor is removed 00094 * 00095 * \param class_data pointer to structure which will be initialized by this function 00096 * \param attribute_index define pointer to storage info 00097 * 00098 */ 00099 void ws_neighbor_class_entry_remove(ws_neighbor_class_t *class_data, uint8_t attribute_index); 00100 00101 /** 00102 * ws_neighbor_class_neighbor_unicast_time_info_update a function for update neighbor unicast time information 00103 * 00104 * \param ws_neighbor pointer to neighbor 00105 * \param ws_utt Unicast time IE data 00106 * \param timestamp timestamp for received data 00107 * 00108 */ 00109 void ws_neighbor_class_neighbor_unicast_time_info_update(ws_neighbor_class_entry_t *ws_neighbor, ws_utt_ie_t *ws_utt, uint32_t timestamp); 00110 00111 /** 00112 * ws_neighbor_class_neighbor_unicast_schedule_set a function for update neighbor unicast shedule information 00113 * 00114 * \param ws_neighbor pointer to neighbor 00115 * \param ws_us Unicast schedule IE data 00116 * 00117 */ 00118 void ws_neighbor_class_neighbor_unicast_schedule_set(ws_neighbor_class_entry_t *ws_neighbor, ws_us_ie_t *ws_us); 00119 00120 00121 /** 00122 * ws_neighbor_class_neighbor_broadcast_time_info_update a function for update neighbor broadcast time information 00123 * 00124 * \param ws_neighbor pointer to neighbor 00125 * \param ws_bt_ie Broadcast time IE data 00126 * \param timestamp timestamp for received data 00127 * 00128 */ 00129 void ws_neighbor_class_neighbor_broadcast_time_info_update(ws_neighbor_class_entry_t *ws_neighbor, ws_bt_ie_t *ws_bt_ie, uint32_t timestamp); 00130 00131 /** 00132 * ws_neighbor_class_neighbor_broadcast_schedule_set a function for update neighbor broadcast shedule information 00133 * 00134 * \param ws_neighbor pointer to neighbor 00135 * \param ws_bs_ie Broadcast schedule IE data 00136 * 00137 */ 00138 void ws_neighbor_class_neighbor_broadcast_schedule_set(ws_neighbor_class_entry_t *ws_neighbor, ws_bs_ie_t *ws_bs_ie); 00139 00140 /** 00141 * ws_neighbor_class_rf_sensitivity_calculate 00142 * 00143 * Calculates minimum heard RSL value from all packets. 00144 * This will dynamically adjusts min sensitivity if value is not properly set 00145 * 00146 * \param rsl_heard; rsl_heard heard from Radio 00147 * 00148 */ 00149 void ws_neighbor_class_rf_sensitivity_calculate(uint8_t rsl_heard); 00150 00151 /** 00152 * ws_neighbor_class_rsl_from_dbm_calculate 00153 * 00154 * Calculates rsl value from dbm heard. 00155 * This provides a range of -174 (0) to +80 (254) dBm. 00156 * 00157 * \param dbm_heard; dbm heard from the neighbour 00158 * 00159 */ 00160 uint8_t ws_neighbor_class_rsl_from_dbm_calculate(int8_t dbm_heard); 00161 00162 /** Helper macros to read RSL values from neighbour class. 00163 * 00164 */ 00165 #define ws_neighbor_class_rsl_in_get(ws_neighbour) (ws_neighbour->rsl_in >> WS_RSL_SCALING) 00166 #define ws_neighbor_class_rsl_out_get(ws_neighbour) (ws_neighbour->rsl_out >> WS_RSL_SCALING) 00167 00168 /** 00169 * ws_neighbor_class_neighbor_broadcast_schedule_set a function for update neighbor broadcast shedule information 00170 * 00171 * \param ws_neighbor pointer to neighbor 00172 * \param dbm_heard; dbm heard from the neighbour 00173 * 00174 */ 00175 void ws_neighbor_class_rsl_in_calculate(ws_neighbor_class_entry_t *ws_neighbor, int8_t dbm_heard); 00176 /** 00177 * ws_neighbor_class_neighbor_broadcast_schedule_set a function for update neighbor broadcast shedule information 00178 * 00179 * \param ws_neighbor pointer to neighbor 00180 * \param rsl_reported; rsl value reported by neighbour in packet from RSL-IE 00181 * 00182 */ 00183 void ws_neighbor_class_rsl_out_calculate(ws_neighbor_class_entry_t *ws_neighbor, uint8_t rsl_reported); 00184 00185 #endif /* WS_NEIGHBOR_CLASS_H_ */
Generated on Tue Jul 12 2022 13:55:04 by
