Update all callbacks to support a client supplied context pointer. (#425)

* Update all callbacks to support a client supplied context pointer.
This commit is contained in:
Nick Banks
2016-08-19 11:38:11 -07:00
committed by Jonathan Hui
parent a2580e8346
commit 47dcec0bac
10 changed files with 83 additions and 63 deletions
+28 -20
View File
@@ -239,23 +239,26 @@ bool otIsSingleton(void);
* This function pointer is called during an IEEE 802.15.4 Active Scan when an IEEE 802.15.4 Beacon is received or
* the scan completes.
*
* @param[in] aResult A valid pointer to the beacon information or NULL when the active scan completes.
* @param[in] aResult A valid pointer to the beacon information or NULL when the active scan completes.
* @param[in] aContext A pointer to application-specific context.
*
*/
typedef void (*otHandleActiveScanResult)(otActiveScanResult *aResult);
typedef void (*otHandleActiveScanResult)(otActiveScanResult *aResult, void *aContext);
/**
* This function starts an IEEE 802.15.4 Active Scan
*
* @param[in] aScanChannels A bit vector indicating which channels to scan (e.g. OT_CHANNEL_11_MASK).
* @param[in] aScanDuration The time in milliseconds to spend scanning each channel.
* @param[in] aCallback A pointer to a function called on receiving a beacon or scan completes.
* @param[in] aScanChannels A bit vector indicating which channels to scan (e.g. OT_CHANNEL_11_MASK).
* @param[in] aScanDuration The time in milliseconds to spend scanning each channel.
* @param[in] aCallback A pointer to a function called on receiving a beacon or scan completes.
* @param[in] aCallbackContext A pointer to application-specific context.
*
* @retval kThreadError_None Accepted the Active Scan request.
* @retval kThreadError_Busy Already performing an Active Scan.
*
*/
ThreadError otActiveScan(uint32_t aScanChannels, uint16_t aScanDuration, otHandleActiveScanResult aCallback);
ThreadError otActiveScan(uint32_t aScanChannels, uint16_t aScanDuration, otHandleActiveScanResult aCallback,
void *aCallbackContext);
/**
* This function indicates whether or not an IEEE 802.15.4 Active Scan is currently in progress.
@@ -268,17 +271,18 @@ bool otIsActiveScanInProgress(void);
/**
* This function starts a Thread Discovery scan.
*
* @param[in] aScanChannels A bit vector indicating which channels to scan (e.g. OT_CHANNEL_11_MASK).
* @param[in] aScanDuration The time in milliseconds to spend scanning each channel.
* @param[in] aPanId The PAN ID filter (set to Broadcast PAN to disable filter).
* @param[in] aCallback A pointer to a function called on receiving an MLE Discovery Response or scan completes.
* @param[in] aScanChannels A bit vector indicating which channels to scan (e.g. OT_CHANNEL_11_MASK).
* @param[in] aScanDuration The time in milliseconds to spend scanning each channel.
* @param[in] aPanId The PAN ID filter (set to Broadcast PAN to disable filter).
* @param[in] aCallback A pointer to a function called on receiving an MLE Discovery Response or scan completes.
* @param[in] aCallbackContext A pointer to application-specific context.
*
* @retval kThreadError_None Accepted the Thread Discovery request.
* @retval kThreadError_Busy Already performing an Thread Discovery.
*
*/
ThreadError otDiscover(uint32_t aScanChannels, uint16_t aScanDuration, uint16_t aPanid,
otHandleActiveScanResult aCallback);
otHandleActiveScanResult aCallback, void *aCallbackContext);
/**
* This function indicates whether or not an MLE Thread Discovery is currently in progress.
@@ -1365,19 +1369,21 @@ uint8_t otGetStableNetworkDataVersion(void);
* @note This callback is called before IEEE 802.15.4 security processing and mSecurityValid in @p aFrame will
* always be false.
*
* @param[in] aFrame A pointer to the received IEEE 802.15.4 frame.
* @param[in] aFrame A pointer to the received IEEE 802.15.4 frame.
* @param[in] aContext A pointer to application-specific context.
*
*/
typedef void (*otLinkPcapCallback)(const RadioPacket *aFrame);
typedef void (*otLinkPcapCallback)(const RadioPacket *aFrame, void *aContext);
/**
* This function registers a callback to provide received raw IEEE 802.15.4 frames.
*
* @param[in] aPcapCallback A pointer to a function that is called when receiving an IEEE 802.15.4 link frame or
* NULL to disable the callback.
* @param[in] aPcapCallback A pointer to a function that is called when receiving an IEEE 802.15.4 link frame or
* NULL to disable the callback.
* @param[in] aCallbackContext A pointer to application-specific context.
*
*/
void otSetLinkPcapCallback(otLinkPcapCallback aPcapCallback);
void otSetLinkPcapCallback(otLinkPcapCallback aPcapCallback, void *aCallbackContext);
/**
* This function indicates whether or not promiscuous mode is enabled at the link layer.
@@ -1621,18 +1627,20 @@ int otWriteMessage(otMessage aMessage, uint16_t aOffset, const void *aBuf, uint1
* This function pointer is called when an IPv6 datagram is received.
*
* @param[in] aMessage A pointer to the message buffer containing the received IPv6 datagram.
* @param[in] aContext A pointer to application-specific context.
*
*/
typedef void (*otReceiveIp6DatagramCallback)(otMessage aMessage);
typedef void (*otReceiveIp6DatagramCallback)(otMessage aMessage, void *aContext);
/**
* This function registers a callback to provide received IPv6 datagrams.
*
* @param[in] aCallback A pointer to a function that is called when an IPv6 datagram is received or NULL to disable
* the callback.
* @param[in] aCallback A pointer to a function that is called when an IPv6 datagram is received or
* NULL to disable the callback.
* @param[in] aCallbackContext A pointer to application-specific context.
*
*/
void otSetReceiveIp6DatagramCallback(otReceiveIp6DatagramCallback aCallback);
void otSetReceiveIp6DatagramCallback(otReceiveIp6DatagramCallback aCallback, void *aCallbackContext);
/**
* This function sends an IPv6 datagram via the Thread interface.