updates

Fork of nrf51-sdk by Lancaster University

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers peer_data.h Source File

peer_data.h

00001 /*
00002  * Copyright (c) Nordic Semiconductor ASA
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without modification,
00006  * are permitted provided that the following conditions are met:
00007  *
00008  *   1. Redistributions of source code must retain the above copyright notice, this
00009  *   list of conditions and the following disclaimer.
00010  *
00011  *   2. Redistributions in binary form must reproduce the above copyright notice, this
00012  *   list of conditions and the following disclaimer in the documentation and/or
00013  *   other materials provided with the distribution.
00014  *
00015  *   3. Neither the name of Nordic Semiconductor ASA nor the names of other
00016  *   contributors to this software may be used to endorse or promote products
00017  *   derived from this software without specific prior written permission.
00018  *
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00021  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00022  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00023  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
00024  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00025  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00026  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00027  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00028  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00029  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030  *
00031  */
00032 
00033 
00034 #ifndef PEER_DATA_H__
00035 #define PEER_DATA_H__
00036 
00037 #include <stdint.h>
00038 #include "peer_manager_types.h "
00039 #include "fds.h"
00040 
00041 
00042 /**
00043  * @defgroup peer_data Peer Data
00044  * @ingroup peer_manager
00045  * @{
00046  * @brief An internal module of @ref peer_manager. This module defines the structure of the data
00047  *        that is managed by the @ref peer_manager. It also provides functions for parsing the data.
00048  */
00049 
00050 
00051 /**@brief Function for enumerating the separate (non-contiguous) parts of the peer data.
00052  *
00053  * @param[in]  p_peer_data  The peer data to enumerate.
00054  * @param[out] p_chunks      The resulting chunks. This must be an array of at least 2 elements.
00055  * @param[out] p_n_chunks    The number of chunks. If this is 0, something went wrong.
00056  */
00057 void peer_data_parts_get(pm_peer_data_const_t const * p_peer_data, fds_record_chunk_t * p_chunks, uint16_t * p_n_chunks);
00058 
00059 
00060 /**@brief Function for converting @ref pm_peer_data_flash_t into @ref pm_peer_data_t.
00061  *
00062  * @param[in]  p_in_data   The source data.
00063  * @param[out] p_out_data  The target data structure.
00064  *
00065  * @retval NRF_SUCCESS       Successful conversion.
00066  * @retval NRF_ERROR_NULL    A parameter was NULL.
00067  * @retval NRF_ERROR_NO_MEM  A buffer was not large enough.
00068  */
00069 ret_code_t peer_data_deserialize(pm_peer_data_flash_t const * p_in_data, pm_peer_data_t * p_out_data);
00070 
00071 /** @} */
00072 
00073 #endif /* PEER_DATA_H__ */