- OIC_LOG_V(DEBUG, TAG, "%d type adapter, register complete!", cType);
- OIC_LOG(DEBUG, TAG, "OUT");
+ callback->adapter = adapterCB;
+ callback->conn = connCB;
+ LL_APPEND(g_networkChangeCallbackList, callback);
+ OIC_LOG_V(INFO, TAG, "Added NetworkStateChanged Callback [%p]", callback);
+
+ return CA_STATUS_OK;
+}
+
+/**
+ * Remove a network callback from the network callback list
+ *
+ * @param adapterCB adapter state changed callback
+ * @param connCB connection state changed callback
+ *
+ * @return
+ * CAResult_t
+ */
+static CAResult_t RemoveNetworkStateChangedCallback(CAAdapterStateChangedCB adapterCB,
+ CAConnectionStateChangedCB connCB)
+{
+ OIC_LOG(DEBUG, TAG, "Remove NetworkStateChanged Callback");
+
+ CANetworkCallback_t* callback = NULL;
+ LL_FOREACH(g_networkChangeCallbackList, callback)
+ {
+ if (callback && adapterCB == callback->adapter && connCB == callback->conn)
+ {
+ OIC_LOG(DEBUG, TAG, "remove specific callback");
+ LL_DELETE(g_networkChangeCallbackList, callback);
+ OICFree(callback);
+ return CA_STATUS_OK;
+ }
+ }
+ return CA_STATUS_OK;