1 /*------------------------------------------------------------------------------------------------*/
2 /* UNICENS V2.1.0-3491 */
3 /* Copyright (c) 2017 Microchip Technology Germany II GmbH & Co. KG. */
5 /* This program is free software: you can redistribute it and/or modify */
6 /* it under the terms of the GNU General Public License as published by */
7 /* the Free Software Foundation, either version 2 of the License, or */
8 /* (at your option) any later version. */
10 /* This program is distributed in the hope that it will be useful, */
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
13 /* GNU General Public License for more details. */
15 /* You should have received a copy of the GNU General Public License */
16 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 /* You may also obtain this software under a propriety license from Microchip. */
19 /* Please contact Microchip for further information. */
20 /*------------------------------------------------------------------------------------------------*/
24 * \brief Header file of the Command Interpreter.
32 #include "ucs_ams_pb.h"
41 /*------------------------------------------------------------------------------------------------*/
43 /*------------------------------------------------------------------------------------------------*/
44 /*! \brief Denotes the end of an MessageId Table
45 * \ingroup G_UCS_CMD_TYPES
47 #define UCS_CMD_MSGID_TERMINATION 0xFFFFU
51 /*------------------------------------------------------------------------------------------------*/
53 /*------------------------------------------------------------------------------------------------*/
54 /*! \brief Result codes used for Command Interpreter API functions
55 * \ingroup G_UCS_CMD_TYPES
57 typedef enum Ucs_Cmd_Return_
59 UCS_CMD_RET_SUCCESS = 0x00, /*!< Operation successfully completed */
60 UCS_CMD_RET_ERR_MSGID_NOTAVAIL = 0x01, /*!< MessageId not found */
61 UCS_CMD_RET_ERR_TX_BUSY = 0x02, /*!< No free Tx buffer available */
62 UCS_CMD_RET_ERR_APPL = 0x03, /*!< Application handler function reports custom error */
63 UCS_CMD_RET_ERR_ALREADY_ENTERED = 0x04, /*!< MessageId Table already connected */
64 UCS_CMD_RET_ERR_NULL_PTR = 0x05 /*!< NULL pointer used as argument */
67 /*------------------------------------------------------------------------------------------------*/
69 /*------------------------------------------------------------------------------------------------*/
70 /*! \brief Type definition of user handler functions
71 * \param msg_rx_ptr Reference to the received message
72 * \param user_ptr User reference provided in \ref Ucs_InitData_t "Ucs_InitData_t::user_ptr"
73 * \return Possible return values are shown in the table below.
75 * ------------------------------- | ------------------------------------
76 * UCS_CMD_RET_SUCCESS | The handler function succeeded.
77 * UCS_CMD_RET_ERR_TX_BUSY | The handler function could not send an answer because no free Tx Buffer was available.
78 * UCS_CMD_RET_ERR_APPL | An error happened in handler function.
79 * \note The application must not return other values than the ones listed above.
80 * \ingroup G_UCS_CMD_TYPES
82 typedef Ucs_Cmd_Return_t (*Ucs_Cmd_Handler_Function_t)(Ucs_AmsRx_Msg_t *msg_rx_ptr, void *user_ptr);
86 /*------------------------------------------------------------------------------------------------*/
88 /*------------------------------------------------------------------------------------------------*/
90 /*! \brief Structure of a single element of the MessageId Table
91 * \details The application provides a MessageId Table which contains all supported MessageIds
92 * with their belonging handler functions. The MessageId Table is an array of several
93 * Ucs_Cmd_MsgId_t elements. It has to end with a termination entry with the
94 * value {\ref UCS_CMD_MSGID_TERMINATION, NULL}.
95 * \ingroup G_UCS_CMD_TYPES
97 typedef struct Ucs_Cmd_MsgId_
99 /*! \brief MessageId */
101 /*! \brief Pointer to the belonging handler function */
102 Ucs_Cmd_Handler_Function_t handler_function_ptr;
109 /*------------------------------------------------------------------------------------------------*/
111 /*------------------------------------------------------------------------------------------------*/
119 #endif /* UCS_CMD_PB_H */
121 /*------------------------------------------------------------------------------------------------*/
123 /*------------------------------------------------------------------------------------------------*/