1 /* 2 * Copyright (c) 2015-2016, Freescale Semiconductor, Inc. 3 * Copyright 2016-2017 NXP 4 * All rights reserved. 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 /** 9 * @file data_format_service.h 10 * @brief The format_service.h file describes the interface and structures for the data-format standards. 11 */ 12 13 #ifndef DATA_FORMAT_SERVICE_H_ 14 #define DATA_FORMAT_SERVICE_H_ 15 #include <stddef.h> 16 #include <stdint.h> 17 #include <stdbool.h> 18 19 #define DATA_FORMAT_OK 0 ///< Operation succeeded 20 21 /******************************************************************************* 22 * Definitions 23 ******************************************************************************/ 24 25 /* @brief This defines the communication handle. 26 */ 27 typedef struct _comm_handle_ 28 { 29 void *pComm; /*!< pointer to a specific communication channel.*/ 30 uint32_t status; /*!< Current Comm status.*/ 31 } comm_handle_t; 32 33 /* Event function signature.*/ 34 typedef void (*DATA_FORMAT_Event_t)(void *pData); /*< Pointer to data format Event.*/ 35 36 /*! @brief The interface function to initialize the data-format service.*/ 37 typedef int32_t(DATA_FORMAT_Init_t)(DATA_FORMAT_Event_t event, void *pInitializeData); 38 /*! @brief The interface function to serialize the data*/ 39 typedef int32_t(DATA_FORMAT_Serialize_t)(void *pData, uint32_t size, void *pDataElement); 40 /*! @brief The interface function to deserialize the data.*/ 41 typedef int32_t(DATA_FORMAT_Deserialize_t)(void *pData, uint32_t size, void *pDataElement); 42 /*! @brief The interface function to append the data on the formated stream*/ 43 typedef int32_t (DATA_FORMAT_Append_t)) (void * pData, uint32_t size, void* pDataElement)); 44 45 /* @brief This defines the function pointers for the data format interface. 46 */ 47 typedef struct _data_format_interface_ 48 { 49 DATA_FORMAT_Init_t *Init; /*!< Pointer to the data-format Initialize() function. */ 50 DATA_FORMAT_Serialize_t *Serialize; /*!< Pointer to the data-format Serialize() function. */ 51 DATA_FORMAT_Deserialize_t *Deserialize; /*!< Pointer to the data-format Deserialize() function. */ 52 DATA_FORMAT_Append_t *Append; /*!< Pointer to the data-format Append() function. */ 53 } data_format_interface_t; 54 #endif // DATA_FORMAT_SERVICE_H_ 55