ISSDK  1.7
IoT Sensing Software Development Kit
data_format_service.h
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
4  * Copyright 2016-2017 NXP
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,
8  * are permitted (subject to the limitations in the disclaimer below) provided
9  * that the following conditions are met:
10  *
11  * o Redistributions of source code must retain the above copyright notice, this list
12  * of conditions and the following disclaimer.
13  *
14  * o Redistributions in binary form must reproduce the above copyright notice, this
15  * list of conditions and the following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * o Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 /**
35 * @file data_format_service.h
36 * @brief The format_service.h file describes the interface and structures for the data-format standards.
37 */
38 
39 #ifndef DATA_FORMAT_SERVICE_H_
40 #define DATA_FORMAT_SERVICE_H_
41 #include <stddef.h>
42 #include <stdint.h>
43 #include <stdbool.h>
44 
45 #define DATA_FORMAT_OK 0 ///< Operation succeeded
46 
47 /*******************************************************************************
48  * Definitions
49  ******************************************************************************/
50 
51 /* @brief This defines the communication handle.
52  */
53 typedef struct _comm_handle_
54 {
55  void *pComm; /*!< pointer to a specific communication channel.*/
56  uint32_t status; /*!< Current Comm status.*/
58 
59 /* Event function signature.*/
60 typedef void (*DATA_FORMAT_Event_t)(void *pData); /*< Pointer to data format Event.*/
61 
62 /*! @brief The interface function to initialize the data-format service.*/
63 typedef int32_t(DATA_FORMAT_Init_t)(DATA_FORMAT_Event_t event, void *pInitializeData);
64 /*! @brief The interface function to serialize the data*/
65 typedef int32_t(DATA_FORMAT_Serialize_t)(void *pData, uint32_t size, void *pDataElement);
66 /*! @brief The interface function to deserialize the data.*/
67 typedef int32_t(DATA_FORMAT_Deserialize_t)(void *pData, uint32_t size, void *pDataElement);
68 /*! @brief The interface function to append the data on the formated stream*/
69 typedef int32_t (DATA_FORMAT_Append_t)) (void * pData, uint32_t size, void* pDataElement));
70 
71 /* @brief This defines the function pointers for the data format interface.
72  */
74 {
75  DATA_FORMAT_Init_t *Init; /*!< Pointer to the data-format Initialize() function. */
76  DATA_FORMAT_Serialize_t *Serialize; /*!< Pointer to the data-format Serialize() function. */
77  DATA_FORMAT_Deserialize_t *Deserialize; /*!< Pointer to the data-format Deserialize() function. */
78  DATA_FORMAT_Append_t *Append; /*!< Pointer to the data-format Append() function. */
80 #endif // DATA_FORMAT_SERVICE_H_
struct _comm_handle_ comm_handle_t
uint32_t void * pDataElement
DATA_FORMAT_Init_t * Init
void(* DATA_FORMAT_Event_t)(void *pData)
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
uint32_t size
DATA_FORMAT_Deserialize_t * Deserialize
int32_t() DATA_FORMAT_Init_t(DATA_FORMAT_Event_t event, void *pInitializeData)
The interface function to initialize the data-format service.
int32_t() DATA_FORMAT_Serialize_t(void *pData, uint32_t size, void *pDataElement)
The interface function to serialize the data.
int32_t() DATA_FORMAT_Deserialize_t(void *pData, uint32_t size, void *pDataElement)
The interface function to deserialize the data.
uint32_t status
DATA_FORMAT_Serialize_t * Serialize
DATA_FORMAT_Append_t * Append
struct _data_format_interface_ data_format_interface_t