[instance] add otInstanceGetIndex() (#11197)

This commit is contained in:
seb-fae
2025-03-24 10:04:38 -07:00
committed by GitHub
parent 036256729c
commit 7a258287f1
2 changed files with 14 additions and 1 deletions
+13 -1
View File
@@ -52,7 +52,7 @@ extern "C" {
*
* @note This number versions both OpenThread platform and user APIs.
*/
#define OPENTHREAD_API_VERSION (485)
#define OPENTHREAD_API_VERSION (486)
/**
* @addtogroup api-instance
@@ -114,6 +114,18 @@ otInstance *otInstanceInitSingle(void);
*/
otInstance *otInstanceInitMultiple(uint8_t aIdx);
/**
* Gets the index of the OpenThread instance when multiple instance is in use.
*
* This function is available when both `OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE` and
* `OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE` are enabled.
*
* @param[in] aInstance The reference of the OpenThread instance to get index.
*
* @returns The index of the OpenThread instance.
*/
uint8_t otInstanceGetIndex(otInstance *aInstance);
/**
* Gets the instance identifier.
*
+1
View File
@@ -65,6 +65,7 @@ otInstance *otInstanceInitMultiple(uint8_t aIdx)
return instance;
}
uint8_t otInstanceGetIndex(otInstance *aInstance) { return Instance::GetIdx(AsCoreTypePtr(aInstance)); }
#endif // OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE
otInstance *otInstanceInit(void *aInstanceBuffer, size_t *aInstanceBufferSize)
{