Do not revert to non-volatile settings when changed by application. (#1586)

- Invalidate Active and Pending Datasets when configs are changed via APIs.
- Do not allow client to change network configurations while Thread is enabled.
This commit is contained in:
Jonathan Hui
2017-04-13 08:41:35 -07:00
committed by GitHub
parent b6e72560a9
commit 04d3032bab
6 changed files with 110 additions and 23 deletions
+19 -6
View File
@@ -164,11 +164,16 @@ OTAPI uint8_t OTCALL otLinkGetChannel(otInstance *aInstance);
/**
* Set the IEEE 802.15.4 channel
*
* This function will only succeed when Thread protocols are disabled. A successful
* call to this function will also invalidate the Active and Pending Operational Datasets in
* non-volatile memory.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aChannel The IEEE 802.15.4 channel.
*
* @retval kThreadErrorNone Successfully set the channel.
* @retval kThreadErrorInvalidArgs If @p aChnanel is not in the range [11, 26].
* @retval kThreadErrorNone Successfully set the channel.
* @retval kThreadErrorInvalidArgs If @p aChnanel is not in the range [11, 26].
* @retrval kThreadError_InvalidState Thread protocols are enabled.
*
* @sa otLinkGetChannel
*/
@@ -186,11 +191,14 @@ OTAPI const uint8_t *OTCALL otLinkGetExtendedAddress(otInstance *aInstance);
/**
* This function sets the IEEE 802.15.4 Extended Address.
*
* This function will only succeed when Thread protocols are disabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aExtendedAddress A pointer to the IEEE 802.15.4 Extended Address.
*
* @retval kThreadError_None Successfully set the IEEE 802.15.4 Extended Address.
* @retval kThreadError_InvalidArgs @p aExtendedAddress was NULL.
* @retval kThreadError_None Successfully set the IEEE 802.15.4 Extended Address.
* @retval kThreadError_InvalidArgs @p aExtendedAddress was NULL.
* @retval kThraedError_InvalidState Thread protocols are enabled.
*
*/
OTAPI ThreadError OTCALL otLinkSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExtendedAddress);
@@ -249,11 +257,16 @@ OTAPI otPanId OTCALL otLinkGetPanId(otInstance *aInstance);
/**
* Set the IEEE 802.15.4 PAN ID.
*
* This function will only succeed when Thread protocols are disabled. A successful
* call to this function will also invalidate the Active and Pending Operational Datasets in
* non-volatile memory.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aPanId The IEEE 802.15.4 PAN ID.
*
* @retval kThreadErrorNone Successfully set the PAN ID.
* @retval kThreadErrorInvalidArgs If aPanId is not in the range [0, 65534].
* @retval kThreadError_None Successfully set the PAN ID.
* @retval kThreadError_InvalidArgs If aPanId is not in the range [0, 65534].
* @retval kThreadError_InvalidState Thread protocols are enabled.
*
* @sa otLinkGetPanId
*/
+27 -5
View File
@@ -205,12 +205,19 @@ OTAPI const uint8_t *OTCALL otThreadGetExtendedPanId(otInstance *aInstance);
/**
* Set the IEEE 802.15.4 Extended PAN ID.
*
* This function may only be called while Thread protocols are disabled. A successful
* call to this function will also invalidate the Active and Pending Operational Datasets in
* non-volatile memory.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aExtendedPanId A pointer to the IEEE 802.15.4 Extended PAN ID.
*
* @retval kThreadError_None Successfully set the Extended PAN ID.
* @retval kThreadError_InvalidState Thread protocols are enabled.
*
* @sa otThreadGetExtendedPanId
*/
OTAPI void OTCALL otThreadSetExtendedPanId(otInstance *aInstance, const uint8_t *aExtendedPanId);
OTAPI ThreadError OTCALL otThreadSetExtendedPanId(otInstance *aInstance, const uint8_t *aExtendedPanId);
/**
* This function returns a pointer to the Leader's RLOC.
@@ -264,12 +271,17 @@ OTAPI const uint8_t *OTCALL otThreadGetMasterKey(otInstance *aInstance, uint8_t
/**
* Set the thrMasterKey.
*
* This function will only succeed when Thread protocols are disabled. A successful
* call to this function will also invalidate the Active and Pending Operational Datasets in
* non-volatile memory.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aKey A pointer to a buffer containing the thrMasterKey.
* @param[in] aKeyLength Number of bytes representing the thrMasterKey stored at aKey. Valid range is [0, 16].
*
* @retval kThreadErrorNone Successfully set the thrMasterKey.
* @retval kThreadErrorInvalidArgs If aKeyLength is larger than 16.
* @retval kThreadErrorNone Successfully set the thrMasterKey.
* @retval kThreadErrorInvalidArgs If aKeyLength is larger than 16.
* @retval kThreadError_InvalidState Thread protocols are enabled.
*
* @sa otThreadGetMasterKey
*/
@@ -298,10 +310,15 @@ OTAPI const uint8_t *OTCALL otThreadGetMeshLocalPrefix(otInstance *aInstance);
/**
* This function sets the Mesh Local Prefix.
*
* This function will only succeed when Thread protocols are disabled. A successful
* call to this function will also invalidate the Active and Pending Operational Datasets in
* non-volatile memory.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aMeshLocalPrefix A pointer to the Mesh Local Prefix.
*
* @retval kThreadError_None Successfully set the Mesh Local Prefix.
* @retval kThreadError_None Successfully set the Mesh Local Prefix.
* @retval kThreadError_InvalidState Thread protocols are enabled.
*
*/
OTAPI ThreadError OTCALL otThreadSetMeshLocalPrefix(otInstance *aInstance, const uint8_t *aMeshLocalPrefix);
@@ -320,10 +337,15 @@ OTAPI const char *OTCALL otThreadGetNetworkName(otInstance *aInstance);
/**
* Set the Thread Network Name.
*
* This function will only succeed when Thread protocols are disabled. A successful
* call to this function will also invalidate the Active and Pending Operational Datasets in
* non-volatile memory.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aNetworkName A pointer to the Thread Network Name.
*
* @retval kThreadErrorNone Successfully set the Thread Network Name.
* @retval kThreadErrorNone Successfully set the Thread Network Name.
* @retval kThreadError_InvalidState Thread protocols are enabled.
*
* @sa otThreadGetNetworkName
*/