Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers thread_lowpower_private_api.h Source File

thread_lowpower_private_api.h

00001 /*
00002  * Copyright (c) 2016-2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: BSD-3-Clause
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the copyright holder nor the
00014  *    names of its contributors may be used to endorse or promote products
00015  *    derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 
00030 /**
00031  * \brief Nanostack lowpower instance and corresponding methods.
00032  */
00033 
00034 #ifndef THREAD_THREAD_LOWPOWER_PRIVATE_API_H_
00035 #define THREAD_THREAD_LOWPOWER_PRIVATE_API_H_
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00041 #ifdef HAVE_THREAD_V2
00042 
00043 /** \brief function to process data response received for link metrics
00044  *
00045  * \param src_address address source address of the data response message
00046  * \param instance_id instance_id of the interface
00047  * \param data_ptr response data
00048  * \param data_len length of the response received
00049  *
00050  */
00051 void thread_lowpower_process_response(uint8_t *src_address, int8_t instance_id, uint8_t *data_ptr, uint16_t data_len);
00052 
00053 /** \brief function to process data request received for link metrics.
00054  * Function processes only data request messages
00055  *
00056  * \param mle_msg
00057  *
00058  */
00059 int thread_lowpower_process_request(mle_message_t *mle_msg);
00060 
00061 /** \brief function to check if the lowpower metrics requested is ready
00062  *
00063  * \param cur protocol interface
00064  * \param ticks ticks for timer
00065  *
00066  */
00067 int thread_lowpower_timer(protocol_interface_info_entry_t *cur, uint32_t ticks);
00068 
00069 /** \brief function writes the link metrics tlv if available
00070  *
00071  * \param cur protocol interface
00072  * \param destination_address destination address for link metrics
00073  * \param ptr location to which the metrics are written
00074  *
00075  */
00076 uint8_t *thread_lowpower_link_metrics_write(protocol_interface_info_entry_t *cur, uint8_t *destination_address, uint8_t *ptr);
00077 
00078 /** \brief function calculates the link metrics length if metrics available
00079  *
00080  * \param cur protocol interface
00081  * \param destination_address destination address for link metrics
00082  *
00083  */
00084 uint8_t thread_lowpower_link_metrics_length(protocol_interface_info_entry_t *cur, uint8_t *destination_address);
00085 
00086 /** \brief function calculates the link metrics length if metrics available
00087  *
00088  * \param cur protocol interface
00089  * \param destination_address destination address for link metrics
00090  *
00091  */
00092 void thread_lowpower_metrics_management_query_request_process(protocol_interface_info_entry_t *cur, mle_message_t *mle_msg, mle_security_header_t *security_headers, uint8_t linkMargin);
00093 
00094 #else /* HAVE_THREAD_V2 */
00095 
00096 #define thread_lowpower_process_request(mle_msg)
00097 #define thread_lowpower_process_response(src_address, instance_id, data_ptr, data_len)
00098 #define thread_lowpower_timer(cur, ticks)
00099 #define thread_lowpower_link_metrics_write(cur, destination_address, ptr) (ptr)
00100 #define thread_lowpower_link_metrics_length(cur, destination_address) (0)
00101 #define thread_lowpower_metrics_management_query_request_process(cur, mle_msg, security_headers, linkMargin)
00102 
00103 #endif /* HAVE_THREAD_V2 */
00104 
00105 
00106 #ifdef __cplusplus
00107 }
00108 #endif
00109 
00110 #endif /* THREAD_THREAD_LOWPOWER_PRIVATE_API_H_ */