Initial Commit
[apps/agl-service-unicens.git] / ucs2-lib / inc / ucs_rsm_pv.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 Extended Resource Manager.
25  * \cond UCS_INTERNAL_DOC
26  * \addtogroup G_RSM
27  * @{
28  */
29
30 #ifndef UCS_RSM_PB_H
31 #define UCS_RSM_PB_H
32
33 /*------------------------------------------------------------------------------------------------*/
34 /* Includes                                                                                       */
35 /*------------------------------------------------------------------------------------------------*/
36 #include "ucs_message_pb.h"
37
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif
42
43 /*------------------------------------------------------------------------------------------------*/
44 /* Enumerators                                                                                    */
45 /*------------------------------------------------------------------------------------------------*/
46 /*! \brief SyncLost Causes 
47  *  \ingroup G_UCS_RSM_TYPES
48  */
49 typedef enum Rsm_SyncLostCause_
50 {
51     RSM_SLC_NWSHUTDOWN,    /*!< \brief "Network Shutdown" causes the SyncLost */
52     RSM_SLC_CFGNOTOK,      /*!< \brief "Config Not Ok" causes the SyncLost */
53     RSM_SLC_SYSMODIF       /*!< \brief "System Changes like own node address or MPR changes" cause the SyncLost */
54
55 } Rsm_SyncLostCause_t;
56
57 /*! \brief  RSM Sync states 
58  *  \ingroup G_UCS_RSM_TYPES
59  */
60 typedef enum Rsm_DevSyncState_
61 {
62     RSM_DEV_UNSYNCED,  /*!< \brief RSM device is "Unsynced", i.e. not in remote control mode */
63     RSM_DEV_SYNCING,   /*!< \brief RSM device is "Synching" */
64     RSM_DEV_SYNCED     /*!< \brief RSM device is "Synced", i.e. in remote control mode */
65
66 } Rsm_DevSyncState_t;
67
68 /*! \brief Result codes of the Extended Resource Manager. 
69  *  \ingroup G_UCS_RSM_TYPES
70  */
71 typedef enum Rsm_ResultCode_
72 {
73     RSM_RES_SUCCESS,          /*!< \brief Device Sync succeeded */
74     RSM_RES_ERR_SYNC          /*!< \brief Device Sync failed because of not Remote Control Mode */
75
76 } Rsm_ResultCode_t;
77
78 /*------------------------------------------------------------------------------------------------*/
79 /* Structures                                                                                     */
80 /*------------------------------------------------------------------------------------------------*/
81 /*! \brief Detailed information used for Extended Resource Manager results. */
82 typedef struct Rsm_ResultDetails_
83 {
84     /*! \brief Holds the status of the transmission. */
85     Ucs_MsgTxStatus_t tx_result;
86     /*! \brief Holds the results of the target device. */
87     Ucs_StdResult_t inic_result;
88
89 } Rsm_ResultDetails_t;
90
91 /*! \brief Result structure of the Extended Resource Manager. */
92 typedef struct Rsm_Result_
93 {
94     /*! \brief Result code. */
95     Rsm_ResultCode_t code;
96     /*! \brief Detailed information on the returned result. */
97     Rsm_ResultDetails_t details;
98
99 } Rsm_Result_t;
100
101 /*------------------------------------------------------------------------------------------------*/
102 /* Type definitions                                                                               */
103 /*------------------------------------------------------------------------------------------------*/
104 /*! \brief  Callback function type to retrieve a RSM result 
105  *  \param  self          The instance (optional)
106  *  \param  result        The result message object
107  *  \ingroup G_UCS_RSM_TYPES
108  */
109 typedef void (*Rsm_ResultCb_t)(void * self, Rsm_Result_t result);
110
111 /*!
112  * @}
113  * \endcond
114  */
115
116 /*!
117  *  \def     UCS_NUM_REMOTE_DEVICES
118  *  \brief   Customer assignment for number of remote devices required by Resources Management modules.
119  *  \details If the macro is not defined, the UNICENS library will use a default value of 0. The user 
120  *           can overwrite this default value by defining the macro. Valid values are in the range 
121  *           from 0 to 63. 
122   *  \ingroup G_UCS_XRM_CFG
123  */ 
124 #ifndef UCS_NUM_REMOTE_DEVICES
125 #    define UCS_NUM_REMOTE_DEVICES   0U
126 #endif
127
128 /*! \def UCS_ADDR_LOCAL_DEV
129  *  \brief      Defines the address of the local device.
130  *  \details    This macro is used to define the address of the local device. It should be used by 
131  *              the application to trigger jobs on the local device. 
132  *  \ingroup    G_UCS_IRM
133  */
134 #define UCS_ADDR_LOCAL_DEV    0x0001U
135
136 #ifdef __cplusplus
137 }   /* extern "C" */
138 #endif
139
140 #endif  /* #ifndef UCS_RSM_PB_H */
141
142 /*------------------------------------------------------------------------------------------------*/
143 /* End of file                                                                                    */
144 /*------------------------------------------------------------------------------------------------*/
145