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.
ws_neighbor_class.h
00001 /* 00002 * Copyright (c) 2016-2018, 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 typedef struct ws_neighbor_class_entry { 00025 fhss_ws_neighbor_timing_info_t fhss_data; 00026 uint16_t rsl_in; /*!< RSL EWMA heard from neighbour*/ 00027 uint16_t rsl_out; /*!< RSL EWMA heard by neighbour*/ 00028 bool candidate_parent:1; 00029 } ws_neighbor_class_entry_t; 00030 00031 /** 00032 * Neighbor hopping info data base 00033 */ 00034 typedef struct ws_neighbor_class_s { 00035 ws_neighbor_class_entry_t *neigh_info_list ; /*!< Allocated hopping info array*/ 00036 uint8_t list_size ; /*!< List size*/ 00037 } ws_neighbor_class_t; 00038 00039 /** 00040 * ws_neighbor_class_alloc a function for allocate giving list size 00041 * 00042 * \param class_data pointer to structure which will be initialized by this function 00043 * \param list_size define list size 00044 * 00045 * \return true Allocate Ok 00046 * \return false Allocate Fail 00047 * 00048 */ 00049 bool ws_neighbor_class_alloc(ws_neighbor_class_t *class_data, uint8_t list_size); 00050 00051 /** 00052 * ws_neighbor_class_dealloc a function for free allocated neighbor hopping info 00053 * 00054 * \param class_data pointer to structure which will be initialized by this function 00055 * 00056 */ 00057 void ws_neighbor_class_dealloc(ws_neighbor_class_t *class_data); 00058 00059 /** 00060 * ws_neighbor_class_entry_t a function for search hopping info for giving neighbor attribut 00061 * 00062 * \param class_data pointer to structure which will be initialized by this function 00063 * \param attribute_index define pointer to storage info 00064 * 00065 * \return NULL when Attribute is not correct 00066 * \return Pointer to neighbor hopping info 00067 * 00068 */ 00069 ws_neighbor_class_entry_t * ws_neighbor_class_entry_get(ws_neighbor_class_t *class_data, uint8_t attribute_index); 00070 00071 /** 00072 * ws_neighbor_class_entry_t a function for search hopping info for giving neighbor attribute index 00073 * 00074 * \param class_data pointer to structure which will be initialized by this function 00075 * \param entry which attribute index is counted. 00076 * 00077 * \return Attribute index of entry 00078 * 00079 */ 00080 uint8_t ws_neighbor_class_entry_index_get(ws_neighbor_class_t *class_data, ws_neighbor_class_entry_t *entry); 00081 00082 /** 00083 * ws_neighbor_class_entry_remove a function for clean information should be call when neighbor is removed 00084 * 00085 * \param class_data pointer to structure which will be initialized by this function 00086 * \param attribute_index define pointer to storage info 00087 * 00088 */ 00089 void ws_neighbor_class_entry_remove(ws_neighbor_class_t *class_data, uint8_t attribute_index); 00090 00091 /** 00092 * ws_neighbor_class_neighbor_unicast_time_info_update a function for update neighbor unicast time information 00093 * 00094 * \param ws_neighbor pointer to neighbor 00095 * \param ws_utt Unicast time IE data 00096 * \param timestamp timestamp for received data 00097 * 00098 */ 00099 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); 00100 00101 /** 00102 * ws_neighbor_class_neighbor_unicast_schedule_set a function for update neighbor unicast shedule information 00103 * 00104 * \param ws_neighbor pointer to neighbor 00105 * \param ws_us Unicast schedule IE data 00106 * 00107 */ 00108 void ws_neighbor_class_neighbor_unicast_schedule_set(ws_neighbor_class_entry_t *ws_neighbor, ws_us_ie_t *ws_us); 00109 00110 00111 /** 00112 * ws_neighbor_class_neighbor_broadcast_time_info_update a function for update neighbor broadcast time information 00113 * 00114 * \param ws_neighbor pointer to neighbor 00115 * \param ws_bt_ie Broadcast time IE data 00116 * \param timestamp timestamp for received data 00117 * 00118 */ 00119 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); 00120 00121 /** 00122 * ws_neighbor_class_neighbor_broadcast_schedule_set a function for update neighbor broadcast shedule information 00123 * 00124 * \param ws_neighbor pointer to neighbor 00125 * \param ws_bs_ie Broadcast schedule IE data 00126 * 00127 */ 00128 void ws_neighbor_class_neighbor_broadcast_schedule_set(ws_neighbor_class_entry_t *ws_neighbor, ws_bs_ie_t *ws_bs_ie); 00129 00130 /** 00131 * ws_neighbor_class_rssi_from_dbm_calculate 00132 * 00133 * Calculates rssi value from dbm heard taking into account min sensitivity of radio 00134 * dynamically adjusts min sensitivity if value is not properly set 00135 * 00136 * \param dbm_heard; dbm heard from the neighbour 00137 * 00138 */ 00139 uint8_t ws_neighbor_class_rssi_from_dbm_calculate(int8_t dbm_heard); 00140 00141 /** Helper macros to read RSL values from neighbour class. 00142 * 00143 */ 00144 #define ws_neighbor_class_rsl_in_get(ws_neighbour) (ws_neighbour->rsl_in >> WS_RSL_SCALING) 00145 #define ws_neighbor_class_rsl_out_get(ws_neighbour) (ws_neighbour->rsl_in >> WS_RSL_SCALING) 00146 00147 /** 00148 * ws_neighbor_class_neighbor_broadcast_schedule_set a function for update neighbor broadcast shedule information 00149 * 00150 * \param ws_neighbor pointer to neighbor 00151 * \param dbm_heard; dbm heard from the neighbour 00152 * 00153 */ 00154 void ws_neighbor_class_rsl_in_calculate(ws_neighbor_class_entry_t *ws_neighbor, int8_t dbm_heard); 00155 /** 00156 * ws_neighbor_class_neighbor_broadcast_schedule_set a function for update neighbor broadcast shedule information 00157 * 00158 * \param ws_neighbor pointer to neighbor 00159 * \param rsl_reported; rsl value reported by neighbour in packet from RSL-IE 00160 * 00161 */ 00162 void ws_neighbor_class_rsl_out_calculate(ws_neighbor_class_entry_t *ws_neighbor, uint8_t rsl_reported); 00163 00164 #endif /* WS_NEIGHBOR_CLASS_H_ */
Generated on Tue Aug 9 2022 00:37:24 by
1.7.2