# Multipan

# Multipan

This module includes the platform abstraction for multipan support.

## Summary

| ### Functions ||
|---|---|
| `https://openthread.io/reference/group/plat-multipan#group__plat-multipan_1gad8722725a3572d7b225bf3621d7a7365(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 **aInstance)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Get instance currently in control of the radio. |
| `https://openthread.io/reference/group/plat-multipan#group__plat-multipan_1gadd5576fc988341ae6955fcd5567f9b57(uint8_t aIid)` | `https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *` Get the instance pointer corresponding to the given IID. |
| `https://openthread.io/reference/group/plat-multipan#group__plat-multipan_1gaffeb9125be8fda2d8209a424dd0e0652(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance)` | `uint8_t` Get the IID corresponding to the given OpenThread instance pointer. |
| `https://openthread.io/reference/group/plat-multipan#group__plat-multipan_1gab282a8549d5d2612b3ec9da5d84a85d0(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aCompletePending)` | `https://openthread.io/reference/group/api-error#group__api-error_1gabaaa90aaa35da8f9d394a227a23a6a49` Set `aInstance` as the current active instance controlling radio. |
| `https://openthread.io/reference/group/plat-multipan#group__plat-multipan_1gaca3825745ab6c7977f04b6e2715a7bf0(https://openthread.io/reference/group/api-instance#group__api-instance_1ga25440551213fb5b40869725378584960 *aInstance, bool aSuccess)` | `void` The platform completed the interface switching procedure. |

## Functions

### otPlatMultipanGetActiveInstance

```
otError otPlatMultipanGetActiveInstance(
  otInstance **aInstance
)
```
Get instance currently in control of the radio.

If radio does not operate in parallel on all interfaces, this function returns an instance object with granted radio access.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[out] aInstance` | Pointer to the variable for storing the active instance pointer. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully retrieved the property. | | `OT_ERROR_NOT_IMPLEMENTED` | Failed due to lack of the support in radio. | | `OT_ERROR_INVALID_COMMAND` | Platform supports all interfaces simultaneously. | |

### otPlatMultipanIidToInstance

```
otInstance * otPlatMultipanIidToInstance(
  uint8_t aIid
)
```
Get the instance pointer corresponding to the given IID.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aIid` | The IID of the interface. | |
| Return Values | |---|---| | `Instance` | pointer if aIid is has an instance assigned, NULL otherwise. | |

### otPlatMultipanInstanceToIid

```
uint8_t otPlatMultipanInstanceToIid(
  otInstance *aInstance
)
```
Get the IID corresponding to the given OpenThread instance pointer.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | |
| Return Values | |---|---| | `IID` | of the given instance, broadcast IID otherwise. | |

### otPlatMultipanSetActiveInstance

```
otError otPlatMultipanSetActiveInstance(
  otInstance *aInstance,
  bool aCompletePending
)
```
Set `aInstance` as the current active instance controlling radio.

This function allows selecting the currently active instance on platforms that do not support parallel communication on multiple interfaces. In other words, if more than one instance is in a receive state, calling [otPlatMultipanSetActiveInstance](https://openthread.io/reference/group/plat-multipan#group__plat-multipan_1gab282a8549d5d2612b3ec9da5d84a85d0) guarantees that specified instance will be the one receiving. This function returns if the request was received properly. After interface switching is complete, the platform should call [otPlatMultipanSwitchoverDone](https://openthread.io/reference/group/plat-multipan#group__plat-multipan_1gaca3825745ab6c7977f04b6e2715a7bf0). Switching interfaces may take longer if `aCompletePending` is set true.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | | `[in] aCompletePending` | True if ongoing radio operation should complete before interface switch (Soft switch), false for force switch. | |
| Return Values | |---|---| | `OT_ERROR_NONE` | Successfully set the property. | | `OT_ERROR_BUSY` | Failed due to another operation ongoing. | | `OT_ERROR_NOT_IMPLEMENTED` | Failed due to unknown instance or more instances than interfaces available. | | `OT_ERROR_INVALID_COMMAND` | Platform supports all interfaces simultaneously. | | `OT_ERROR_ALREADY` | Given interface is already active. | |

### otPlatMultipanSwitchoverDone

```
void otPlatMultipanSwitchoverDone(
  otInstance *aInstance,
  bool aSuccess
)
```
The platform completed the interface switching procedure.

Should be invoked immediately after processing [otPlatMultipanSetActiveInstance](https://openthread.io/reference/group/plat-multipan#group__plat-multipan_1gab282a8549d5d2612b3ec9da5d84a85d0) if no delay is needed, or if some longer radio operations need to complete first, after the switch in interfaces is fully complete.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `[in] aInstance` | The OpenThread instance structure. | | `[in] aSuccess` | True if successfully switched the interfaces, false if switching failed. | |

## Resources

OpenThread API Reference topics originate from the source code, available
on [GitHub](https://github.com/openthread/openthread/tree/main/include/openthread).
For more information, or to contribute to our documentation, refer to
[Resources](https://openthread.io/resources).