Initial Commit
[apps/agl-service-unicens.git] / ucs2-lib / inc / ucs_nsm_pb.h
1 /*------------------------------------------------------------------------------------------------*/
2 /* UNICENS V2.1.0-3491                                                                            */
3 /* Copyright (c) 2017 Microchip Technology Germany II GmbH & Co. KG.                              */
4 /*                                                                                                */
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.                                                            */
9 /*                                                                                                */
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.                                                   */
14 /*                                                                                                */
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/>.                          */
17 /*                                                                                                */
18 /* You may also obtain this software under a propriety license from Microchip.                    */
19 /* Please contact Microchip for further information.                                              */
20 /*------------------------------------------------------------------------------------------------*/
21
22 /*!
23  * \file
24  * \brief Public header file of the Node Script Management.
25  */
26
27 #ifndef UCS_NSM_PB_H
28 #define UCS_NSM_PB_H
29
30 /*------------------------------------------------------------------------------------------------*/
31 /* Includes                                                                                       */
32 /*------------------------------------------------------------------------------------------------*/
33 #include "ucs_rules.h"
34 #include "ucs_rm_pv.h"
35
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40
41 /*------------------------------------------------------------------------------------------------*/
42 /* Enumerators                                                                                    */
43 /*------------------------------------------------------------------------------------------------*/
44 /*! \brief Result codes of the Node Script Management. 
45  *  \ingroup G_UCS_SCRIPTING
46  */
47 typedef enum Ucs_Ns_ResultCode_
48 {
49     UCS_NS_RES_SUCCESS     = 0x00U,     /*!< \brief Transmission of script(s) was successful. */
50     UCS_NS_RES_ERROR       = 0x01U      /*!< \brief Transmission of script(s) failed. */
51
52 } Ucs_Ns_ResultCode_t;
53
54 /*------------------------------------------------------------------------------------------------*/
55 /* Structures                                                                                     */
56 /*------------------------------------------------------------------------------------------------*/
57 /*! \brief Structure of a ConfigMsg used in Node-Script.
58  *  \ingroup G_UCS_SCRIPTING
59  */
60 typedef struct Ucs_Ns_ConfigMsg_
61 {
62     /*! \brief FBlockId of the config msg. */
63     uint8_t FBlockId;
64     /*! \brief InstId of the config msg. */
65     uint8_t InstId;
66     /*! \brief FunktId of the config msg. */
67     uint16_t FunktId;
68     /*! \brief OpCode of the config msg. */
69     uint8_t OpCode;
70     /*! \brief Data length. */
71     uint8_t DataLen;
72     /*! \brief Reference to the Data */
73     uint8_t * DataPtr;
74
75 } Ucs_Ns_ConfigMsg_t;
76
77 /*! \brief Structure of a node-script used to configure a remote node.
78  *  \attention The Node Scripting module is designed and intended for the use of \b I2C and \b GPIO commands only. That is, using the Scripting for any other FBlock INIC commands 
79  *  (for example MOST, MediaLB, USB, Streaming, Connections, etc.) is expressly \b prohibited.
80  *  \ingroup G_UCS_SCRIPTING
81  */
82 typedef struct Ucs_Ns_Script_
83 {
84     /*! \brief Specifies the pause which shall be set before sending
85      *         the configuration message. 
86      */
87     uint16_t pause;
88     /*! \brief Command to be transmitted. */
89     Ucs_Ns_ConfigMsg_t * send_cmd;
90     /*! \brief Expected result. */
91     Ucs_Ns_ConfigMsg_t * exp_result;
92
93 } Ucs_Ns_Script_t;
94
95 /*! \brief Configuration structure of a Node. 
96  *
97  *  \attention Use the \ref UCS_ADDR_LOCAL_DEV macro to address your local device when specifying routes to/from It.  
98  *             \n The following address ranges are supported:
99  *                 - [0x10  ... 0x2FF]
100  *                 - [0x500 ... 0xFEF]
101  *                 - UCS_ADDR_LOCAL_DEV
102  *  \ingroup G_UCS_ROUTING_TYPES
103  */
104 typedef struct Ucs_Rm_Node_
105 {
106     /*! \brief node signature. */
107     Ucs_Signature_t * signature_ptr;
108     /*! \brief Reference to a list of configuration scripts. */
109     Ucs_Ns_Script_t * script_list_ptr;
110     /*! \brief size of the scripts table. */
111     uint8_t script_list_size;
112     /*! \brief Internal information of this node object. */
113     Ucs_Rm_NodeInt_t internal_infos;
114
115 } Ucs_Rm_Node_t;
116
117 /*------------------------------------------------------------------------------------------------*/
118 /* Type definitions                                                                               */
119 /*------------------------------------------------------------------------------------------------*/
120 /*! \brief  Function signature used for the results of the Scripting Manager.
121  *  \param  node_ptr          Reference to the node instance
122  *  \param  result            Result of the scripting operation.
123  *  \param  ucs_user_ptr      User reference for API callback functions.
124  *  \ingroup G_UCS_SCRIPTING
125  */
126 typedef void (*Ucs_Ns_ResultCb_t)(Ucs_Rm_Node_t * node_ptr, Ucs_Ns_ResultCode_t result, void *ucs_user_ptr);
127
128 #ifdef __cplusplus
129 }   /* extern "C" */
130 #endif
131
132 #endif  /* #ifndef UCS_NSM_PB_H */
133 /*------------------------------------------------------------------------------------------------*/
134 /* End of file                                                                                    */
135 /*------------------------------------------------------------------------------------------------*/
136