This module includes functions for the Thread Commissioner role.
More...
|
otError | otCommissionerStart (otInstance *aInstance, otCommissionerStateCallback aStateCallback, otCommissionerJoinerCallback aJoinerCallback, void *aCallbackContext) |
|
otError | otCommissionerStop (otInstance *aInstance) |
|
otError | otCommissionerAddJoiner (otInstance *aInstance, const otExtAddress *aEui64, const char *aPskd, uint32_t aTimeout) |
|
otError | otCommissionerGetNextJoinerInfo (otInstance *aInstance, uint16_t *aIterator, otJoinerInfo *aJoiner) |
|
otError | otCommissionerRemoveJoiner (otInstance *aInstance, const otExtAddress *aEui64) |
|
const char * | otCommissionerGetProvisioningUrl (otInstance *aInstance) |
|
otError | otCommissionerSetProvisioningUrl (otInstance *aInstance, const char *aProvisioningUrl) |
|
otError | otCommissionerAnnounceBegin (otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, const otIp6Address *aAddress) |
|
otError | otCommissionerEnergyScan (otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, uint16_t aScanDuration, const otIp6Address *aAddress, otCommissionerEnergyReportCallback aCallback, void *aContext) |
|
otError | otCommissionerPanIdQuery (otInstance *aInstance, uint16_t aPanId, uint32_t aChannelMask, const otIp6Address *aAddress, otCommissionerPanIdConflictCallback aCallback, void *aContext) |
|
otError | otCommissionerSendMgmtGet (otInstance *aInstance, const uint8_t *aTlvs, uint8_t aLength) |
|
otError | otCommissionerSendMgmtSet (otInstance *aInstance, const otCommissioningDataset *aDataset, const uint8_t *aTlvs, uint8_t aLength) |
|
uint16_t | otCommissionerGetSessionId (otInstance *aInstance) |
|
otCommissionerState | otCommissionerGetState (otInstance *aInstance) |
|
This module includes functions for the Thread Commissioner role.
typedef void(* otCommissionerEnergyReportCallback)(uint32_t aChannelMask, const uint8_t *aEnergyList, uint8_t aEnergyListLength, void *aContext) |
This function pointer is called when the Commissioner receives an Energy Report.
- Parameters
-
[in] | aChannelMask | The channel mask value. |
[in] | aEnergyList | A pointer to the energy measurement list. |
[in] | aEnergyListLength | Number of entries in aEnergyListLength . |
[in] | aContext | A pointer to application-specific context. |
This function pointer is called whenever the joiner state changes.
- Parameters
-
[in] | aEvent | The joiner event type. |
[in] | aJoinerId | A pointer to the Joiner ID. |
[in] | aContext | A pointer to application-specific context. |
This enumeration defines a Joiner Event on the Commissioner.
typedef void(* otCommissionerPanIdConflictCallback)(uint16_t aPanId, uint32_t aChannelMask, void *aContext) |
This function pointer is called when the Commissioner receives a PAN ID Conflict message.
- Parameters
-
[in] | aPanId | The PAN ID value. |
[in] | aChannelMask | The channel mask value. |
[in] | aContext | A pointer to application-specific context. |
This enumeration defines the Commissioner State.
This function pointer is called whenever the commissioner state changes.
- Parameters
-
[in] | aChannelMask | The channel mask value. |
[in] | aEnergyList | A pointer to the energy measurement list. |
[in] | aEnergyListLength | Number of entries in aEnergyListLength . |
[in] | aContext | A pointer to application-specific context. |
This structure represents a Commissioning Dataset.
This structure represents a Joiner Info.
This structure represents the steering data.
This enumeration defines a Joiner Event on the Commissioner.
This enumeration defines the Commissioner State.
Enumerator |
---|
OT_COMMISSIONER_STATE_DISABLED |
Commissioner role is disabled.
|
OT_COMMISSIONER_STATE_PETITION |
Currently petitioning to become a Commissioner.
|
OT_COMMISSIONER_STATE_ACTIVE |
Commissioner role is active.
|
This function adds a Joiner entry.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aEui64 | A pointer to the Joiner's IEEE EUI-64 or NULL for any Joiner. |
[in] | aPskd | A pointer to the PSKd. |
[in] | aTimeout | A time after which a Joiner is automatically removed, in seconds. |
- Return values
-
OT_ERROR_NONE | Successfully added the Joiner. |
OT_ERROR_NO_BUFS | No buffers available to add the Joiner. |
OT_ERROR_INVALID_ARGS | aEui64 or aPskd is invalid. |
OT_ERROR_INVALID_STATE | The commissioner is not active. |
- Note
- Only use this after successfully starting the Commissioner role with otCommissionerStart().
otError otCommissionerAnnounceBegin |
( |
otInstance * |
aInstance, |
|
|
uint32_t |
aChannelMask, |
|
|
uint8_t |
aCount, |
|
|
uint16_t |
aPeriod, |
|
|
const otIp6Address * |
aAddress |
|
) |
| |
This function sends an Announce Begin message.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aChannelMask | The channel mask value. |
[in] | aCount | The number of Announcement messages per channel. |
[in] | aPeriod | The time between two successive MLE Announce transmissions (in milliseconds). |
[in] | aAddress | A pointer to the IPv6 destination. |
- Return values
-
OT_ERROR_NONE | Successfully enqueued the Announce Begin message. |
OT_ERROR_NO_BUFS | Insufficient buffers to generate an Announce Begin message. |
OT_ERROR_INVALID_STATE | The commissioner is not active. |
- Note
- Only use this after successfully starting the Commissioner role with otCommissionerStart().
This function sends an Energy Scan Query message.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aChannelMask | The channel mask value. |
[in] | aCount | The number of energy measurements per channel. |
[in] | aPeriod | The time between energy measurements (milliseconds). |
[in] | aScanDuration | The scan duration for each energy measurement (milliseconds). |
[in] | aAddress | A pointer to the IPv6 destination. |
[in] | aCallback | A pointer to a function called on receiving an Energy Report message. |
[in] | aContext | A pointer to application-specific context. |
- Return values
-
OT_ERROR_NONE | Successfully enqueued the Energy Scan Query message. |
OT_ERROR_NO_BUFS | Insufficient buffers to generate an Energy Scan Query message. |
OT_ERROR_INVALID_STATE | The commissioner is not active. |
- Note
- Only use this after successfully starting the Commissioner role with otCommissionerStart().
This method get joiner info at aIterator position.
- Parameters
-
[in] | aInstance | A pointer to instance. |
[in,out] | aIterator | A pointer to the Joiner Info iterator context. |
[out] | aJoiner | A reference to Joiner info. |
- Return values
-
OT_ERROR_NONE | Successfully get the Joiner info. |
OT_ERROR_NOT_FOUND | Not found next Joiner. |
const char* otCommissionerGetProvisioningUrl |
( |
otInstance * |
aInstance | ) |
|
This function gets the Provisioning URL.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
- Returns
- A pointer to the URL string.
uint16_t otCommissionerGetSessionId |
( |
otInstance * |
aInstance | ) |
|
This function returns the Commissioner Session ID.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
- Returns
- The current commissioner session id.
This function returns the Commissioner State.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
- Return values
-
OT_COMMISSIONER_STATE_DISABLED | Commissioner disabled. |
OT_COMMISSIONER_STATE_PETITION | Becoming the commissioner. |
OT_COMMISSIONER_STATE_ACTIVE | Commissioner enabled. |
This function sends a PAN ID Query message.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aPanId | The PAN ID to query. |
[in] | aChannelMask | The channel mask value. |
[in] | aAddress | A pointer to the IPv6 destination. |
[in] | aCallback | A pointer to a function called on receiving a PAN ID Conflict message. |
[in] | aContext | A pointer to application-specific context. |
- Return values
-
OT_ERROR_NONE | Successfully enqueued the PAN ID Query message. |
OT_ERROR_NO_BUFS | Insufficient buffers to generate a PAN ID Query message. |
OT_ERROR_INVALID_STATE | The commissioner is not active. |
- Note
- Only use this after successfully starting the Commissioner role with otCommissionerStart().
This function removes a Joiner entry.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aEui64 | A pointer to the Joiner's IEEE EUI-64 or NULL for any Joiner. |
- Return values
-
OT_ERROR_NONE | Successfully removed the Joiner. |
OT_ERROR_NOT_FOUND | The Joiner specified by aEui64 was not found. |
OT_ERROR_INVALID_ARGS | aEui64 is invalid. |
OT_ERROR_INVALID_STATE | The commissioner is not active. |
- Note
- Only use this after successfully starting the Commissioner role with otCommissionerStart().
otError otCommissionerSendMgmtGet |
( |
otInstance * |
aInstance, |
|
|
const uint8_t * |
aTlvs, |
|
|
uint8_t |
aLength |
|
) |
| |
This function sends MGMT_COMMISSIONER_GET.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aTlvs | A pointer to TLVs. |
[in] | aLength | The length of TLVs. |
- Return values
-
OT_ERROR_NONE | Successfully send the meshcop dataset command. |
OT_ERROR_NO_BUFS | Insufficient buffer space to send. |
OT_ERROR_INVALID_STATE | The commissioner is not active. |
This function sends MGMT_COMMISSIONER_SET.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aDataset | A pointer to commissioning dataset. |
[in] | aTlvs | A pointer to TLVs. |
[in] | aLength | The length of TLVs. |
- Return values
-
OT_ERROR_NONE | Successfully send the meshcop dataset command. |
OT_ERROR_NO_BUFS | Insufficient buffer space to send. |
OT_ERROR_INVALID_STATE | The commissioner is not active. |
otError otCommissionerSetProvisioningUrl |
( |
otInstance * |
aInstance, |
|
|
const char * |
aProvisioningUrl |
|
) |
| |
This function sets the Provisioning URL.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aProvisioningUrl | A pointer to the Provisioning URL (may be NULL to set as empty string). |
- Return values
-
OT_ERROR_NONE | Successfully set the Provisioning URL. |
OT_ERROR_INVALID_ARGS | aProvisioningUrl is invalid (too long). |
This function enables the Thread Commissioner role.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
[in] | aStateCallback | A pointer to a function that is called when the commissioner state changes. |
[in] | aJoinerCallback | A pointer to a function that is called with a joiner event occurs. |
[in] | aCallbackContext | A pointer to application-specific context. |
- Return values
-
OT_ERROR_NONE | Successfully started the Commissioner role. |
OT_ERROR_INVALID_STATE | Commissioner is already started. |
This function disables the Thread Commissioner role.
- Parameters
-
[in] | aInstance | A pointer to an OpenThread instance. |
- Return values
-
OT_ERROR_NONE | Successfully stopped the Commissioner role. |
OT_ERROR_INVALID_STATE | Commissioner is already stopped. |