Data Structures | |
| struct | EnmsService |
| struct | EnmsIndicationPolicy |
| struct | EnmsNode |
| #define ENMS_NODE_MAX_SERVICES 10 |
Maximum number of services that can be registered.
| #define ENMS_DEFAULT_PORT UINT16_C(0xf0b1) |
Default UDP port number for the ENMS service.
| enum EnmsNodeResult |
Possible ENMS Node function results.
| EnmsNodeResult ENMS_NODE_Init | ( | EnmsNode * | enmsNode, |
| uint16_t | port, | ||
| const uint8_t | hwId[16], | ||
| const EnmsIndicationPolicy * | indicationPolicy | ||
| ) |
Initializes the ENMS Node service.
This function initializes the ENMS Node service. It registers a UDP socket for communication with the ENMS BR service running typically in the border router. It also creates a task that is responsible for periodic sending of ENSM-BASIC-INFO messages.
| [in] | enmsNode | ENMS Node service instance |
| [in] | port | UDP port number over which the service will communicate, provide 0 to use default port value 0xF0B1 |
| [in] | hwId | hardware identifier |
| [in] | indicationPolicy | indication policy defining when and how often the indications should be sent (NULL to use default policy) |
| ENMS_NODE_RESULT_OK | if the service was initialized successfully |
| ENMS_NODE_RESULT_INVALID_INPUT_ARGUMENT | if at least one of the input arguments was invalid |
| ENMS_NODE_RESULT_FAILED_TO_REGISTER_UDP_SOCKET | if the service failed to register a UDP socket |
| ENMS_NODE_RESULT_FAILED_TO_CREATE_TASK | if the service failed to create a task |
| EnmsNodeResult ENMS_NODE_Deinit | ( | EnmsNode * | enmsNode | ) |
Deinitializes the ENMS Node service
| [in] | enmsNode | ENMS Node service instance |
| ENMS_NODE_RESULT_OK | if the service was deinitialized successfully |
| ENMS_NODE_RESULT_INVALID_INPUT_ARGUMENT | if at least one of the input arguments was invalid |
| EnmsNodeResult ENMS_NODE_Start | ( | EnmsNode * | enmsNode | ) |
Starts the ENMS Node service.
This function starts the ENMS Node service. It is typically called in reaction to the event that the node has joined a network. It schedules a task that periodically sends ENSM-BASIC-INFO messages.
| [in] | enmsNode | ENMS Node service instance |
| ENMS_NODE_RESULT_OK | if the service was started successfully |
| ENMS_NODE_RESULT_INVALID_INPUT_ARGUMENT | if at least one of the input arguments was invalid |
| ENMS_NODE_RESULT_FAILED_TO_RUN_TASK | if the service was unable to run a task |
| EnmsNodeResult ENMS_NODE_Stop | ( | EnmsNode * | enmsNode | ) |
Stops the ENMS Node service.
This function stops the ENMS Node service. It is typically called in reaction to the event that the node has left a network. The service can be restarted by a call to ENMS_NODE_Start.
| [in] | enmsNode | ENMS Node service instance |
| ENMS_NODE_RESULT_OK | if the service was stopped successfully |
| ENMS_NODE_RESULT_INVALID_INPUT_ARGUMENT | if at least one of the input arguments was invalid |
| EnmsNodeResult ENMS_NODE_RegisterService | ( | EnmsNode * | enmsNode, |
| const char * | serviceName, | ||
| uint8_t | serviceState | ||
| ) |
Registers a service.
This function is used to tell the ENSM NODE service that other service runs in the node. Each service is described by:
| ENMS_NODE_RESULT_OK | if the service was registered |
| ENMS_NODE_RESULT_INVALID_INPUT_ARGUMENT | if at least one of the input arguments was invalid |
| ENMS_NODE_RESULT_FAILED_TO_REGISTER_SERVICE | if the service was not registered (probably exceeded the number of services that can be handled - see ENMS_NODE_MAX_SERVICES) |
| EnmsNodeResult ENMS_NODE_SetServiceState | ( | EnmsNode * | enmsNode, |
| const char * | serviceName, | ||
| uint8_t | serviceState | ||
| ) |
Sets service state.
This function is used to update the state of a service, previously registered by a call to ENMS_NODE_RegisterService.
| ENMS_NODE_RESULT_OK | if the service state was updated |
| ENMS_NODE_RESULT_INVALID_INPUT_ARGUMENT | if at least one of the input arguments was invalid |
Any question or remarks? Just write us a message!
Feel free to get in touch