Peer-to-Peer#
This module includes provisional functions for the Thread P2P link.
Note
The functions in this module require
OPENTHREAD_CONFIG_P2P_ENABLE=1.
Modules#
Enumerations#
Typedefs#
Represents a request for establishing P2P links.
Notifies the caller that the P2P link establishment process has ended.
Notifies the caller that the P2P link tear down process has ended.
Defines events of the P2P link.
Callback function pointer to signal events of the P2P link.
Functions#
Attempts to wake up peers and establish P2P links with peers.
Tears down the P2P link specified by the Extended Address.
Sets the callback function to notify event changes of P2P links.
Enumeration Documentation#
otP2pEvent#
otP2pEvent
Defines events of the P2P link.
| Enumerator | |
|---|---|
| OT_P2P_EVENT_LINKED | The P2P link has been established. |
| OT_P2P_EVENT_UNLINKED | The P2P link has been torn down. |
Typedef Documentation#
otP2pRequest#
typedef struct otP2pRequest otP2pRequest
Represents a request for establishing P2P links.
otP2pLinkDoneCallback#
typedef void(* otP2pLinkDoneCallback) (void *aContext) )(void *aContext)
Notifies the caller that the P2P link establishment process has ended.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| [in] | aContext | A pointer to the application-specific context. |
otP2pUnlinkDoneCallback#
typedef void(* otP2pUnlinkDoneCallback) (void *aContext) )(void *aContext)
Notifies the caller that the P2P link tear down process has ended.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| [in] | aContext | A pointer to application-specific context. |
otP2pEventCallback#
typedef void(* otP2pEventCallback) (otP2pEvent aEvent, const otExtAddress *aExtAddress, void *aContext) )(otP2pEvent aEvent, const otExtAddress *aExtAddress, void *aContext)
Callback function pointer to signal events of the P2P link.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| [in] | aEvent | The P2P link event. | |
| [in] | aExtAddress | A pointer to the peer's Extended Address of the P2P link. | |
| [in] | aContext | A pointer to the application-specific context. |
Function Documentation#
otP2pWakeupAndLink#
otError otP2pWakeupAndLink (otInstance * aInstance, const otP2pRequest * aP2pRequest, otP2pLinkDoneCallback aCallback, void * aContext)
Attempts to wake up peers and establish P2P links with peers.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| otInstance * | [in] | aInstance | The OpenThread instance. |
| const otP2pRequest * | [in] | aP2pRequest | A pointer to P2P request. |
| otP2pLinkDoneCallback | [in] | aCallback | A pointer to the function that is called when the P2P link establishment process ends . |
| void * | [in] | aContext | A pointer to the callback application-specific context. |
If the aP2pRequest indicates a group wake-up, this method establishes multiple P2P links with peers. Otherwise, it establishes at most one P2P link.
otP2pUnlink#
otError otP2pUnlink (otInstance * aInstance, const otExtAddress * aExtAddress, otP2pUnlinkDoneCallback aCallback, void * aContext)
Tears down the P2P link specified by the Extended Address.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| otInstance * | [in] | aInstance | The OpenThread instance. |
| const otExtAddress * | [in] | aExtAddress | A pointer to the P2P peer's Extended Address. |
| otP2pUnlinkDoneCallback | [in] | aCallback | A pointer to function that is called when the P2P link tear down process has ended. |
| void * | [in] | aContext | A pointer to callback application-specific context. |
otP2pSetEventCallback#
void otP2pSetEventCallback (otInstance * aInstance, otP2pEventCallback aCallback, void * aContext)
Sets the callback function to notify event changes of P2P links.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| otInstance * | [in] | aInstance | The OpenThread instance. |
| otP2pEventCallback | [in] | aCallback | The callback function pointer. |
| void * | [in] | aContext | A pointer to the callback application-specific context. |
A subsequent call to this function will replace any previously set callback.