nRF5 SDK for Thread v0.11.0
Typedefs | Enumerations | Functions
Commissioner

This module includes functions for the Thread Commissioner role. More...

Typedefs

typedef enum otCommissionerState otCommissionerState
 
typedef void(OTCALLotCommissionerEnergyReportCallback )(uint32_t aChannelMask, const uint8_t *aEnergyList, uint8_t aEnergyListLength, void *aContext)
 
typedef void(OTCALLotCommissionerPanIdConflictCallback )(uint16_t aPanId, uint32_t aChannelMask, void *aContext)
 

Enumerations

enum  otCommissionerState { OT_COMMISSIONER_STATE_DISABLED = 0, OT_COMMISSIONER_STATE_PETITION = 1, OT_COMMISSIONER_STATE_ACTIVE = 2 }
 

Functions

OTAPI otError OTCALL otCommissionerStart (otInstance *aInstance)
 
OTAPI otError OTCALL otCommissionerStop (otInstance *aInstance)
 
OTAPI otError OTCALL otCommissionerAddJoiner (otInstance *aInstance, const otExtAddress *aEui64, const char *aPSKd, uint32_t aTimeout)
 
OTAPI otError OTCALL otCommissionerRemoveJoiner (otInstance *aInstance, const otExtAddress *aEui64)
 
OTAPI otError OTCALL otCommissionerSetProvisioningUrl (otInstance *aInstance, const char *aProvisioningUrl)
 
OTAPI otError OTCALL otCommissionerAnnounceBegin (otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, const otIp6Address *aAddress)
 
OTAPI otError OTCALL otCommissionerEnergyScan (otInstance *aInstance, uint32_t aChannelMask, uint8_t aCount, uint16_t aPeriod, uint16_t aScanDuration, const otIp6Address *aAddress, otCommissionerEnergyReportCallback aCallback, void *aContext)
 
OTAPI otError OTCALL otCommissionerPanIdQuery (otInstance *aInstance, uint16_t aPanId, uint32_t aChannelMask, const otIp6Address *aAddress, otCommissionerPanIdConflictCallback aCallback, void *aContext)
 
OTAPI otError OTCALL otCommissionerSendMgmtGet (otInstance *aInstance, const uint8_t *aTlvs, uint8_t aLength)
 
OTAPI otError OTCALL otCommissionerSendMgmtSet (otInstance *aInstance, const otCommissioningDataset *aDataset, const uint8_t *aTlvs, uint8_t aLength)
 
OTAPI uint16_t OTCALL otCommissionerGetSessionId (otInstance *aInstance)
 
OTAPI otCommissionerState OTCALL otCommissionerGetState (otInstance *aInstance)
 
OTAPI otError OTCALL otCommissionerGeneratePSKc (otInstance *aInstance, const char *aPassPhrase, const char *aNetworkName, const uint8_t *aExtPanId, uint8_t *aPSKc)
 

Detailed Description

This module includes functions for the Thread Commissioner role.

Typedef Documentation

typedef void(OTCALL * 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]aChannelMaskThe channel mask value.
[in]aEnergyListA pointer to the energy measurement list.
[in]aEnergyListLengthNumber of entries in aEnergyListLength.
[in]aContextA pointer to application-specific context.
typedef void(OTCALL * 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]aPanIdThe PAN ID value.
[in]aChannelMaskThe channel mask value.
[in]aContextA pointer to application-specific context.

This enumeration defines the Commissioner State.

Enumeration Type Documentation

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.

Function Documentation

OTAPI otError OTCALL otCommissionerAddJoiner ( otInstance aInstance,
const otExtAddress aEui64,
const char *  aPSKd,
uint32_t  aTimeout 
)

This function adds a Joiner entry.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aEui64A pointer to the Joiner's IEEE EUI-64 or NULL for any Joiner.
[in]aPSKdA pointer to the PSKd.
[in]aTimeoutA time after which a Joiner is automatically removed, in seconds.
Return values
OT_ERROR_NONESuccessfully added the Joiner.
OT_ERROR_NO_BUFSNo buffers available to add the Joiner.
OT_ERROR_INVALID_ARGSaEui64 or aPSKd is invalid.
OT_ERROR_INVALID_STATEThe commissioner is not active.
Note
Only use this after successfully starting the Commissioner role with otCommissionerStart().
OTAPI otError OTCALL otCommissionerAnnounceBegin ( otInstance aInstance,
uint32_t  aChannelMask,
uint8_t  aCount,
uint16_t  aPeriod,
const otIp6Address aAddress 
)

This function sends an Announce Begin message.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aChannelMaskThe channel mask value.
[in]aCountThe number of energy measurements per channel.
[in]aPeriodThe time between energy measurements (milliseconds).
[in]aAddressA pointer to the IPv6 destination.
Return values
OT_ERROR_NONESuccessfully enqueued the Announce Begin message.
OT_ERROR_NO_BUFSInsufficient buffers to generate an Announce Begin message.
OT_ERROR_INVALID_STATEThe commissioner is not active.
Note
Only use this after successfully starting the Commissioner role with otCommissionerStart().
OTAPI otError OTCALL otCommissionerEnergyScan ( otInstance aInstance,
uint32_t  aChannelMask,
uint8_t  aCount,
uint16_t  aPeriod,
uint16_t  aScanDuration,
const otIp6Address aAddress,
otCommissionerEnergyReportCallback  aCallback,
void *  aContext 
)

