aboutsummaryrefslogtreecommitdiffstats
path: root/ucs2-lib/inc/ucs_rtm.h
blob: 2fbccfdceb6de825a0bdd9307779da844bbc5ce9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*------------------------------------------------------------------------------------------------*/
/* UNICENS V2.1.0-3491                                                                            */
/* Copyright (c) 2017 Microchip Technology Germany II GmbH & Co. KG.                              */
/*                                                                                                */
/* This program is free software: you can redistribute it and/or modify                           */
/* it under the terms of the GNU General Public License as published by                           */
/* the Free Software Foundation, either version 2 of the License, or                              */
/* (at your option) any later version.                                                            */
/*                                                                                                */
/* This program is distributed in the hope that it will be useful,                                */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of                                 */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                  */
/* GNU General Public License for more details.                                                   */
/*                                                                                                */
/* You should have received a copy of the GNU General Public License                              */
/* along with this program.  If not, see <http://www.gnu.org/licenses/>.                          */
/*                                                                                                */
/* You may also obtain this software under a propriety license from Microchip.                    */
/* Please contact Microchip for further information.                                              */
/*------------------------------------------------------------------------------------------------*/

/*!
 * \file
 * \brief Internal header file of the Route Manager.
 *
 * \cond UCS_INTERNAL_DOC
 * \addtogroup G_RTM
 * @{
 */

#ifndef UCS_RTM_H
#define UCS_RTM_H

/*------------------------------------------------------------------------------------------------*/
/* Includes                                                                                       */
/*------------------------------------------------------------------------------------------------*/
#include "ucs_base.h"
#include "ucs_ret_pb.h"
#include "ucs_obs.h"
#include "ucs_epm.h"
#include "ucs_net.h"

#ifdef __cplusplus
extern "C"
{
#endif

/*------------------------------------------------------------------------------------------------*/
/* Structures                                                                                     */
/*------------------------------------------------------------------------------------------------*/
/*! \brief  Stores data required by RTM during initialization. */
typedef struct Rtm_InitData_
{
    CBase *base_ptr;                /*!< \brief Reference to base instance */
    CEndpointManagement *epm_ptr;   /*!< \brief Reference to the endpoint management instance */
    CNetworkManagement *net_ptr;    /*!< \brief Reference to Network instance */
    Ucs_Rm_ReportCb_t report_fptr;  /*!< \brief Reference to the report callback function */

} Rtm_InitData_t;

/*! \brief  Class structure of the Route Management. */
typedef struct CRouteManagement_
{
    /*! \brief Reference to a base instance */
    CBase *base_ptr;
    /*! \brief Reference to a network instance */
    CEndpointManagement * epm_ptr;
    /*!< \brief Reference to the timer management */ 
    CTimerManagement * tm_ptr;
    /*!< \brief Reference to Network instance */
    CNetworkManagement *net_ptr;
    /*!< \brief Timer for checking routes process */
    CTimer route_check;
    /*!< \brief Reference to the routes list */
    Ucs_Rm_Route_t * routes_list_ptr;
    /*! \brief Points to the current routes to be handled */
    Ucs_Rm_Route_t * curr_route_ptr;
    /*! \brief Current route index */
    uint16_t curr_route_index;
    /*! \brief Size of the current routes list */
    uint16_t routes_list_size;
    /*! \brief Service instance for the scheduler */
    CService rtm_srv;
    /*! \brief Report callback of the routes list */
    Ucs_Rm_ReportCb_t report_fptr;
    /*! \brief Observe MOST Network status in Net module */
    CMaskedObserver nwstatus_observer;
    /*! \brief Observer used to monitor UCS initialization result */
    CMaskedObserver ucsinit_observer;
    /*! \brief Observer used to monitor UCS termination event */
    CMaskedObserver ucstermination_observer;
    /*! \brief Specifies used to monitor UCS termination event */
    bool ucs_is_stopping;
    /*! \brief specifies whether the network status is available or not */
    bool nw_available;
    /*! \brief Flag to lock the API */
    bool lock_api;

} CRouteManagement;

/*------------------------------------------------------------------------------------------------*/
/* Prototypes of class CRouteManagement                                                           */
/*------------------------------------------------------------------------------------------------*/
extern void Rtm_Ctor(CRouteManagement * self, Rtm_InitData_t * init_ptr);
extern Ucs_Return_t Rtm_StartProcess(CRouteManagement * self,  Ucs_Rm_Route_t routes_list[], uint16_t size);
extern Ucs_Return_t Rtm_DeactivateRoute(CRouteManagement * self, Ucs_Rm_Route_t * route_ptr);
extern Ucs_Return_t Rtm_ActivateRoute(CRouteManagement * self, Ucs_Rm_Route_t * route_ptr);
extern Ucs_Return_t Rtm_SetNodeAvailable(CRouteManagement * self, Ucs_Rm_Node_t *node_ptr, bool available);
extern bool Rtm_GetNodeAvailable(CRouteManagement * self, Ucs_Rm_Node_t *node_ptr);
extern Ucs_Return_t Rtm_GetAttachedRoutes(CRouteManagement * self, Ucs_Rm_EndPoint_t * ep_inst, Ucs_Rm_Route_t * ext_routes_list[], uint16_t size_list);
extern uint16_t Rtm_GetConnectionLabel(CRouteManagement * self, Ucs_Rm_Route_t * route_ptr);

#ifdef __cplusplus
}   /* extern "C" */
#endif

#endif /* #ifndef UCS_RTM_H */

/*!
 * @}
 * \endcond
 */

/*------------------------------------------------------------------------------------------------*/
/* End of file                                                                                    */
/*------------------------------------------------------------------------------------------------*/