mirror of
https://github.com/espressif/openthread.git
synced 2026-10-05 07:17:39 +00:00
Add notifications on configuration and state changes from OpenThread. (#146)
Example state changes that will cause a notification: - IPv6 address added/removed - Device state (offline, detached, attached) - Device role (disabled, detached, child, router, leader) - Partition ID - Key Sequence - Child added/removed
This commit is contained in:
@@ -206,6 +206,24 @@ typedef struct otLinkModeConfig
|
||||
uint8_t mNetworkData : 1;
|
||||
} otLinkModeConfig;
|
||||
|
||||
/**
|
||||
* This enumeration represents flags that indicate what configuration or state has changed within OpenThread.
|
||||
*
|
||||
*/
|
||||
enum
|
||||
{
|
||||
OT_IP6_ADDRESS_ADDED = 1 << 0, ///< IPv6 address was added
|
||||
OT_IP6_ADDRESS_REMOVED = 1 << 1, ///< IPv6 address was removed
|
||||
|
||||
OT_NET_STATE = 1 << 2, ///< Device state (offline, detached, attached) changed
|
||||
OT_NET_ROLE = 1 << 3, ///< Device role (disabled, detached, child, router, leader) changed
|
||||
OT_NET_PARTITION_ID = 1 << 4, ///< Partition ID changed
|
||||
OT_NET_KEY_SEQUENCE = 1 << 5, ///< Thread Key Sequence changed
|
||||
|
||||
OT_THREAD_CHILD_ADDED = 1 << 6, ///< Child was added
|
||||
OT_THREAD_CHILD_REMOVED = 1 << 7 ///< Child was removed
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -457,6 +457,24 @@ ThreadError otAddUnicastAddress(otNetifAddress *aAddress);
|
||||
*/
|
||||
ThreadError otRemoveUnicastAddress(otNetifAddress *aAddress);
|
||||
|
||||
/**
|
||||
* This function pointer is called to notify certain configuration or state changes within OpenThread.
|
||||
*
|
||||
* @param[in] aFlags A bit-field indicating specific state that has changed.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (*otStateChangedCallback)(uint32_t aFlags, void *aContext);
|
||||
|
||||
/**
|
||||
* This function registers a callback to indicate when certain configuration or state changes within OpenThread.
|
||||
*
|
||||
* @param[in] aCallback A pointer to a function that is called with certain configuration or state changes.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
void otSetStateChangedCallback(otStateChangedCallback aCallback, void *aContext);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user