[joiner-adv] initial implementation of Joiner Advertisement (#5299)

This commit implements Thread based Joiner Advertisement from Joiner
side, including:

- A new MeshCop TLV: Joiner Advertisement TLV which includes IEEE OUI
  and the Advertisement Data.

- New APIs to set Joiner Advertisement which will be sent along with
  Discovery Request messages.
This commit is contained in:
Yuwen Lan
2020-08-03 08:38:58 -07:00
committed by GitHub
parent b2f7414dac
commit addb1936c3
7 changed files with 192 additions and 7 deletions
+1
View File
@@ -287,6 +287,7 @@ typedef enum otMeshcopTlvType
OT_MESHCOP_TLV_ENERGY_LIST = 57, ///< meshcop Energy List TLV
OT_MESHCOP_TLV_DISCOVERYREQUEST = 128, ///< meshcop Discovery Request TLV
OT_MESHCOP_TLV_DISCOVERYRESPONSE = 129, ///< meshcop Discovery Response TLV
OT_MESHCOP_TLV_JOINERADVERTISEMENT = 241, ///< meshcop Joiner Advertisement TLV
} otMeshcopTlvType;
/**
+1 -1
View File
@@ -53,7 +53,7 @@ extern "C" {
* @note This number versions both OpenThread platform and user APIs.
*
*/
#define OPENTHREAD_API_VERSION (20)
#define OPENTHREAD_API_VERSION (21)
/**
* @addtogroup api-instance
+24
View File
@@ -264,6 +264,30 @@ otError otThreadDiscover(otInstance * aInstance,
*/
bool otThreadIsDiscoverInProgress(otInstance *aInstance);
/**
* This method sets the Thread Joiner Advertisement when discovering Thread network.
*
* Thread Joiner Advertisement is used to allow a Joiner to advertise its own application-specific information
* (such as Vendor ID, Product ID, Discriminator, etc.) via a newly-proposed Joiner Advertisement TLV,
* and to make this information available to Commissioners or Commissioner Candidates without human interaction.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aOui The Vendor IEEE OUI value that will be included in the Joiner Advertisement. Only the
* least significant 3 bytes will be used, and the most significant byte will be ignored.
* @param[in] aAdvData A pointer to the AdvData that will be included in the Joiner Advertisement.
* @param[in] aAdvDataLength The length of AdvData in bytes.
*
* @retval OT_ERROR_NONE Successfully set Joiner Advertisement.
* @retval OT_ERROR_INVALID_ARGS Invalid AdvData.
*
*/
otError otThreadSetJoinerAdvertisement(otInstance * aInstance,
uint32_t aOui,
const uint8_t *aAdvData,
uint8_t aAdvDataLength);
#define OT_JOINER_ADVDATA_MAX_LENGTH 64 ///< Maximum AdvData Length of Joiner Advertisement
/**
* Get the Thread Child Timeout used when operating in the Child role.
*