The Network Supervisor is a central component of the UNICENS Management Library. It is responsible to run certain network procedures in a commonly defined way. The target is to reduce the complexity of an application by automatically handling the API and dependencies of different internal UNICENS and INIC functionalities.
The Network Supervisor has different Supervisor Modes, which describe a certain usage scenario during runtime. E.g., the Supervisor Normal Operation Mode defines the typical use case of a UNICENS application. It is responsible to startup the network, discovers and initializes remote nodes and triggers the routing management to build activated routes.
The following listing describes the available Supervisor Modes.
The Network Supervisor provides several parameters the application may set during initialization. The most important parameters are callback functions which are notifying about state changes and the so called network descriptor, which is the list of known nodes and routes in the network.
The network descriptor shall at least list the local node (root node). It is required for Normal Operation Mode as well as for Fallback Mode while you may use Inactive, Diagnosis and Programming Mode without a fully specified network descriptor.
During runtime the application can set the Network Supervisor to another operation mode by calling the function Ucs_Supv_SetMode(). An example is listed below.
The setting of Network Supervisor Modes is restricted to certain transitions which are shown in the picture below. As shown there is a special treatment of the Diagnosis Mode and Programming Mode. While both Supervisor Modes are active it is not possible to change the mode by calling Ucs_Supv_SetMode(). Both modes can be seen as processes that return to the Supervisor Inactive Mode after an error occurs or after successful termination.
During initialization the application can assign the supv.report_mode_fptr to receive notifications about the Supervisor Mode changes. This is important because of the following reasons:
The following example shows the reporting function printing the current Supervisor Mode and state.
The following table shows the meaning of the Network Supervisor state in the different Supervisor modes.
Mode | Meaning of BUSY | Meaning of READY |
---|---|---|
Inactive | The target network state "NotAvailable.Regular" is not reached. | The target network state "NotAvailable.Regular" is reached. |
Normal Operation | The target network state "Available" is not reached. | The target network state "Available" is not reached. |
Diagnosis | Performing initial checks. | The Supervisor Diagnosis mode is now running. |
Programming | Performing initial checks. | The Supervisor Programming mode is now running. |
Fallback | The target network state "NotAvailable.Fallback" is not reached. | The target network state "NotAvailable.Fallback" is not reached. |
Depending on the current Supervisor Mode the number of available API functions is restricted for the application. The API function will return UCS_RET_ERR_NOT_SUPPORTED in this case. The following table shows which API functions are restricted to certain Supervisor Modes. Only restricted functions are listed.
API Function | Inactive | Normal Operation | Diagnosis | Programming | Fallback |
---|---|---|---|---|---|
Ucs_Supv_SetMode() | yes | yes | - | - | yes |
Ucs_Supv_ProgramNode() | - | - | - | yes | - |
Ucs_Supv_ProgramExit() | - | - | - | yes | - |
Ucs_Rm_SetRouteActive() | yes | yes | - | - | yes |
Ucs_Rm_GetAtdValue() | - | yes | - | - | - |
Ucs_Xrm_Stream_SetPortConfig() | yes | yes | - | - | - |
Ucs_Xrm_Stream_GetPortConfig() | yes | yes | - | - | - |
Ucs_Network_GetFrameCounter() | - | yes | - | - | - |
Ucs_Network_GetNodesCount() | yes | yes | - | yes | - |
Ucs_AmsTx_AllocMsg() | yes | yes | - | - | - |
Ucs_AmsTx_SendMsg() | yes | yes | - | - | - |