This function sends an Energy Scan Query message.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aChannelMaskThe channel mask value.
[in]aCountThe number of energy measurements per channel.
[in]aPeriodThe time between energy measurements (milliseconds).
[in]aScanDurationThe scan duration for each energy measurement (milliseconds).
[in]aAddressA pointer to the IPv6 destination.
[in]aCallbackA pointer to a function called on receiving an Energy Report message.
[in]aContextA pointer to application-specific context.
Return values
OT_ERROR_NONESuccessfully enqueued the Energy Scan Query message.
OT_ERROR_NO_BUFSInsufficient buffers to generate an Energy Scan Query message.
OT_ERROR_INVALID_STATEThe commissioner is not active.
Note
Only use this after successfully starting the Commissioner role with otCommissionerStart().
OTAPI otError OTCALL otCommissionerGeneratePSKc ( otInstance aInstance,
const char *  aPassPhrase,
const char *  aNetworkName,
const uint8_t *  aExtPanId,
uint8_t *  aPSKc 
)

This method generates PSKc.

PSKc is used to establish the Commissioner Session.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aPassPhraseThe commissioning passphrase.
[in]aNetworkNameThe network name for PSKc computation.
[in]aExtPanIdThe extended pan id for PSKc computation.
[out]aPSKcA pointer to the generated PSKc.
Return values
OT_ERROR_NONESuccessfully generate PSKc.
OT_ERROR_INVALID_ARGSIf any of the input arguments is invalid.
OTAPI uint16_t OTCALL otCommissionerGetSessionId ( otInstance aInstance)

This function returns the Commissioner Session ID.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The current commissioner session id.
OTAPI otCommissionerState OTCALL otCommissionerGetState ( otInstance aInstance)

This function returns the Commissioner State.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
OT_COMMISSIONER_STATE_DISABLEDCommissioner disabled.
OT_COMMISSIONER_STATE_PETITIONBecoming the commissioner.
OT_COMMISSIONER_STATE_ACTIVECommissioner enabled.
OTAPI otError OTCALL otCommissionerPanIdQuery ( otInstance aInstance,
uint16_t  aPanId,
uint32_t  aChannelMask,
const otIp6Address aAddress,
otCommissionerPanIdConflictCallback  aCallback,
void *  aContext 
)

This function sends a PAN ID Query message.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aPanIdThe PAN ID to query.
[in]aChannelMaskThe channel mask value.
[in]aAddressA pointer to the IPv6 destination.
[in]aCallbackA pointer to a function called on receiving an Energy Report message.
[in]aContextA pointer to application-specific context.
Return values
OT_ERROR_NONESuccessfully enqueued the PAN ID Query message.
OT_ERROR_NO_BUFSInsufficient buffers to generate a PAN ID Query message.
OT_ERROR_INVALID_STATEThe commissioner is not active.
Note
Only use this after successfully starting the Commissioner role with otCommissionerStart().
OTAPI otError OTCALL otCommissionerRemoveJoiner ( otInstance aInstance,
const otExtAddress aEui64 
)

This function removes a Joiner entry.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aEui64A pointer to the Joiner's IEEE EUI-64 or NULL for any Joiner.
Return values
OT_ERROR_NONESuccessfully removed the Joiner.
OT_ERROR_NOT_FOUNDThe Joiner specified by aEui64 was not found.
OT_ERROR_INVALID_ARGSaEui64 is invalid.
OT_ERROR_INVALID_STATEThe commissioner is not active.
Note
Only use this after successfully starting the Commissioner role with otCommissionerStart().
OTAPI otError OTCALL otCommissionerSendMgmtGet ( otInstance aInstance,
const uint8_t *  aTlvs,
uint8_t  aLength 
)

This function sends MGMT_COMMISSIONER_GET.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aTlvsA pointer to TLVs.
[in]aLengthThe length of TLVs.
Return values
OT_ERROR_NONESuccessfully send the meshcop dataset command.
OT_ERROR_NO_BUFSInsufficient buffer space to send.
OTAPI otError OTCALL otCommissionerSendMgmtSet ( otInstance aInstance,
const otCommissioningDataset aDataset,
const uint8_t *  aTlvs,
uint8_t  aLength 
)

This function sends MGMT_COMMISSIONER_SET.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aDatasetA pointer to commissioning dataset.
[in]aTlvsA pointer to TLVs.
[in]aLengthThe length of TLVs.
Return values
OT_ERROR_NONESuccessfully send the meshcop dataset command.
OT_ERROR_NO_BUFSInsufficient buffer space to send.
OTAPI otError OTCALL otCommissionerSetProvisioningUrl ( otInstance aInstance,
const char *  aProvisioningUrl 
)

This function sets the Provisioning URL.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aProvisioningUrlA pointer to the Provisioning URL (may be NULL).
Return values
OT_ERROR_NONESuccessfully set the Provisioning URL.
OT_ERROR_INVALID_ARGSaProvisioningUrl is invalid.
OTAPI otError OTCALL otCommissionerStart ( otInstance aInstance)

This function enables the Thread Commissioner role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
OT_ERROR_NONESuccessfully started the Commissioner role.
OTAPI otError OTCALL otCommissionerStop ( otInstance aInstance)

This function disables the Thread Commissioner role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
OT_ERROR_NONESuccessfully stopped the Commissioner role.

Documentation feedback | Developer Zone | Subscribe | Updated