Merge pull request #2 from ronan22/master
[apps/agl-service-unicens.git] / ucs2-lib / inc / ucs_nodeobserver.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 Internal header file of the CNodeObserver class
25  *
26  * \cond UCS_INTERNAL_DOC
27  * \addtogroup G_NODEOBSERVER
28  * @{
29  */
30
31 #ifndef UCS_NODEOBSERVER_H
32 #define UCS_NODEOBSERVER_H
33
34 /*------------------------------------------------------------------------------------------------*/
35 /* Includes                                                                                       */
36 /*------------------------------------------------------------------------------------------------*/
37 #include "ucs_base.h"
38 #include "ucs_nodedis.h"
39 #include "ucs_rtm.h"
40 #include "ucs_nodeobserver_pb.h"
41
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46
47 /*------------------------------------------------------------------------------------------------*/
48 /* Internal constants                                                                             */
49 /*------------------------------------------------------------------------------------------------*/
50
51 /*------------------------------------------------------------------------------------------------*/
52 /* Types                                                                                          */
53 /*------------------------------------------------------------------------------------------------*/
54
55
56 /*------------------------------------------------------------------------------------------------*/
57 /* Class                                                                                          */
58 /*------------------------------------------------------------------------------------------------*/
59
60 /*! \brief      CNodeObserver Class
61  *  \details    Implements the NodeObserver
62  */
63 typedef struct CNodeObserver_
64 {
65     CBase               *base_ptr;              /*!< \brief Reference to base services */
66     CNodeDiscovery      *nd_ptr;                /*!< \brief Reference to node discovery */
67     CRouteManagement    *rtm_ptr;               /*!< \brief Reference to route management */
68     Ucs_Mgr_InitData_t   init_data;             /*!< \brief Initialization data describing nodes and routes*/
69     CMaskedObserver      event_observer;        /*!< \brief Observes init complete event */
70
71     Ucs_Signature_t      eval_signature;
72     Ucs_Nd_CheckResult_t eval_action;
73     Ucs_Rm_Node_t       *eval_node_ptr;
74     CTimer               wakeup_timer;          /*!< \brief Timer wakes up processing, sets current 
75                                                  *          node available and restarts NodeDiscovery
76                                                  */
77
78 } CNodeObserver;
79
80 /*------------------------------------------------------------------------------------------------*/
81 /* Methods                                                                                        */
82 /*------------------------------------------------------------------------------------------------*/
83 extern void Nobs_Ctor(CNodeObserver *self, CBase *base_ptr, CNodeDiscovery *nd_ptr, CRouteManagement *rtm_ptr, Ucs_Mgr_InitData_t *init_ptr);
84 extern Ucs_Nd_CheckResult_t Nobs_OnNdEvaluate(void *self, Ucs_Signature_t *signature_ptr);
85 extern void Nobs_OnNdReport(void *self, Ucs_Nd_ResCode_t code, Ucs_Signature_t *signature_ptr);
86
87 #ifdef __cplusplus
88 }               /* extern "C" */
89 #endif
90
91 #endif          /* UCS_NODEOBSERVER_H */
92
93 /*!
94  * @}
95  * \endcond
96  */
97
98 /*------------------------------------------------------------------------------------------------*/
99 /* End of file                                                                                    */
100 /*------------------------------------------------------------------------------------------------*/
101