1.2.3.2 Getting Results – Callback Notification, Foreground Retrieval
While the application may wish to be notified of a BSS result being available via the callback mechanism, it may be preferable to retrieve the result information from a foreground task. For example, in an OS environment the callback may simply signal a semaphore triggering the main application task to retrieve the BSS information.
In this model the callback called by the Wi-Fi driver should return the value false. The Wi-Fi driver will not request the next set of BSS information from the PIC32MZW1 device.
The foreground task may then call WDRV_PIC32MZW_BSSFindGetInfo with a pointer to a WDRV_PIC32MZW_BSS_INFO structure to receive the BSS information. If the function is called when there is no valid BSS information present in the PIC32MZW driver, the function will return WDRV_PIC32MZW_STATUS_NO_BSS_INFO.
When the application wishes to request the next set of BSS information, it must call WDRV_PIC32MZW_BSSFindNext. It is possible to change the callback function at this time or even turn off callback operation if a NULL pointer is used. Assuming the callback function is again specified the Wi-Fi driver will request the next set of BSS information from the device and inform the application via the callback.