1 /*------------------------------------------------------------------------------------------------*/
2 /* UNICENS V2.1.0-3491 */
3 /* Copyright (c) 2017 Microchip Technology Germany II GmbH & Co. KG. */
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. */
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. */
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/>. */
18 /* You may also obtain this software under a propriety license from Microchip. */
19 /* Please contact Microchip for further information. */
20 /*------------------------------------------------------------------------------------------------*/
24 * \brief Internal header file of the Network Management.
26 * \cond UCS_INTERNAL_DOC
34 /*------------------------------------------------------------------------------------------------*/
36 /*------------------------------------------------------------------------------------------------*/
39 #include "ucs_ret_pb.h"
48 /*------------------------------------------------------------------------------------------------*/
50 /*------------------------------------------------------------------------------------------------*/
51 /*! \brief Result codes of function Net_IsOwnAddress() */
52 typedef enum Net_IsOwnAddrResult_
54 NET_IS_OWN_ADDR_NODE, /*!< \brief Is own node position address or own logical node address */
55 NET_IS_OWN_ADDR_GROUP, /*!< \brief Is own group address */
56 NET_IS_OWN_ADDR_NONE /*!< \brief Is foreign address */
58 } Net_IsOwnAddrResult_t;
60 /*------------------------------------------------------------------------------------------------*/
62 /*------------------------------------------------------------------------------------------------*/
63 /*! \brief Initialization structure of the attach service. */
64 typedef struct Net_InitData_
66 CBase *base_ptr; /*!< \brief Reference to base instance */
67 CInic *inic_ptr; /*!< \brief Reference to INIC instance */
71 /*! \brief Parameter structure for MOST Network Status */
72 typedef struct Net_NetworkStatusParam_
74 /*! \brief Indicates if parameters have been changed since last update */
76 /*! \brief Indicates if the MOST network is available and ready for control/packet
78 Ucs_Network_Availability_t availability;
79 /*! \brief Indicates the sub state to parameter Availability */
80 Ucs_Network_AvailInfo_t avail_info;
81 /*! \brief Indicates the transition cause of the MOST network going from Available to
82 NotAvailable or vice versa */
83 Ucs_Network_AvailTransCause_t avail_trans_cause;
84 /*! \brief Contains events relating to the functionality for the MOST Network Interface */
86 /*! \brief Current size of packet bandwidth */
88 /*! \brief Current node address of the device */
89 uint16_t node_address;
90 /*! \brief Node position of the device */
91 uint8_t node_position;
92 /*! \brief Node position of last device in the ring */
95 } Net_NetworkStatusParam_t;
97 /*! \brief Structure holds the parameters of property INIC.MOSTNetworkStatus */
98 typedef struct Net_NetworkStatus_
100 /*! \brief Parameters of MOST Network Status */
101 Net_NetworkStatusParam_t param;
102 /*! \brief Observe MOST Network status in INIC module */
104 /*! \brief Subject to notify MOST Network Status the first time a observer has been added */
105 CSubject pre_subject;
106 /*! \brief Subject to notify MOST Network Status */
109 } Net_NetworkStatus_t;
111 /*! \brief Parameter structure for MOST Network Configuration */
112 typedef struct Net_NetworkConfigParam_
114 /*! \brief Indicates if parameters have been changed since last update */
115 uint16_t change_mask;
116 /*! \brief Current node address of the device */
117 uint16_t node_address;
118 /*! \brief Current group address of the device */
119 uint16_t group_address;
120 /*! \brief Low-level retry block count */
123 } Net_NetworkConfigParam_t;
125 /*! \brief Structure holds the parameters of property INIC.MOSTNetworkConfiguration */
126 typedef struct Net_NetworkConfiguration_
128 /*! \brief Parameters of MOST Network Configuration */
129 Net_NetworkConfigParam_t param;
130 /*! \brief Observe MOST Network Configuration in INIC module */
132 /*! \brief Subject to notify MOST Network Configuration the first time a observer has been added */
133 CSubject pre_subject;
134 /*! \brief Subject to notify MOST Network Configuration */
137 } Net_NetworkConfiguration_t;
139 /*! \brief Class structure of the Network Management. */
140 typedef struct CNetworkManagement_
142 /*! \brief Parameters of property INIC.MOSTNetworkStatus */
143 Net_NetworkStatus_t network_status;
144 /*! \brief Parameters of property INIC.MOSTNetworkConfig. */
145 Net_NetworkConfiguration_t network_configuration;
146 /*! \brief Reference to INIC instance */
148 /*! \brief Reference to base instance */
150 /*! \brief Service instance for the scheduler */
153 } CNetworkManagement;
155 /*------------------------------------------------------------------------------------------------*/
156 /* Prototypes of class CNetworkManagement */
157 /*------------------------------------------------------------------------------------------------*/
158 extern void Net_Ctor(CNetworkManagement *self, Net_InitData_t *init_ptr);
159 extern void Net_AddObserverNetworkStatus(CNetworkManagement *self, CMaskedObserver *obs_ptr);
160 extern void Net_DelObserverNetworkStatus(CNetworkManagement *self, CMaskedObserver *obs_ptr);
161 extern void Net_AddObserverNetworkConfig(CNetworkManagement *self, CMaskedObserver *obs_ptr);
162 extern void Net_DelObserverNetworkConfig(CNetworkManagement *self, CMaskedObserver *obs_ptr);
163 extern Net_IsOwnAddrResult_t Net_IsOwnAddress(CNetworkManagement *self, uint16_t address);
169 #endif /* #ifndef UCS_NET_H */
176 /*------------------------------------------------------------------------------------------------*/
178 /*------------------------------------------------------------------------------------------------*/