#include "caadapterinterface.h"
#include "cainterface.h"
+#include "cautilinterface.h"
#ifndef SINGLE_THREAD
#include "cathreadpool.h" /* for thread pool */
* @param[in] adapterCB CAUtil callback to receive adapter status changes.
* @param[in] connCB CAUtil callback to receive connection status changes.
*/
-void CASetNetworkMonitorCallbacks(CAAdapterChangeCallback adapterCB,
- CAConnectionChangeCallback connCB);
+void CASetNetworkMonitorCallbacks(CAAdapterStateChangedCB adapterCB,
+ CAConnectionStateChangedCB connCB);
/**
* Starting different connectivity adapters based on the network selection.
static CANetworkPacketReceivedCallback g_networkPacketReceivedCallback = NULL;
-static CAAdapterChangeCallback g_adapterChangeCallback = NULL;
+static CAAdapterStateChangedCB g_adapterChangeCallback = NULL;
-static CAConnectionChangeCallback g_connChangeCallback = NULL;
+static CAConnectionStateChangedCB g_connChangeCallback = NULL;
static CAErrorHandleCallback g_errorHandleCallback = NULL;
// Call the callback.
if (g_adapterChangeCallback != NULL)
{
- g_adapterChangeCallback(adapter, status);
+ if (CA_INTERFACE_UP == status)
+ {
+ g_adapterChangeCallback(adapter, true);
+ }
+ else if (CA_INTERFACE_DOWN == status)
+ {
+ g_adapterChangeCallback(adapter, false);
+ }
}
OIC_LOG_V(DEBUG, TAG, "[%d]adapter status is changed to [%d]", adapter, status);
}
g_networkPacketReceivedCallback = callback;
}
-void CASetNetworkMonitorCallbacks(CAAdapterChangeCallback adapterCB,
- CAConnectionChangeCallback connCB)
+void CASetNetworkMonitorCallbacks(CAAdapterStateChangedCB adapterCB,
+ CAConnectionStateChangedCB connCB)
{
OIC_LOG(DEBUG, TAG, "Set network monitoring callback");