Use latest version of conf.d/templates submodule.
[apps/agl-service-unicens.git] / ucs2-lib / inc / ucs_attach.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 Declaration of CAttachService class
25  *
26  * \cond UCS_INTERNAL_DOC
27  * \addtogroup  G_ATS
28  * @{
29  */
30
31 #ifndef UCS_ATTACH_H
32 #define UCS_ATTACH_H
33
34 /*------------------------------------------------------------------------------------------------*/
35 /* Includes                                                                                       */
36 /*------------------------------------------------------------------------------------------------*/
37 #include "ucs_obs.h"
38 #include "ucs_fsm.h"
39 #include "ucs_base.h"
40 #include "ucs_pmfifos.h"
41 #include "ucs_pmevent.h"
42 #include "ucs_inic.h"
43 #include "ucs_ret_pb.h"
44
45 #ifdef __cplusplus
46 extern "C"
47 {
48 #endif
49
50 /*------------------------------------------------------------------------------------------------*/
51 /* Structures                                                                                     */
52 /*------------------------------------------------------------------------------------------------*/
53 /*! \brief  Initialization structure of the attach service. */
54 typedef struct Ats_InitData_
55 {
56     CBase *base_ptr;                    /*!< \brief Reference to UCS base instance */
57     CPmFifos *fifos_ptr;                /*!< \brief Reference to PMS FIFOs */
58     CPmEventHandler *pme_ptr;           /*!< \brief Reference to PMS Event Handler */
59     CInic *inic_ptr;                    /*!< \brief Reference to INIC Management instance */
60
61 } Ats_InitData_t;
62
63 /*! \brief   Class structure of the attach service. */
64 typedef struct CAttachService_
65 {
66     Ats_InitData_t init_data;               /*!< \brief Objects required for attach process */
67     CFsm fsm;                               /*!< \brief Attach state machine */
68     CService ats_srv;                       /*!< \brief Service instance for the scheduler */
69     CObserver obs;                          /*!< \brief Observer used for asynchronous events */
70     CObserver obs2;                         /*!< \brief Observer used for asynchronous events */
71     CSingleObserver sobs;                   /*!< \brief Single-observer used for asynchronous
72                                                         results */
73     CMaskedObserver internal_error_obs;     /*!< \brief Error observer to handle INIC errors
74                                                         during the attach process */
75     CTimer timer;                           /*!< \brief Timer to check for init timeout */ 
76     CSingleSubject ats_result_subject;      /*!< \brief Subject to report the result of the
77                                                         attach process */
78     Ucs_InitResult_t report_result;         /*!< \brief Internal result/error code memory */
79
80 } CAttachService;
81
82 /*------------------------------------------------------------------------------------------------*/
83 /* Prototypes of class CAttach                                                                    */
84 /*------------------------------------------------------------------------------------------------*/
85 extern void Ats_Ctor(CAttachService *self, Ats_InitData_t *init_ptr);
86 extern void Ats_Start(void *self, CSingleObserver *obs_ptr);
87
88 #ifdef __cplusplus
89 }   /* extern "C" */
90 #endif
91
92 #endif /* #ifndef UCS_ATTACH_H */
93
94 /*!
95  * @}
96  * \endcond
97  */
98
99 /*------------------------------------------------------------------------------------------------*/
100 /* End of file                                                                                    */
101 /*------------------------------------------------------------------------------------------------*/
102