The UNICENS API provides functions that are used to startup and to shutdown the network. It also provides callback functions to observe MOST network parameters.
For starting up the MOST network out of the off state, function Ucs_Network_Startup() must be called. An optional callback function can be used, to monitor the result of the startup command. The callback must adhere to function signature Ucs_StdResultCb_t. In the following example, the result callback is not used.
For shutting down the MOST network, function Ucs_Network_Shutdown() must be called. It also provides an optional callback function to monitor the result of the shutdown command. The callback must adhere to function signature Ucs_StdResultCb_t. The following example uses Ucs_Network_Shutdown() in combination with the optional result callback.
The UNICENS API provides further information about the Network Status. For this purpose the application has the possibility to register the following callback function during initialization time.
Callback function net.cb_fptr()
reports information about the Network Status. The function must adhere to signature Ucs_Network_StatusCb_t. The following parameters are reported.
If at least one of the Network Status parameters has been changed, this function is invoked. The first argument of the function is a bitmask. This mask indicates which parameters have been changed since the last function call. If a bit is set the corresponding parameter has been changed since the last update. A simple example implementation is shown below.
Furthermore, it is possible to configure the notifications for Network Status. When initializing the corresponding callback function pointer, the user has the possibility to specify a notification bitmask. This mask indicates for which parameters the notification shall be enabled. If such a bit is set and the corresponding parameter has been changed the notification callback function is invoked.
This is an optional parameter. If the mask is not modified, notifications for all of the parameters are enabled.
The following example shows the usage of the notification bitmask.
See also API Reference, section Ucs_Network_Status_t. |