The OIC_LOG_V macro is intended to be used for variadic log messages.
This macro was used in many cases for non-variadic messages. In these
cases, OIC_LOG_V was replaced with OIC_LOG.
Change-Id: I8a2c9319da495fc89d73146c3b57e67f64a60340
Signed-off-by: Doug Hudson <douglas.hudson@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/667
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
{
if (NULL == mutex)
{
- OIC_LOG_V(ERROR, TAG , "u_mutex_lock, Invalid mutex !");
+ OIC_LOG(ERROR, TAG , "u_mutex_lock, Invalid mutex !");
return;
}
{
if (NULL == mutex)
{
- OIC_LOG_V(ERROR, TAG, "u_mutex_trylock, Invalid mutex !");
+ OIC_LOG(ERROR, TAG, "u_mutex_trylock, Invalid mutex !");
return false;
}
{
if (NULL == mutex)
{
- OIC_LOG_V(ERROR, TAG, "u_mutex_unlock, Invalid mutex !");
+ OIC_LOG(ERROR, TAG, "u_mutex_unlock, Invalid mutex !");
return;
}
{
if (NULL == mutex)
{
- OIC_LOG_V(ERROR, TAG, "u_mutex_free, Invalid mutex !");
+ OIC_LOG(ERROR, TAG, "u_mutex_free, Invalid mutex !");
return;
}
{
if (NULL == cond)
{
- OIC_LOG_V(ERROR, TAG, "u_cond_signal, Invalid condition !");
+ OIC_LOG(ERROR, TAG, "u_cond_signal, Invalid condition !");
return;
}
{
if (NULL == cond)
{
- OIC_LOG_V(ERROR, TAG, "u_cond_broadcast, Invalid condition !");
+ OIC_LOG(ERROR, TAG, "u_cond_broadcast, Invalid condition !");
return;
}
{
if (NULL == mutex)
{
- OIC_LOG_V(ERROR, TAG, "u_cond_wait, Invalid mutex !");
+ OIC_LOG(ERROR, TAG, "u_cond_wait, Invalid mutex !");
return;
}
if (NULL == cond)
{
- OIC_LOG_V(ERROR, TAG, "u_cond_wait, Invalid condition !");
+ OIC_LOG(ERROR, TAG, "u_cond_wait, Invalid condition !");
return;
}
{
if (NULL == mutex)
{
- OIC_LOG_V(ERROR, TAG, "u_cond_wait, Invalid mutex !");
+ OIC_LOG(ERROR, TAG, "u_cond_wait, Invalid mutex !");
return;
}
if (NULL == cond)
{
- OIC_LOG_V(ERROR, TAG, "u_cond_wait, Invalid condition !");
+ OIC_LOG(ERROR, TAG, "u_cond_wait, Invalid condition !");
return;
}
{
if (NULL == cond)
{
- OIC_LOG_V(ERROR, TAG, "u_cond_free, Invalid condition !");
+ OIC_LOG(ERROR, TAG, "u_cond_free, Invalid condition !");
return;
}
// TODO: It will be updated when android EDR support is added
CAResult_t CAEDRGetInterfaceInformation(CALocalConnectivity_t **info)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRManagerReadData(void)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "OUT");
return CA_NOT_SUPPORTED;
}
CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress, const char *serviceUUID,
const void *data, uint32_t dataLength, uint32_t *sentLength)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
CAEDRSendUnicastMessage(remoteAddress, (const char*) data, dataLength);
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRClientSendMulticastData(const char *serviceUUID, const void *data,
uint32_t dataLength, uint32_t *sentLength)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
CAEDRSendMulticastMessage((const char*) data, dataLength);
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
// TODO: It will be updated when android EDR support is added
void CAEDRClientUnsetCallbacks(void)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
}
// TODO: It will be updated when android EDR support is added
void CAEDRClientDisconnectAll(void)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
}
CAResult_t CAEDRGetAdapterEnableState(bool *state)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
if (!g_jvm)
{
- OIC_LOG_V(ERROR, TAG, "g_jvm is null");
+ OIC_LOG(ERROR, TAG, "g_jvm is null");
return CA_STATUS_INVALID_PARAM;
}
jboolean isAttached = JNI_FALSE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRGetAdapterEnableState - Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "CAEDRGetAdapterEnableState - Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "AttachCurrentThread failed");
+ OIC_LOG(DEBUG, TAG, "AttachCurrentThread failed");
return CA_STATUS_INVALID_PARAM;
}
isAttached = JNI_TRUE;
if(isAttached)
(*g_jvm)->DetachCurrentThread(g_jvm);
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
void CAEDRJniSetContext(jobject context)
{
- OIC_LOG_V(DEBUG, TAG, "caedrSetObject");
+ OIC_LOG(DEBUG, TAG, "caedrSetObject");
if (!context)
{
- OIC_LOG_V(ERROR, TAG, "context is null");
+ OIC_LOG(ERROR, TAG, "context is null");
return;
}
jboolean isAttached = JNI_FALSE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRInitialize - Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "CAEDRInitialize - Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "AttachCurrentThread failed");
+ OIC_LOG(DEBUG, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
void CAEDRCreateJNIInterfaceObject(jobject context)
{
JNIEnv* env;
- OIC_LOG_V(DEBUG, TAG, "[EDRCore] CAEDRCreateJNIInterfaceObject");
+ OIC_LOG(DEBUG, TAG, "[EDRCore] CAEDRCreateJNIInterfaceObject");
if ((*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6) != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "[EDRCore] Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "[EDRCore] Could not get JNIEnv pointer");
return;
}
jclass contextClass = (*env)->FindClass(env, "android/content/Context");
if (contextClass == 0)
{
- OIC_LOG_V(DEBUG, TAG, "[EDRCore] Could not get context object class");
+ OIC_LOG(DEBUG, TAG, "[EDRCore] Could not get context object class");
return;
}
"getApplicationContext", "()Landroid/content/Context;");
if (getApplicationContextMethod == 0)
{
- OIC_LOG_V(DEBUG, TAG, "[EDRCore] Could not get getApplicationContext method");
+ OIC_LOG(DEBUG, TAG, "[EDRCore] Could not get getApplicationContext method");
return;
}
jclass WiFiJniInterface = (*env)->FindClass(env, "com/iotivity/jar/CAEDRInterface");
if (!WiFiJniInterface)
{
- OIC_LOG_V(DEBUG, TAG, "[EDRCore] Could not get CAWiFiInterface class");
+ OIC_LOG(DEBUG, TAG, "[EDRCore] Could not get CAWiFiInterface class");
return;
}
WiFiJniInterface, "<init>", "(Landroid/content/Context;)V");
if (!WiFiInterfaceConstructorMethod)
{
- OIC_LOG_V(ERROR, TAG, "[EDRCore] Could not get CAWiFiInterface constructor method");
+ OIC_LOG(ERROR, TAG, "[EDRCore] Could not get CAWiFiInterface constructor method");
return;
}
(*env)->NewObject(env, WiFiJniInterface, WiFiInterfaceConstructorMethod, gApplicationContext);
- OIC_LOG_V(DEBUG, TAG, "[EDRCore] Create CAWiFiInterface instance");
- OIC_LOG_V(DEBUG, TAG, "[EDRCore] NewObject Success");
+ OIC_LOG(DEBUG, TAG, "[EDRCore] Create CAWiFiInterface instance");
+ OIC_LOG(DEBUG, TAG, "[EDRCore] NewObject Success");
}
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRInitialize - Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "CAEDRInitialize - Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "AttachCurrentThread failed");
+ OIC_LOG(DEBUG, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRTerminate - Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "CAEDRTerminate - Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "AttachCurrentThread failed");
+ OIC_LOG(DEBUG, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
void CAEDRCoreJniInit(JNIEnv *env, JavaVM *jvm)
{
- OIC_LOG_V(DEBUG, TAG, "CAEdrClientJniInit");
+ OIC_LOG(DEBUG, TAG, "CAEdrClientJniInit");
g_jvm = jvm;
CAEDRServerJniInit(env, jvm);
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRSendMulticastMessage - Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "CAEDRSendMulticastMessage - Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "AttachCurrentThread failed");
+ OIC_LOG(DEBUG, TAG, "AttachCurrentThread failed");
return CA_STATUS_INVALID_PARAM;
}
isAttached = JNI_TRUE;
CAEDRSendMulticastMessageImpl(env, data, dataLen);
- OIC_LOG_V(DEBUG, TAG, "sent data");
+ OIC_LOG(DEBUG, TAG, "sent data");
if(isAttached)
{
- OIC_LOG_V(DEBUG, TAG, "DetachCurrentThread");
+ OIC_LOG(DEBUG, TAG, "DetachCurrentThread");
(*g_jvm)->DetachCurrentThread(g_jvm);
}
- OIC_LOG_V(DEBUG, TAG, "OUT - CAEDRSendMulticastMessage");
+ OIC_LOG(DEBUG, TAG, "OUT - CAEDRSendMulticastMessage");
return CA_STATUS_OK;
}
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRGetLocalAddress - Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "CAEDRGetLocalAddress - Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "AttachCurrentThread failed");
+ OIC_LOG(DEBUG, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRSendUnicastMessageImpl - Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "CAEDRSendUnicastMessageImpl - Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "AttachCurrentThread failed");
+ OIC_LOG(DEBUG, TAG, "AttachCurrentThread failed");
return CA_STATUS_INVALID_PARAM;
}
isAttached = TRUE;
jobjectArray jni_arrayPairedDevices = CAEDRNativeGetBondedDevices(env);
if(!jni_arrayPairedDevices)
{
- OIC_LOG_V(DEBUG, TAG, "[EDR][Native] jni_arrayPairedDevices is empty");
+ OIC_LOG(DEBUG, TAG, "[EDR][Native] jni_arrayPairedDevices is empty");
if (isAttached)
(*g_jvm)->DetachCurrentThread(g_jvm);
return CA_STATUS_INVALID_PARAM;
jsize i;
for( i = 0 ; i < length ; i++ )
{
- OIC_LOG_V(DEBUG, TAG, "[EDR][Native] start to check device");
+ OIC_LOG(DEBUG, TAG, "[EDR][Native] start to check device");
// get name, address from BT device
jobject j_obj_device = (*env)->GetObjectArrayElement(env, jni_arrayPairedDevices, i);
jobjectArray jni_arrayPairedDevices = CAEDRNativeGetBondedDevices(env);
if(!jni_arrayPairedDevices)
{
- OIC_LOG_V(DEBUG, TAG, "[EDR][Native] jni_arrayPairedDevices is empty");
+ OIC_LOG(DEBUG, TAG, "[EDR][Native] jni_arrayPairedDevices is empty");
return CA_STATUS_INVALID_PARAM;
}
// Get information from array of devices
// create new object array
if (g_deviceStateList == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "Create device list");
+ OIC_LOG(DEBUG, TAG, "Create device list");
g_deviceStateList = u_arraylist_create();
}
if(!strcmp(remoteAddress, state->address))
{
- OIC_LOG_V(DEBUG, TAG, "the device is already set");
+ OIC_LOG(DEBUG, TAG, "the device is already set");
return JNI_TRUE;
}
else
}
}
- OIC_LOG_V(DEBUG, TAG, "there are no the device in list.");
+ OIC_LOG(DEBUG, TAG, "there are no the device in list.");
return JNI_FALSE;
}
void CAEDRNativeRemoveAllDeviceState()
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRNativeRemoveAllDevices");
+ OIC_LOG(DEBUG, TAG, "CAEDRNativeRemoveAllDevices");
if(!g_deviceStateList)
{
void CAEDRNativeRemoveDevice(const char *remoteAddress)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRNativeRemoveDeviceforStateList");
+ OIC_LOG(DEBUG, TAG, "CAEDRNativeRemoveDeviceforStateList");
if(!g_deviceStateList)
{
CAConnectedState_t CAEDRIsConnectedDevice(const char *remoteAddress)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRIsConnectedDevice");
+ OIC_LOG(DEBUG, TAG, "CAEDRIsConnectedDevice");
if(!g_deviceStateList)
{
if(!strcmp(state->address, remoteAddress))
{
- OIC_LOG_V(DEBUG, TAG, "[EDR][Native] check whether it is connected or not");
+ OIC_LOG(DEBUG, TAG, "[EDR][Native] check whether it is connected or not");
return state->state;
}
// create new object array
if (g_deviceObjectList == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "Create Device object list");
+ OIC_LOG(DEBUG, TAG, "Create Device object list");
g_deviceObjectList = u_arraylist_create();
}
{
jobject gDeviceSocker = (*env)->NewGlobalRef(env, deviceSocket);
u_arraylist_add(g_deviceObjectList, gDeviceSocker);
- OIC_LOG_V(DEBUG, TAG, "Set Socket Object to Array");
+ OIC_LOG(DEBUG, TAG, "Set Socket Object to Array");
}
u_mutex_unlock(g_mutexSocketListManager);
if(!strcmp(remoteAddress, setAddress))
{
- OIC_LOG_V(DEBUG, TAG, "the device is already set");
+ OIC_LOG(DEBUG, TAG, "the device is already set");
return JNI_TRUE;
}
else
}
}
- OIC_LOG_V(DEBUG, TAG, "there are no the Device obejct in list. we can add");
+ OIC_LOG(DEBUG, TAG, "there are no the Device obejct in list. we can add");
return JNI_FALSE;
}
void CAEDRNativeRemoveAllDeviceSocket(JNIEnv *env)
{
- OIC_LOG_V(DEBUG, TAG, "CANativeRemoveAllDeviceObjsList");
+ OIC_LOG(DEBUG, TAG, "CANativeRemoveAllDeviceObjsList");
if(!g_deviceObjectList)
{
void CAEDRNativeRemoveDeviceSocket(JNIEnv *env, jobject deviceSocket)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRNativeRemoveDeviceSocket");
+ OIC_LOG(DEBUG, TAG, "CAEDRNativeRemoveDeviceSocket");
if(!g_deviceObjectList)
{
jobject CAEDRNativeGetDeviceSocket(uint32_t idx)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRNativeGetDeviceSocket");
+ OIC_LOG(DEBUG, TAG, "CAEDRNativeGetDeviceSocket");
if(idx < 0)
{
CAResult_t CAEDRInitializeNetworkMonitor()
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
void CAEDRSetNetworkChangeCallback(
CAEDRNetworkStatusCallback networkChangeCallback)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
}
void CAEDRTerminateNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
}
CAResult_t CAEDRStartNetworkMonitor()
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRStopNetworkMonitor()
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRClientSetCallbacks(void)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
static void CAReceiveHandler(void *data)
{
- OIC_LOG_V(DEBUG, TAG, "start CAReceiveHandler..");
+ OIC_LOG(DEBUG, TAG, "start CAReceiveHandler..");
OIC_LOG(DEBUG, TAG, "IN");
// Input validation
VERIFY_NON_NULL_VOID(data, TAG, "Invalid thread context");
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "CAReceiveHandler - Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "CAReceiveHandler - Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "AttachCurrentThread failed");
+ OIC_LOG(DEBUG, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
uint32_t length = CAEDRServerGetSocketListLength();
if (0 == length)
{
- OIC_LOG_V(DEBUG, TAG, "socket list is empty");
+ OIC_LOG(DEBUG, TAG, "socket list is empty");
}
for (idx = 0; idx < length; idx++)
{
- OIC_LOG_V(DEBUG, TAG, "start CAEDRNativeReadData");
+ OIC_LOG(DEBUG, TAG, "start CAEDRNativeReadData");
CAEDRNativeReadData(env, idx, ctx->type);
}
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "CAAcceptHandler - Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "CAAcceptHandler - Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "AttachCurrentThread failed");
+ OIC_LOG(DEBUG, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
CAResult_t CAEDRServerStart(const char *serviceUUID, int32_t *serverFD, u_thread_pool_t handle)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
CAEDRServerInitialize(handle);
// FIXME
CAEDRStartUnicastServer(NULL, false);
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRServerStop(int serverFD)
{
- OIC_LOG_V(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
CAEDRStopUnicastServer(-1);
CAEDRStopMulticastServer(-1);
g_stopMulticast = TRUE;
g_stopUnicast = TRUE;
- OIC_LOG_V(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
void CAEDRServerJniInit(JNIEnv *env, JavaVM* jvm)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRServerJniInit");
+ OIC_LOG(DEBUG, TAG, "CAEDRServerJniInit");
g_jvm = jvm;
}
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRServerInitialize - Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "CAEDRServerInitialize - Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "AttachCurrentThread failed");
+ OIC_LOG(DEBUG, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRServerTerminate - Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "CAEDRServerTerminate - Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if(res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "AttachCurrentThread failed");
+ OIC_LOG(DEBUG, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
int32_t CAEDRStartMulticastServer(bool isSecured)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRStartMulticastServer");
+ OIC_LOG(DEBUG, TAG, "CAEDRStartMulticastServer");
u_mutex_lock(g_mutexMulticastServer);
g_stopMulticast = true;
u_mutex_unlock(g_mutexMulticastServer);
- OIC_LOG_V(INFO, TAG, "Multicast server stopped");
+ OIC_LOG(INFO, TAG, "Multicast server stopped");
return 0;
}
(*env)->ExceptionClear(env);
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, TAG, "[EDR][Native] btReadData: reading");
+ OIC_LOG(DEBUG, TAG, "[EDR][Native] btReadData: reading");
jbyte* buf = (*env)->GetByteArrayElements(env, jbuf, NULL);
jint length = strlen((char*)buf);
OIC_LOG_V(DEBUG, TAG, "[EDR][Native] btReadData: read %s", buf);
default:
// Should never occur
- OIC_LOG_V(DEBUG, TAG, "Invalid server type");
+ OIC_LOG(DEBUG, TAG, "Invalid server type");
return CA_STATUS_FAILED;
}
(*env)->ReleaseByteArrayElements(env, jbuf, buf, 0);
// create new object array
if (g_deviceStateList == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "Create device list");
+ OIC_LOG(DEBUG, TAG, "Create device list");
g_deviceStateList = u_arraylist_create();
if (g_deviceStateList == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "Create device list is null");
+ OIC_LOG(DEBUG, TAG, "Create device list is null");
}
}
}
if(!CAEDRServerNativeIsDeviceInList(state->address)) {
CAEDRServerNativeRemoveDevice(state->address); // delete previous state for update new state
u_arraylist_add(g_deviceStateList, state); // update new state
- OIC_LOG_V(DEBUG, TAG, "Set State to Connected State List");
+ OIC_LOG(DEBUG, TAG, "Set State to Connected State List");
}
}
if(!strcmp(remoteAddress, state->address))
{
- OIC_LOG_V(DEBUG, TAG, "the device is already set");
+ OIC_LOG(DEBUG, TAG, "the device is already set");
return JNI_TRUE;
}
else
}
}
- OIC_LOG_V(DEBUG, TAG, "there are no the device in list.");
+ OIC_LOG(DEBUG, TAG, "there are no the device in list.");
return JNI_FALSE;
}
void CAEDRServerNativeRemoveAllDeviceState()
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRNativeRemoveAllDevices");
+ OIC_LOG(DEBUG, TAG, "CAEDRNativeRemoveAllDevices");
if(!g_deviceStateList)
{
void CAEDRServerNativeRemoveDevice(const char *remoteAddress)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRNativeRemoveDevice");
+ OIC_LOG(DEBUG, TAG, "CAEDRNativeRemoveDevice");
if(!g_deviceStateList)
{
jboolean CAEDRServerIsConnectedDevice(const char *remoteAddress)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRServerIsConnectedDevice");
+ OIC_LOG(DEBUG, TAG, "CAEDRServerIsConnectedDevice");
if(!g_deviceStateList)
{
if(!strcmp(state->address, remoteAddress))
{
- OIC_LOG_V(DEBUG, TAG, "[EDR][Native] check whether it is connected or not");
+ OIC_LOG(DEBUG, TAG, "[EDR][Native] check whether it is connected or not");
return state->state;
}
// create new object array
if (g_deviceObjectList == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "Create Device object list");
+ OIC_LOG(DEBUG, TAG, "Create Device object list");
g_deviceObjectList = u_arraylist_create();
if (g_deviceObjectList == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "Create Device object list is null");
+ OIC_LOG(DEBUG, TAG, "Create Device object list is null");
}
}
}
{
jobject gDeviceSocket = (*env)->NewGlobalRef(env, deviceSocket);
u_arraylist_add(g_deviceObjectList, gDeviceSocket);
- OIC_LOG_V(DEBUG, TAG, "Set Object to Array as Element");
+ OIC_LOG(DEBUG, TAG, "Set Object to Array as Element");
}
(*env)->ReleaseStringUTFChars(env, jni_remoteAddress, remoteAddress);
}
if(!strcmp(remoteAddress, setAddress))
{
- OIC_LOG_V(DEBUG, TAG, "the device is already set");
+ OIC_LOG(DEBUG, TAG, "the device is already set");
return JNI_TRUE;
}
else
}
}
- OIC_LOG_V(DEBUG, TAG, "there are no the Device obejct in list. we can add");
+ OIC_LOG(DEBUG, TAG, "there are no the Device obejct in list. we can add");
return JNI_FALSE;
}
void CAEDRServerNativeRemoveAllDeviceSocket(JNIEnv *env)
{
- OIC_LOG_V(DEBUG, TAG, "CANativeRemoveAllDeviceObjsList");
+ OIC_LOG(DEBUG, TAG, "CANativeRemoveAllDeviceObjsList");
if(!g_deviceObjectList)
{
void CAEDRServerNativeRemoveDeviceSocket(JNIEnv *env, jobject deviceSocket)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRServerNativeRemoveDeviceSocket");
+ OIC_LOG(DEBUG, TAG, "CAEDRServerNativeRemoveDeviceSocket");
if(!g_deviceObjectList)
{
jobject CAEDRServerNativeGetDeviceSocket(uint32_t idx)
{
- OIC_LOG_V(DEBUG, TAG, "CAEDRServerNativeGetDeviceSocket");
+ OIC_LOG(DEBUG, TAG, "CAEDRServerNativeGetDeviceSocket");
if(idx < 0)
{
jclass jni_cid_BTSocket = (*env)->FindClass(env, "android/bluetooth/BluetoothSocket");
if(!jni_cid_BTSocket)
{
- OIC_LOG_V(ERROR, TAG, "[EDR] getRemoteAddress: jni_cid_BTSocket is null");
+ OIC_LOG(ERROR, TAG, "[EDR] getRemoteAddress: jni_cid_BTSocket is null");
return NULL;
}
"()Landroid/bluetooth/BluetoothDevice;");
if(!jni_mid_getRemoteDevice)
{
- OIC_LOG_V(ERROR, TAG, "[EDR] getRemoteAddress: jni_mid_getRemoteDevice is null");
+ OIC_LOG(ERROR, TAG, "[EDR] getRemoteAddress: jni_mid_getRemoteDevice is null");
return NULL;
}
bluetoothSocketObj, jni_mid_getRemoteDevice);
if(!jni_obj_remoteBTDevice)
{
- OIC_LOG_V(ERROR, TAG, "[EDR] getRemoteAddress: jni_obj_remoteBTDevice is null");
+ OIC_LOG(ERROR, TAG, "[EDR] getRemoteAddress: jni_obj_remoteBTDevice is null");
return NULL;
}
jclass jni_cid_BTDevice = (*env)->FindClass(env, "android/bluetooth/BluetoothDevice");
if(!jni_cid_BTDevice)
{
- OIC_LOG_V(ERROR, TAG, "[EDR] getRemoteAddress: jni_cid_BTDevice is null");
+ OIC_LOG(ERROR, TAG, "[EDR] getRemoteAddress: jni_cid_BTDevice is null");
return NULL;
}
jmethodID j_mid_getAddress = (*env)->GetMethodID(env, jni_cid_BTDevice,
"getAddress", "()Ljava/lang/String;");
if(!j_mid_getAddress)
{
- OIC_LOG_V(ERROR, TAG, "[EDR] getRemoteAddress: j_mid_getAddress is null");
+ OIC_LOG(ERROR, TAG, "[EDR] getRemoteAddress: j_mid_getAddress is null");
return NULL;
}
jstring j_str_address = (*env)->CallObjectMethod(env, jni_obj_remoteBTDevice, j_mid_getAddress);
if(!j_str_address)
{
- OIC_LOG_V(ERROR, TAG, "[EDR] getRemoteAddress: j_str_address is null");
+ OIC_LOG(ERROR, TAG, "[EDR] getRemoteAddress: j_str_address is null");
return NULL;
}
CANetworkChangeCallback networkStateChangeCallback,
u_thread_pool_t handle)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Input validation
VERIFY_NON_NULL(registerCallback, EDR_ADAPTER_TAG, "register callback is NULL");
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAStartEDR(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
//Start Monitoring EDR Network
CAResult_t ret = CAEDRStartNetworkMonitor();
bool adapterState = false;
if (CA_STATUS_OK != CAEDRGetAdapterEnableState(&adapterState))
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to get adapter enable state");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to get adapter enable state");
return CA_STATUS_FAILED;
}
if (false == adapterState)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Bluetooth adapter is disabled!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Bluetooth adapter is disabled!");
g_adapterState = false;
return CA_STATUS_OK;
}
ret);
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return ret;
}
CAResult_t CAStartEDRListeningServer(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
return CAStartServer();
}
CAResult_t CAStartEDRDiscoveryServer(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
return CAStartServer();
}
int32_t CASendEDRUnicastData(const CARemoteEndpoint_t *remoteEndpoint, const void *data,
uint32_t dataLength)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
CAResult_t err = CA_STATUS_OK;
if (0 == strlen(remoteEndpoint->addressInfo.BT.btMacAddress))
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Invalid input: EDR Address is empty!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: EDR Address is empty!");
return -1;
}
if (0 == dataLength)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Invalid input: data length is zero!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: data length is zero!");
return -1;
}
return -1;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return sentLength;
}
int32_t CASendEDRMulticastData(const void *data, uint32_t dataLength)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN - CASendEDRMulticastData");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN - CASendEDRMulticastData");
CAResult_t err = CA_STATUS_OK;
if (0 == dataLength)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Invalid input: data length is zero!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: data length is zero!");
return -1;
}
return -1;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT - CASendEDRMulticastData");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT - CASendEDRMulticastData");
return sentLen;
}
CAResult_t CAGetEDRInterfaceInformation(CALocalConnectivity_t **info, uint32_t *size)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
VERIFY_NON_NULL(info, EDR_ADAPTER_TAG, "LocalConnectivity info is null");
}
*size = 1;
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return err;
}
CAResult_t CAReadEDRData(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
return CAEDRManagerReadData();
}
CAResult_t CAStopEDR(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Stop RFComm server if it is running
if (-1 != g_serverId)
// Stop Send and receive Queue
CAAdapterStopQueue();
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
void CATerminateEDR(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Terminate EDR Network Monitor
CAEDRTerminateNetworkMonitor();
CAAdapterFreeLocalEndpoint(g_localConnectivity);
g_localConnectivity = NULL;
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
CAResult_t CAStartServer(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
CAResult_t err = CA_STATUS_OK;
if (false == g_adapterState)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Bluetooth adapter is disabled!");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Bluetooth adapter is disabled!");
// Setting g_serverState for starting Rfcommserver when adapter starts
g_serverState = TRUE;
return CA_STATUS_OK;
if (-1 < g_serverId)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Server is already in running state.");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Server is already in running state.");
return CA_STATUS_OK;
}
return err;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return err;
}
CAResult_t CAEDRInitializeQueueHandlers(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
if (CA_STATUS_OK == CAEDRInitializeSendHandler()
&& CA_STATUS_OK == CAEDRInitializeReceiveHandler())
return CA_STATUS_OK;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_FAILED;
}
CAResult_t CAEDRInitializeSendHandler(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Check if the message queue is already initialized
if (g_sendQueueHandle)
{
CAResult_t CAEDRInitializeReceiveHandler(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Check if the message queue is already initialized
if (g_recvQueueHandle)
{
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
void CAAdapterTerminateQueues(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
if (g_sendQueueHandle)
{
g_recvQueueHandle = NULL;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
void CAAdapterDataSendHandler(void *context)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN - CAAdapterDataSendHandler");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN - CAAdapterDataSendHandler");
CAEDRData *message = (CAEDRData *) context;
if (message == NULL)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to get message!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to get message!");
return;
}
if(NULL == message->remoteEndpoint)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "remoteEndpoint is not available");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "remoteEndpoint is not available");
}
remoteAddress = message->remoteEndpoint->addressInfo.BT.btMacAddress;
if (CA_STATUS_OK != CAEDRClientSendData(remoteAddress, serviceUUID,
dataSegment, length, &sentLength))
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "CAEDRClientSendData API failed");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "CAEDRClientSendData API failed");
OICFree(dataSegment);
return;
}
message->data + ((index * CA_SUPPORTED_BLE_MTU_SIZE) - CA_HEADER_LENGTH),
CA_SUPPORTED_BLE_MTU_SIZE, &sentLength))
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "CAEDRClientSendData API failed");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "CAEDRClientSendData API failed");
return;
}
}
message->data + (index * CA_SUPPORTED_BLE_MTU_SIZE) - CA_HEADER_LENGTH,
message->dataLen % CA_SUPPORTED_BLE_MTU_SIZE + CA_HEADER_LENGTH, &sentLength))
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "CAEDRClientSendData API failed");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "CAEDRClientSendData API failed");
return;
}
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
CAResult_t CAEDRClientSendData(const char *remoteAddress, const char *serviceUUID,
if (CA_STATUS_OK != CAEDRClientSendUnicastData(remoteAddress, serviceUUID,
data, dataLength, sentLength))
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to send unicast data !");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to send unicast data !");
return CA_STATUS_FAILED;
}
}
if (CA_STATUS_OK != CAEDRClientSendMulticastData(serviceUUID, data,
dataLength, sentLength))
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to send multicast data !");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to send multicast data !");
return CA_STATUS_FAILED;
}
}
void CAAdapterDataReceiverHandler(void *context)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN_CAAdapterDataReceiverHandler");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN_CAAdapterDataReceiverHandler");
CAEDRData *message = (CAEDRData *) context;
if (message == NULL)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to get message!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to get message!");
return;
}
totalDataLen = CAParseHeader((char*)message->data);
if (totalDataLen == 0)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "totalDataLen is zero");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "totalDataLen is zero");
return;
}
defragData = (char *) OICMalloc(sizeof(char) * totalDataLen);
if (!defragData)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "defragData is null");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "defragData is null");
return;
}
if (totalDataLen == recvDataLen)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Sending data up !");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Sending data up !");
g_networkPacketReceivedCallback(remoteEndpoint, defragData, recvDataLen);
recvDataLen = 0;
totalDataLen = 0;
g_isHeaderAvailable = false;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT_CAAdapterDataReceiverHandler");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT_CAAdapterDataReceiverHandler");
}
CAResult_t CAAdapterStartQueue()
void CAAdapterRecvData(const char *remoteAddress, const void *data,
uint32_t dataLength, uint32_t *sentLength)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
if (false == g_adapterState)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Bluetooth adapter is disabled!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Bluetooth adapter is disabled!");
*sentLength = 0;
return;
}
serviceUUID);
if (NULL == remoteEndpoint)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to create remote endpoint !");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to create remote endpoint !");
return;
}
// Free remote endpoint
CAAdapterFreeRemoteEndpoint(remoteEndpoint);
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return;
}
CAResult_t CAAdapterSendData(const char *remoteAddress, const char *serviceUUID,
const void *data, uint32_t dataLength, uint32_t *sentLength)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN - CAAdapterSendData");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN - CAAdapterSendData");
if (false == g_adapterState)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Bluetooth adapter is disabled!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Bluetooth adapter is disabled!");
*sentLength = 0;
return CA_STATUS_OK;
}
serviceUUID);
if (NULL == remoteEndpoint)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to create remote endpoint !");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to create remote endpoint !");
return CA_STATUS_FAILED;
}
// Free remote endpoint
CAAdapterFreeRemoteEndpoint(remoteEndpoint);
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT - CAAdapterSendData");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT - CAAdapterSendData");
return CA_STATUS_OK;
}
void CAEDRNotifyNetworkStatus(CANetworkStatus_t status)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Create localconnectivity
if (NULL == g_localConnectivity)
bool adapterState = false;
if (CA_STATUS_OK != CAEDRGetAdapterEnableState(&adapterState))
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to get adapter enable state");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to get adapter enable state");
return;
}
if (false== adapterState)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Bluetooth adapter is disabled!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Bluetooth adapter is disabled!");
g_adapterState = false;
return;
}
if (CA_STATUS_OK != u_thread_pool_add_task(g_edrThreadPool, CAEDROnNetworkStatusChanged,
event))
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to create threadpool!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to create threadpool!");
return;
}
}
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
void CAEDROnNetworkStatusChanged(void *context)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
if (NULL == context)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "context is NULL!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "context is NULL!");
return;
}
// Free the created Network event
CAEDRFreeNetworkEvent(networkEvent);
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
CAEDRNetworkEvent *CAEDRCreateNetworkEvent(CALocalConnectivity_t *connectivity,
CAEDRNetworkEvent *event = (CAEDRNetworkEvent *) OICMalloc(sizeof(CAEDRNetworkEvent));
if (NULL == event)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to allocate memory to network event!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to allocate memory to network event!");
return NULL;
}
CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback,
u_thread_pool_t handle)
{
- OIC_LOG_V(DEBUG, TAG, "CAInitializeEDR");
+ OIC_LOG(DEBUG, TAG, "CAInitializeEDR");
g_edrReceivedCallback = reqRespCallback;
g_threadPoolHandle = handle;
CAResult_t CAStartEDR()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartEDR");
+ OIC_LOG(DEBUG, TAG, "CAStartEDR");
return CA_STATUS_OK;
}
CAResult_t CAStartEDRListeningServer()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartEDRListeningServer");
+ OIC_LOG(DEBUG, TAG, "CAStartEDRListeningServer");
return CA_STATUS_OK;
}
CAResult_t CAStartEDRDiscoveryServer()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartEDRDiscoveryServer");
+ OIC_LOG(DEBUG, TAG, "CAStartEDRDiscoveryServer");
return CA_STATUS_OK;
}
int32_t CASendEDRUnicastData(const CARemoteEndpoint_t *endpoint, const void *data,
uint32_t dataLen)
{
- OIC_LOG_V(DEBUG, TAG, "CASendEDRUnicastData");
+ OIC_LOG(DEBUG, TAG, "CASendEDRUnicastData");
return -1;
}
int32_t CASendEDRMulticastData(const void *data, uint32_t dataLen)
{
- OIC_LOG_V(DEBUG, TAG, "CASendEDRMulticastData");
+ OIC_LOG(DEBUG, TAG, "CASendEDRMulticastData");
return -1;
}
CAResult_t CAGetEDRInterfaceInformation(CALocalConnectivity_t **info, uint32_t *size)
{
- OIC_LOG_V(DEBUG, TAG, "CAGetEDRInterfaceInformation");
+ OIC_LOG(DEBUG, TAG, "CAGetEDRInterfaceInformation");
return CA_STATUS_OK;
}
CAResult_t CAReadEDRData()
{
- OIC_LOG_V(DEBUG, TAG, "Read EDR Data");
+ OIC_LOG(DEBUG, TAG, "Read EDR Data");
return CA_STATUS_OK;
}
CAResult_t CAStopEDR()
{
- OIC_LOG_V(DEBUG, TAG, "CAStopEDR");
+ OIC_LOG(DEBUG, TAG, "CAStopEDR");
return CA_STATUS_OK;
}
void CATerminateEDR()
{
- OIC_LOG_V(DEBUG, TAG, "CATerminateEDR");
+ OIC_LOG(DEBUG, TAG, "CATerminateEDR");
}
void CAEDRSocketConnectionStateCallback(int result, bt_socket_connection_state_e state,
bt_socket_connection_s *connection, void *userData)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
EDRDevice *device = NULL;
if(!device)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "EDRDevice is null!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "EDRDevice is null!");
u_mutex_unlock(g_edrDeviceListMutex);
return;
}
if(!device)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "EDRDevice is null!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "EDRDevice is null!");
u_mutex_unlock(g_edrDeviceListMutex);
return;
}
break;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
void CAEDRDeviceDiscoveryCallback(int result, bt_adapter_device_discovery_state_e state,
bt_adapter_device_discovery_info_s *discoveryInfo, void *userData)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
EDRDevice *device = NULL;
{
case BT_ADAPTER_DEVICE_DISCOVERY_STARTED:
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Discovery started!");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Discovery started!");
}
break;
case BT_ADAPTER_DEVICE_DISCOVERY_FINISHED:
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Discovery finished!");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Discovery finished!");
}
break;
{
if(!device)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "EDRDevice is null!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "EDRDevice is null!");
u_mutex_unlock(g_edrDeviceListMutex);
return;
}
discoveryInfo->remote_address, OIC_EDR_SERVICE_ID, &device);
if (CA_STATUS_OK != res)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to add device to list!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to add device to list!");
u_mutex_unlock(g_edrDeviceListMutex);
return;
}
if(!device)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "EDRDevice is null!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "EDRDevice is null!");
u_mutex_unlock(g_edrDeviceListMutex);
return;
}
}
else
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Device does not support OIC service!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Device does not support OIC service!");
}
}
break;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
void CAEDRServiceSearchedCallback(int32_t result,
bt_device_sdp_info_s *sdpInfo,void *userData)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
if (NULL == sdpInfo)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "SDP info is null!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "SDP info is null!");
return;
}
{
if (device->serviceSearched)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Service is already searched for this device!");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Service is already searched for this device!");
u_mutex_unlock(g_edrDeviceListMutex);
return;
}
res = CAEDRClientConnect(sdpInfo->remote_address, OIC_EDR_SERVICE_ID);
if (CA_STATUS_OK != res)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to make rfcomm connection!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to make rfcomm connection!");
// Remove the device from device list
CARemoveEDRDeviceFromList(&g_edrDeviceList, sdpInfo->remote_address);
}
else
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Device does not contain OIC service!");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Device does not contain OIC service!");
// Remove device from list as it does not support OIC service
CARemoveEDRDeviceFromList(&g_edrDeviceList, sdpInfo->remote_address);
u_mutex_unlock(g_edrDeviceListMutex);
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
CAResult_t CAEDRStartDeviceDiscovery(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
bool isDiscoveryStarted = false;
}
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRStopServiceSearch(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
bt_error_e err = bt_device_cancel_service_search();
// Stop ongoing service search
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRStopDeviceDiscovery(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
bool isDiscoveryStarted = false;
bt_error_e err = bt_adapter_is_discovering(&isDiscoveryStarted);
//stop the device discovery process
if (true == isDiscoveryStarted)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Stopping the device search process");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Stopping the device search process");
if (BT_ERROR_NONE != (err = bt_adapter_stop_device_discovery()))
{
OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to stop discovery!, error num [%x]",
}
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRStartServiceSearch(const char *remoteAddress)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Input validation
VERIFY_NON_NULL(remoteAddress, EDR_ADAPTER_TAG, "Remote address is null");
if (!remoteAddress[0])
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Remote address is empty!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Remote address is empty!");
return CA_STATUS_INVALID_PARAM;
}
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRClientSetCallbacks(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Register for discovery and rfcomm socket connection callbacks
bt_adapter_set_device_discovery_state_changed_cb(CAEDRDeviceDiscoveryCallback, NULL);
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
void CAEDRClientUnsetCallbacks(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Stop service search
CAEDRStopServiceSearch();
CAEDRStopDeviceDiscovery();
// reset bluetooth adapter callbacks
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Resetting the callbacks");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Resetting the callbacks");
bt_adapter_unset_device_discovery_state_changed_cb();
bt_device_unset_service_searched_cb();
bt_socket_unset_connection_state_changed_cb();
bt_socket_unset_data_received_cb();
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
void CAEDRManagerInitializeMutex(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
if (!g_edrDeviceListMutex)
{
g_edrDeviceListMutex = u_mutex_new();
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
void CAEDRManagerTerminateMutex(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
if (g_edrDeviceListMutex)
{
g_edrDeviceListMutex = NULL;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
void CAEDRInitializeClient(u_thread_pool_t handle)
void CAEDRClientDisconnectAll(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
u_mutex_lock(g_edrDeviceListMutex);
u_mutex_unlock(g_edrDeviceListMutex);
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress, const char *serviceUUID,
const void *data, uint32_t dataLength, uint32_t *sentLength)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
EDRDevice *device = NULL;
if (0 >= dataLength)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Invalid input: Negative data length!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: Negative data length!");
return CA_STATUS_INVALID_PARAM;
}
OIC_EDR_SERVICE_ID, &device);
if (CA_STATUS_OK != result)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed create device and add to list!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed create device and add to list!");
u_mutex_unlock(g_edrDeviceListMutex);
return CA_STATUS_FAILED;
result = CAEDRStartServiceSearch(remoteAddress);
if (CA_STATUS_OK != result)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to initiate service search!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to initiate service search!");
// Remove device from list
CARemoveEDRDeviceFromList(&g_edrDeviceList, remoteAddress);
if(!device)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "EDRDevice is null!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "EDRDevice is null!");
// Remove device from list
CARemoveEDRDeviceFromList(&g_edrDeviceList, remoteAddress);
dataLength);
if (CA_STATUS_OK != result)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to add data to pending list!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to add data to pending list!");
//Remove device from list
CARemoveEDRDeviceFromList(&g_edrDeviceList, remoteAddress);
if (device->serviceSearched &&
CA_STATUS_OK != CAEDRClientConnect(remoteAddress, serviceUUID))
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to make RFCOMM connection!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to make RFCOMM connection!");
//Remove device from list
CARemoveEDRDeviceFromList(&g_edrDeviceList, remoteAddress);
result = CAEDRSendData(device->socketFD, data, dataLength, sentLength);
if (CA_STATUS_OK != result)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to send data!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to send data!");
return CA_STATUS_FAILED;
}
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRClientSendMulticastData(const char *serviceUUID, const void *data,
uint32_t dataLength, uint32_t *sentLength)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Input validation
VERIFY_NON_NULL(serviceUUID, EDR_ADAPTER_TAG, "service UUID is null");
if (0 >= dataLength)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Invalid input: Negative data length!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: Negative data length!");
return CA_STATUS_INVALID_PARAM;
}
if (!device)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "There is no device!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "There is no device!");
break;
}
if (-1 == device->socketFD)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN1");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN1");
// Check if the device service search is finished
if (false == device->serviceSearched)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Device services are still unknown!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Device services are still unknown!");
continue;
}
dataLength);
if (CA_STATUS_OK != result)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to add data to pending list !");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to add data to pending list !");
continue;
}
result = CAEDRClientConnect(device->remoteAddress, device->serviceUUID);
if (CA_STATUS_OK != result)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to make RFCOMM connection !");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to make RFCOMM connection !");
//Remove the data which added to pending list
CARemoveEDRDataFromList(&device->pendingDataList);
continue;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN2");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN2");
}
else
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN3");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN3");
result = CAEDRSendData(device->socketFD, data, dataLength, sentLength);
if (CA_STATUS_OK != result)
{
OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to send data to [%s] !",
device->remoteAddress);
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN4");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN4");
}
}
u_mutex_unlock(g_edrDeviceListMutex);
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRClientConnect(const char *remoteAddress, const char *serviceUUID)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
VERIFY_NON_NULL(remoteAddress, EDR_ADAPTER_TAG, "Remote address is null");
VERIFY_NON_NULL(serviceUUID, EDR_ADAPTER_TAG, "Service UUID is null");
size_t addressLen = strlen(remoteAddress);
if (0 == addressLen || CA_MACADDR_SIZE - 1 != addressLen)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Invalid input: Invalid remote address");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: Invalid remote address");
return CA_STATUS_INVALID_PARAM;
}
if (!serviceUUID[0])
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Invalid input: Empty service uuid");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: Empty service uuid");
return CA_STATUS_INVALID_PARAM;
}
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRClientDisconnect(const int32_t clientID)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Input validation
if (0 > clientID)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Invalid input: negative client id");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: negative client id");
return CA_STATUS_INVALID_PARAM;
}
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
void CAEDRDataRecvCallback(bt_socket_received_data_s *data, void *userData)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
EDRDevice *device = NULL;
if (NULL == data || 0 >= data->data_size)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Data is null!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Data is null!");
return;
}
CAResult_t result = CAGetEDRDeviceBySocketId(g_edrDeviceList, data->socket_fd, &device);
if (CA_STATUS_OK != result)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Could not find the device!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Could not find the device!");
u_mutex_unlock(g_edrDeviceListMutex);
return;
if (!device)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "There is no device!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "There is no device!");
return;
}
g_edrPacketReceivedCallback(device->remoteAddress, data->data,
(uint32_t)data->data_size, &sentLength);
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
*device = (EDRDevice *) OICMalloc(sizeof(EDRDevice));
if (NULL == *device)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Out of memory (device)!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Out of memory (device)!");
return CA_MEMORY_ALLOC_FAILED;
}
EDRDeviceList *node = (EDRDeviceList *) OICMalloc(sizeof(EDRDeviceList));
if (NULL == node)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Out of memory (device list)!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Out of memory (device list)!");
return CA_MEMORY_ALLOC_FAILED;
}
CAResult_t CARemoveEDRDataFromList(EDRDataList **dataList)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
VERIFY_NON_NULL(dataList, EDR_ADAPTER_TAG, "Data list is null");
OICFree(curNode);
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
void CADestroyEDRDataList(EDRDataList **dataList)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
VERIFY_NON_NULL_VOID(dataList, EDR_ADAPTER_TAG, "Data list is null");
*dataList = NULL;
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
void CADestroyEDRData(EDRData *data)
CAResult_t CAEDRSendData(int serverFD, const void *data, uint32_t dataLength,
uint32_t *sentDataLen)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
VERIFY_NON_NULL(data, EDR_ADAPTER_TAG, "Data is null");
VERIFY_NON_NULL(sentDataLen, EDR_ADAPTER_TAG, "Sent data length holder is null");
if (0 > serverFD)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Invalid input: Negative socket id");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: Negative socket id");
return CA_STATUS_INVALID_PARAM;
}
}
*sentDataLen = dataLen;
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRInitializeNetworkMonitor()
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Initialize Bluetooth service
int err = bt_initialize();
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
void CAEDRTerminateNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
g_edrNetworkChangeCallback = NULL;
// Terminate Bluetooth service
bt_deinitialize();
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
CAResult_t CAEDRStartNetworkMonitor()
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
int ret = bt_adapter_set_state_changed_cb(CAEDRAdapterStateChangeCallback, NULL);
if(BT_ERROR_NONE != ret)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "bt_adapter_set_state_changed_cb failed");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "bt_adapter_set_state_changed_cb failed");
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRStopNetworkMonitor()
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Unset bluetooth adapter callbacks
int ret = bt_adapter_unset_state_changed_cb();
if(BT_ERROR_NONE != ret)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "bt_adapter_set_state_changed_cb failed");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "bt_adapter_set_state_changed_cb failed");
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRGetInterfaceInformation(CALocalConnectivity_t **info)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Input validation
VERIFY_NON_NULL(info, EDR_ADAPTER_TAG, "LocalConnectivity info is null");
*info = CAAdapterCreateLocalEndpoint(CA_EDR, localAddress);
if (NULL == *info)
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to create LocalConnectivity instance!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to create LocalConnectivity instance!");
OICFree(localAddress);
return CA_MEMORY_ALLOC_FAILED;
OICFree(localAddress);
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRGetAdapterEnableState(bool *state)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
// Input validation
VERIFY_NON_NULL(state, EDR_ADAPTER_TAG, "state holder is NULL!");
*state = true;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
void CAEDRAdapterStateChangeCallback(int result, bt_adapter_state_e adapterState,
void *userData)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
if (BT_ADAPTER_ENABLED == adapterState)
{
}
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
}
CAResult_t CAEDRServerStart(const char *serviceUUID, int *serverFD, u_thread_pool_t handle)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
VERIFY_NON_NULL(serviceUUID, EDR_ADAPTER_TAG, "Service UUID is null");
VERIFY_NON_NULL(serverFD, EDR_ADAPTER_TAG, "Server fd holder is null");
if (!serviceUUID[0])
{
- OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Invalid input: Empty service uuid!");
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Invalid input: Empty service uuid!");
return CA_STATUS_INVALID_PARAM;
}
if (isRunning)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Service is already running with this UUID!");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Service is already running with this UUID!");
return CA_SERVER_STARTED_ALREADY;
}
*serverFD = socketFD;
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRServerStop(int serverFD)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
bt_error_e err = bt_socket_destroy_rfcomm(serverFD);
if (BT_ERROR_NONE != err)
return CA_STATUS_FAILED;
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEDRManagerReadData(void)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_NOT_SUPPORTED;
}
bool CAEDRIsServiceSupported(const char **serviceUUID, int32_t serviceCount,
const char *matchService)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
if (NULL == serviceUUID || 0 == serviceCount || NULL == matchService)
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Invalid input");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Invalid input");
return false;
}
{
if (!strcasecmp(serviceUUID[i], matchService))
{
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "Service found !");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "Service found !");
return true;
}
}
- OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return false;
}
CALocalConnectivity_t *localEndpoint = CAAdapterCreateLocalEndpoint(CA_LE, address);
if (!localEndpoint)
{
- OIC_LOG_V(ERROR, TAG, "Out of memory");
+ OIC_LOG(ERROR, TAG, "Out of memory");
return;
}
CAResult_t CAStartLE()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartLE");
+ OIC_LOG(DEBUG, TAG, "CAStartLE");
//CANativeLEStartScan();
return CA_STATUS_OK;
CAResult_t CAStartLEListeningServer()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartLEListeningServer");
+ OIC_LOG(DEBUG, TAG, "CAStartLEListeningServer");
g_isBluetoothGattServer = JNI_TRUE;
CAResult_t CAStartLEDiscoveryServer()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartLEDiscoveryServer");
+ OIC_LOG(DEBUG, TAG, "CAStartLEDiscoveryServer");
g_isBluetoothGattServer = JNI_FALSE;
if (g_isBluetoothGattServer == JNI_FALSE)
{
- OIC_LOG_V(DEBUG, TAG, "CALESendUnicastData");
+ OIC_LOG(DEBUG, TAG, "CALESendUnicastData");
CALESendUnicastMessage(endpoint->addressInfo.BT.btMacAddress, data, dataLen);
}
else
{
- OIC_LOG_V(DEBUG, TAG, "CALEServerSendUnicastData");
+ OIC_LOG(DEBUG, TAG, "CALEServerSendUnicastData");
CALEServerSendUnicastMessage(endpoint->addressInfo.BT.btMacAddress, data, dataLen);
}
{
if (g_isBluetoothGattServer == JNI_FALSE)
{
- OIC_LOG_V(DEBUG, TAG, "CASendLEMulticastData");
+ OIC_LOG(DEBUG, TAG, "CASendLEMulticastData");
CALESendMulticastMessage(data, dataLen);
}
else
{
- OIC_LOG_V(DEBUG, TAG, "CALEServerSendMulticastMessage");
+ OIC_LOG(DEBUG, TAG, "CALEServerSendMulticastMessage");
CALEServerSendMulticastMessage(data, dataLen);
}
CAResult_t CAStartLENotifyServer()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartLENotifyServer");
+ OIC_LOG(DEBUG, TAG, "CAStartLENotifyServer");
return CA_STATUS_OK;
}
{
if (g_isBluetoothGattServer == JNI_FALSE)
{
- OIC_LOG_V(DEBUG, TAG, "not server mode");
+ OIC_LOG(DEBUG, TAG, "not server mode");
return -1;
}
else
{
- OIC_LOG_V(DEBUG, TAG, "CALEServerSendLEUnicastData");
+ OIC_LOG(DEBUG, TAG, "CALEServerSendLEUnicastData");
CALEServerSendUnicastMessage(endpoint->addressInfo.BT.btMacAddress, data, dataLen);
}
CAResult_t CAGetLEInterfaceInformation(CALocalConnectivity_t** info, uint32_t* size)
{
- OIC_LOG_V(DEBUG, TAG, "CAGetLEInterfaceInformation");
+ OIC_LOG(DEBUG, TAG, "CAGetLEInterfaceInformation");
CALocalConnectivity_t *netInfo = NULL;
netInfo = (CALocalConnectivity_t *) OICMalloc(sizeof(CALocalConnectivity_t) * netInfoSize);
if (NULL == netInfo)
{
- OIC_LOG_V(ERROR, TAG, "Invalid input..");
+ OIC_LOG(ERROR, TAG, "Invalid input..");
return CA_MEMORY_ALLOC_FAILED;
}
memset(netInfo, 0, sizeof(CALocalConnectivity_t) * netInfoSize);
CAResult_t CAReadLEData()
{
- OIC_LOG_V(DEBUG, TAG, "Read LE Data");
+ OIC_LOG(DEBUG, TAG, "Read LE Data");
return CA_STATUS_OK;
}
if (g_isBluetoothGattServer == JNI_FALSE)
{
- OIC_LOG_V(DEBUG, TAG, "CA Stop LE Scan");
+ OIC_LOG(DEBUG, TAG, "CA Stop LE Scan");
CANativeLEStopScan();
}
else
{
- OIC_LOG_V(DEBUG, TAG, "CA Stop Gatt Server");
+ OIC_LOG(DEBUG, TAG, "CA Stop Gatt Server");
}
return CA_STATUS_OK;
{
if (g_isBluetoothGattServer == JNI_FALSE)
{
- OIC_LOG_V(DEBUG, TAG, "Terminat Gatt Client");
+ OIC_LOG(DEBUG, TAG, "Terminat Gatt Client");
CALETerminate();
}
else
{
- OIC_LOG_V(DEBUG, TAG, "Terminat Gatt Server");
+ OIC_LOG(DEBUG, TAG, "Terminat Gatt Server");
CALEServerTerminate();
}
}
//FIXME getting context
void CALEClientJNISetContext(JNIEnv *env, jobject context)
{
- OIC_LOG_V(DEBUG, TAG, "CALEClientJNISetContext");
+ OIC_LOG(DEBUG, TAG, "CALEClientJNISetContext");
if (context == NULL)
{
- OIC_LOG_V(ERROR, TAG, "context is null");
+ OIC_LOG(ERROR, TAG, "context is null");
return;
}
void CALeCreateJniInterfaceObject()
{
- OIC_LOG_V(DEBUG, TAG, "CALeCreateJniInterfaceObject");
+ OIC_LOG(DEBUG, TAG, "CALeCreateJniInterfaceObject");
jboolean isAttached = JNI_FALSE;
JNIEnv* env;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
jclass LeJniInterface = (*env)->FindClass(env, "com/iotivity/jar/CALeInterface");
if (!LeJniInterface)
{
- OIC_LOG_V(DEBUG, TAG, "Could not get CALeInterface class");
+ OIC_LOG(DEBUG, TAG, "Could not get CALeInterface class");
return;
}
"(Landroid/content/Context;)V");
if (!LeInterfaceConstructorMethod)
{
- OIC_LOG_V(DEBUG, TAG, "Could not get CALeInterface constructor method");
+ OIC_LOG(DEBUG, TAG, "Could not get CALeInterface constructor method");
return;
}
(*env)->NewObject(env, LeJniInterface, LeInterfaceConstructorMethod, g_context);
- OIC_LOG_V(DEBUG, TAG, "Create CALeInterface instance");
+ OIC_LOG(DEBUG, TAG, "Create CALeInterface instance");
if (isAttached)
{
JNIEXPORT jint JNI_OnLoad(JavaVM *jvm, void *reserved)
{
- OIC_LOG_V(DEBUG, TAG, "JNI_OnLoad in calecore");
+ OIC_LOG(DEBUG, TAG, "JNI_OnLoad in calecore");
JNIEnv* env;
if ((*jvm)->GetEnv(jvm, (void**) &env, JNI_VERSION_1_6) != JNI_OK)
void JNI_OnUnload(JavaVM *jvm, void *reserved)
{
- OIC_LOG_V(DEBUG, TAG, "JNI_OnUnload in calecore");
+ OIC_LOG(DEBUG, TAG, "JNI_OnUnload in calecore");
JNIEnv* env;
if ((*jvm)->GetEnv(jvm, (void**) &env, JNI_VERSION_1_6) != JNI_OK)
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
void CANativeSendFinish(JNIEnv *env, jobject gatt)
{
- OIC_LOG_V(DEBUG, TAG, "CANativeSendFinish");
+ OIC_LOG(DEBUG, TAG, "CANativeSendFinish");
if (gatt)
{
CAResult_t CALEStartMulticastServer()
{
- OIC_LOG_V(DEBUG, TAG, "CALEStartMulticastServer");
+ OIC_LOG(DEBUG, TAG, "CALEStartMulticastServer");
if (g_isStartServer)
{
- OIC_LOG_V(ERROR, TAG, "server is already started..it will be skipped");
+ OIC_LOG(ERROR, TAG, "server is already started..it will be skipped");
return CA_STATUS_FAILED;
}
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return CA_STATUS_FAILED;
}
isAttached = JNI_TRUE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return CA_STATUS_FAILED;
}
isAttached = JNI_TRUE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return CA_STATUS_FAILED;
}
isAttached = JNI_TRUE;
{
if (!g_isStartServer)
{
- OIC_LOG_V(DEBUG, TAG, "server is not started yet..scan will be passed");
+ OIC_LOG(DEBUG, TAG, "server is not started yet..scan will be passed");
return;
}
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return;
}
isAttached = TRUE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return;
}
isAttached = TRUE;
void CANativeLEDisconnectAll(JNIEnv *env)
{
- OIC_LOG_V(DEBUG, TAG, "CANativeLEDisconnectAll");
+ OIC_LOG(DEBUG, TAG, "CANativeLEDisconnectAll");
if (!g_gattObjectList)
{
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return;
}
isAttached = TRUE;
// create new object array
if (g_deviceList == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "Create device list");
+ OIC_LOG(DEBUG, TAG, "Create device list");
g_deviceList = u_arraylist_create();
}
{
jobject gdevice = (*env)->NewGlobalRef(env, device);
u_arraylist_add(g_deviceList, gdevice);
- OIC_LOG_V(DEBUG, TAG, "Set Object to Array as Element");
+ OIC_LOG(DEBUG, TAG, "Set Object to Array as Element");
}
}
if (!strcmp(remoteAddress, setAddress))
{
- OIC_LOG_V(DEBUG, TAG, "the device is already set");
+ OIC_LOG(DEBUG, TAG, "the device is already set");
return TRUE;
}
}
- OIC_LOG_V(DEBUG, TAG, "there are no the device in list. we can add");
+ OIC_LOG(DEBUG, TAG, "there are no the device in list. we can add");
return FALSE;
}
void CANativeRemoveAllDevices(JNIEnv *env)
{
- OIC_LOG_V(DEBUG, TAG, "CANativeRemoveAllDevices");
+ OIC_LOG(DEBUG, TAG, "CANativeRemoveAllDevices");
if (!g_deviceList)
{
void CANativeRemoveDevice(JNIEnv *env, jstring address)
{
- OIC_LOG_V(DEBUG, TAG, "CANativeRemoveDevice");
+ OIC_LOG(DEBUG, TAG, "CANativeRemoveDevice");
if (!g_deviceList)
{
// create new object array
if (g_gattObjectList == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "Create Gatt object list");
+ OIC_LOG(DEBUG, TAG, "Create Gatt object list");
g_gattObjectList = u_arraylist_create();
}
{
jobject gGatt = (*env)->NewGlobalRef(env, gatt);
u_arraylist_add(g_gattObjectList, gGatt);
- OIC_LOG_V(DEBUG, TAG, "Set Object to Array as Element");
+ OIC_LOG(DEBUG, TAG, "Set Object to Array as Element");
}
}
if (!strcmp(remoteAddress, setAddress))
{
- OIC_LOG_V(DEBUG, TAG, "the device is already set");
+ OIC_LOG(DEBUG, TAG, "the device is already set");
return TRUE;
}
else
}
}
- OIC_LOG_V(DEBUG, TAG, "there are no the gatt obejct in list. we can add");
+ OIC_LOG(DEBUG, TAG, "there are no the gatt obejct in list. we can add");
return FALSE;
}
void CANativeRemoveAllGattObjsList(JNIEnv *env)
{
- OIC_LOG_V(DEBUG, TAG, "CANativeRemoveAllGattObjsList");
+ OIC_LOG(DEBUG, TAG, "CANativeRemoveAllGattObjsList");
if (!g_gattObjectList)
{
void CANativeRemoveGattObj(JNIEnv *env, jobject gatt)
{
- OIC_LOG_V(DEBUG, TAG, "CANativeRemoveGattObj");
+ OIC_LOG(DEBUG, TAG, "CANativeRemoveGattObj");
if (!g_gattObjectList)
{
Java_com_iotivity_jar_caleinterface_CARegisterLeScanCallback(JNIEnv *env, jobject obj,
jobject callback)
{
- OIC_LOG_V(DEBUG, TAG, "CARegisterLeScanCallback");
+ OIC_LOG(DEBUG, TAG, "CARegisterLeScanCallback");
g_leScanCallback = (*env)->NewGlobalRef(env, callback);
}
Java_com_iotivity_jar_caleinterface_CARegisterLeGattCallback(JNIEnv *env, jobject obj,
jobject callback)
{
- OIC_LOG_V(DEBUG, TAG, "CARegisterLeGattCallback");
+ OIC_LOG(DEBUG, TAG, "CARegisterLeGattCallback");
g_leGattCallback = (*env)->NewGlobalRef(env, callback);
}
jobject characteristic,
jbyteArray data)
{
- OIC_LOG_V(DEBUG, TAG, "CALeGattCharacteristicChangedCallback");
+ OIC_LOG(DEBUG, TAG, "CALeGattCharacteristicChangedCallback");
// get Byte Array and covert to char*
jint length = (*env)->GetArrayLength(env, data);
char* recevicedData = (char*) OICMalloc(sizeof(char) * length);
if (NULL == recevicedData)
{
- OIC_LOG_V(ERROR, TAG, "recevicedData is null");
+ OIC_LOG(ERROR, TAG, "recevicedData is null");
CANativeSendFinish(env, gatt);
return;
//getting context
void CALENetworkMonitorJNISetContext(JNIEnv *env, jobject context)
{
- OIC_LOG_V(DEBUG, TAG, "CALENetworkMonitorJNISetContext");
+ OIC_LOG(DEBUG, TAG, "CALENetworkMonitorJNISetContext");
if (context == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "context is null");
+ OIC_LOG(DEBUG, TAG, "context is null");
}
g_context = (*env)->NewGlobalRef(env, context);
//getting jvm
void CALeNetworkMonitorJniInit(JNIEnv *env, JavaVM *jvm)
{
- OIC_LOG_V(DEBUG, TAG, "CALeNetworkMonitorJniInit");
+ OIC_LOG(DEBUG, TAG, "CALeNetworkMonitorJniInit");
g_jvm = jvm;
}
void CALESetNetStateCallback(CALENetStateChantedCallback callback)
{
- OIC_LOG_V(DEBUG, TAG, "CALESetNetStateCallback");
+ OIC_LOG(DEBUG, TAG, "CALESetNetStateCallback");
g_networkChangeCb = callback;
}
Java_com_iotivity_jar_caleinterface_CALeStateChangedCallback(JNIEnv *env, jobject obj, jint status)
{
// STATE_ON:12, STATE_OFF:10
- OIC_LOG_V(DEBUG, TAG, "CALeInterface - Network State Changed");
+ OIC_LOG(DEBUG, TAG, "CALeInterface - Network State Changed");
if (g_networkChangeCb == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "g_networkChangeCb is null", status);
+ OIC_LOG(DEBUG, TAG, "g_networkChangeCb is null", status);
}
jstring jni_address = CALEGetLocalDeviceAddress(env);
//getting context
void CALEServerJNISetContext(JNIEnv *env, jobject context)
{
- OIC_LOG_V(DEBUG, TAG, "CALEServerJNISetContext");
+ OIC_LOG(DEBUG, TAG, "CALEServerJNISetContext");
if (context == NULL)
{
- OIC_LOG_V(ERROR, TAG, "context is null");
+ OIC_LOG(ERROR, TAG, "context is null");
}
g_context = (*env)->NewGlobalRef(env, context);
//getting jvm
void CALeServerJniInit(JNIEnv *env, JavaVM *jvm)
{
- OIC_LOG_V(DEBUG, TAG, "CALeServerJniInit");
+ OIC_LOG(DEBUG, TAG, "CALeServerJniInit");
g_jvm = jvm;
}
return NULL;
}
- OIC_LOG_V(DEBUG, TAG, "CALEServerSetResponseData");
+ OIC_LOG(DEBUG, TAG, "CALEServerSetResponseData");
jclass jni_cid_bluetoothGattServer = (*env)->FindClass(env,
"android/bluetooth/BluetoothGattServer");
if (!g_bluetoothGattServer)
{
- OIC_LOG_V(ERROR, TAG, "Check BluetoothGattServer status");
+ OIC_LOG(ERROR, TAG, "Check BluetoothGattServer status");
return NULL;
}
jobject jni_obj_bluetoothGattService = (*env)->CallObjectMethod(env, g_bluetoothGattServer,
if (jni_boolean_setValue == JNI_FALSE)
{
- OIC_LOG_V(ERROR, TAG, "Fail to set response data");
+ OIC_LOG(ERROR, TAG, "Fail to set response data");
}
return jni_obj_bluetoothGattCharacteristic;
return CA_ADAPTER_NOT_ENABLED;
}
- OIC_LOG_V(DEBUG, TAG, "CALEServerSendResponseData");
+ OIC_LOG(DEBUG, TAG, "CALEServerSendResponseData");
jclass jni_cid_bluetoothGattServer = (*env)->FindClass(env,
"android/bluetooth/BluetoothGattServer");
if (jni_boolean_notifyCharacteristicChanged == JNI_FALSE)
{
- OIC_LOG_V(ERROR, TAG, "Fail to notify characteristic");
+ OIC_LOG(ERROR, TAG, "Fail to notify characteristic");
return CA_SEND_FAILED;
}
return CA_ADAPTER_NOT_ENABLED;
}
- OIC_LOG_V(DEBUG, TAG, "CALEServerSendResponse");
+ OIC_LOG(DEBUG, TAG, "CALEServerSendResponse");
jclass jni_cid_bluetoothGattServer = (*env)->FindClass(env,
"android/bluetooth/BluetoothGattServer");
if (jni_boolean_sendResponse == JNI_FALSE)
{
- OIC_LOG_V(ERROR, TAG, "Fail to send response for gatt characteristic write request");
+ OIC_LOG(ERROR, TAG, "Fail to send response for gatt characteristic write request");
return CA_SEND_FAILED;
}
void CANativeLEServerStartAdvertise(JNIEnv *env, jobject advertiseCallback)
{
- OIC_LOG_V(DEBUG, TAG, "LEServerStartAdvertise");
+ OIC_LOG(DEBUG, TAG, "LEServerStartAdvertise");
if (!CALEIsEnableBTAdapter(env))
{
jni_obj_build_LeAdvertiseSettings, jni_obj_build_LeAdvertiseData,
advertiseCallback);
- OIC_LOG_V(DEBUG, TAG, "Advertising started!!");
+ OIC_LOG(DEBUG, TAG, "Advertising started!!");
}
void CANativeLEServerStopAdvertise(JNIEnv *env, jobject advertiseCallback)
{
- OIC_LOG_V(DEBUG, TAG, "LEServerStopAdvertise");
+ OIC_LOG(DEBUG, TAG, "LEServerStopAdvertise");
if (!CALEIsEnableBTAdapter(env))
{
(*env)->CallVoidMethod(env, jni_obj_getBluetoothLeAdvertiser, jni_mid_stopAdvertising,
advertiseCallback);
- OIC_LOG_V(DEBUG, TAG, "Advertising stopped!!");
+ OIC_LOG(DEBUG, TAG, "Advertising stopped!!");
}
CAResult_t CALEStartGattServer(JNIEnv *env, jobject gattServerCallback)
{
- OIC_LOG_V(DEBUG, TAG, "CALEStartGattServer");
+ OIC_LOG(DEBUG, TAG, "CALEStartGattServer");
if (!CALEIsEnableBTAdapter(env))
{
if (g_isStartServer)
{
- OIC_LOG_V(DEBUG, TAG, "Gatt server already started");
+ OIC_LOG(DEBUG, TAG, "Gatt server already started");
}
g_bluetoothGattServerCallback = (*env)->NewGlobalRef(env, gattServerCallback);
jobject bluetoothGattServer = CANativeLEServerOpenGattServer(env);
if (!bluetoothGattServer)
{
- OIC_LOG_V(ERROR, TAG, "bluetoothGattServer is null");
+ OIC_LOG(ERROR, TAG, "bluetoothGattServer is null");
return CA_STATUS_FAILED;
}
jobject CANativeLEServerOpenGattServer(JNIEnv *env)
{
- OIC_LOG_V(DEBUG, TAG, "CALEServerOpenGattServer");
+ OIC_LOG(DEBUG, TAG, "CALEServerOpenGattServer");
if (!CALEIsEnableBTAdapter(env))
{
jni_fid_bluetoothService);
if (!jni_obj_bluetoothService)
{
- OIC_LOG_V(ERROR, TAG, "jni_obj_bluetoothService is null");
+ OIC_LOG(ERROR, TAG, "jni_obj_bluetoothService is null");
return JNI_FALSE;
}
jni_obj_bluetoothService);
if (!jni_obj_bluetoothManager)
{
- OIC_LOG_V(ERROR, TAG, "jni_obj_bluetoothManager is null");
+ OIC_LOG(ERROR, TAG, "jni_obj_bluetoothManager is null");
return JNI_FALSE;
}
g_bluetoothGattServerCallback);
if (!jni_obj_bluetoothGattServer)
{
- OIC_LOG_V(ERROR, TAG, "jni_obj_bluetoothGattServer is null");
+ OIC_LOG(ERROR, TAG, "jni_obj_bluetoothGattServer is null");
return JNI_FALSE;
}
jobject CANativeLEServerCreateGattService(JNIEnv *env)
{
- OIC_LOG_V(DEBUG, TAG, "CALEServerCreateGattService");
+ OIC_LOG(DEBUG, TAG, "CALEServerCreateGattService");
if (!CALEIsEnableBTAdapter(env))
{
if (jni_boolean_addWriteCharacteristic == JNI_FALSE)
{
- OIC_LOG_V(ERROR, TAG, "Fail to add jni_boolean_addReadCharacteristic");
+ OIC_LOG(ERROR, TAG, "Fail to add jni_boolean_addReadCharacteristic");
return NULL;
}
jobject bluetoothGattService)
{
- OIC_LOG_V(DEBUG, TAG, "CALEServerAddGattService");
+ OIC_LOG(DEBUG, TAG, "CALEServerAddGattService");
if (!CALEIsEnableBTAdapter(env))
{
if (jni_boolean_addService == JNI_FALSE)
{
- OIC_LOG_V(ERROR, TAG, "Fail to add gatt service");
+ OIC_LOG(ERROR, TAG, "Fail to add gatt service");
return CA_STATUS_FAILED;
}
CAResult_t CANativeLEServerConnect(JNIEnv *env, jobject bluetoothDevice)
{
- OIC_LOG_V(DEBUG, TAG, "CALEConnect");
+ OIC_LOG(DEBUG, TAG, "CALEConnect");
if (!CALEIsEnableBTAdapter(env))
{
if (jni_boolean_connect == JNI_FALSE)
{
- OIC_LOG_V(ERROR, TAG, "Fail to connect");
+ OIC_LOG(ERROR, TAG, "Fail to connect");
return CA_STATUS_FAILED;
}
void CANativeLEServerDisconnect(JNIEnv *env, jobject bluetoothDevice)
{
- OIC_LOG_V(DEBUG, TAG, "CALEDisconnect");
+ OIC_LOG(DEBUG, TAG, "CALEDisconnect");
if (!CALEIsEnableBTAdapter(env))
{
CAResult_t CALEServerSend(JNIEnv *env, jobject bluetoothDevice, jbyteArray responseData)
{
- OIC_LOG_V(DEBUG, TAG, "CALESend");
+ OIC_LOG(DEBUG, TAG, "CALESend");
if (!CALEIsEnableBTAdapter(env))
{
if (result != CA_STATUS_OK)
{
- OIC_LOG_V(ERROR, TAG, "Fail to send response data");
+ OIC_LOG(ERROR, TAG, "Fail to send response data");
return result;
}
void CALeServerCreateJniInterfaceObject()
{
- OIC_LOG_V(DEBUG, TAG, "CALeServerCreateJniInterfaceObject");
+ OIC_LOG(DEBUG, TAG, "CALeServerCreateJniInterfaceObject");
jboolean isAttached = JNI_FALSE;
JNIEnv* env;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(DEBUG, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return CA_STATUS_FAILED;
}
isAttached = JNI_TRUE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return CA_STATUS_FAILED;
}
isAttached = JNI_TRUE;
CAResult_t CALEServerStartMulticastServer()
{
- OIC_LOG_V(DEBUG, TAG, "CALEServerStartMulticastServer");
+ OIC_LOG(DEBUG, TAG, "CALEServerStartMulticastServer");
if (g_isStartServer)
{
- OIC_LOG_V(ERROR, TAG, "server is already started..it will be skipped");
+ OIC_LOG(ERROR, TAG, "server is already started..it will be skipped");
return CA_STATUS_FAILED;
}
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return CA_STATUS_FAILED;
}
isAttached = JNI_TRUE;
CAResult_t ret = CALEStartGattServer(env, g_bluetoothGattServerCallback);
if (CA_STATUS_OK != ret)
{
- OIC_LOG_V(ERROR, TAG, "Fail to start gatt server");
+ OIC_LOG(ERROR, TAG, "Fail to start gatt server");
return ret;
}
if (g_isStartServer == JNI_FALSE)
{
- OIC_LOG_V(ERROR, TAG, "server is already stopped..it will be skipped");
+ OIC_LOG(ERROR, TAG, "server is already stopped..it will be skipped");
return CA_STATUS_FAILED;
}
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return CA_STATUS_FAILED;
}
isAttached = JNI_TRUE;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (res != JNI_OK)
{
- OIC_LOG_V(ERROR, TAG, "AttachCurrentThread failed");
+ OIC_LOG(ERROR, TAG, "AttachCurrentThread failed");
return;
}
isAttached = JNI_TRUE;
const char* localAddress = (*env)->GetStringUTFChars(env, jni_address, NULL);
if (NULL == localAddress)
{
- OIC_LOG_V(ERROR, TAG, "there are no local address");
+ OIC_LOG(ERROR, TAG, "there are no local address");
return;
}
// create new object array
if (g_connectedDeviceList == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "Create device list");
+ OIC_LOG(DEBUG, TAG, "Create device list");
g_connectedDeviceList = u_arraylist_create();
}
if (!strcmp(remoteAddress, setAddress))
{
- OIC_LOG_V(DEBUG, TAG, "the device is already set");
+ OIC_LOG(DEBUG, TAG, "the device is already set");
return JNI_TRUE;
}
else
}
}
- OIC_LOG_V(DEBUG, TAG, "no device in list");
+ OIC_LOG(DEBUG, TAG, "no device in list");
return JNI_FALSE;
}
{
jobject gdevice = (*env)->NewGlobalRef(env, device);
u_arraylist_add(g_connectedDeviceList, gdevice);
- OIC_LOG_V(DEBUG, TAG, "Set Object to Array as Element");
+ OIC_LOG(DEBUG, TAG, "Set Object to Array as Element");
}
}
void CALEServerRemoveAllDevices(JNIEnv *env)
{
- OIC_LOG_V(DEBUG, TAG, "CALEServerRemoveAllDevices");
+ OIC_LOG(DEBUG, TAG, "CALEServerRemoveAllDevices");
if (!g_connectedDeviceList)
{
void CALEServerRemoveDevice(JNIEnv *env, jstring address)
{
- OIC_LOG_V(DEBUG, TAG, "CALEServerRemoveDevice");
+ OIC_LOG(DEBUG, TAG, "CALEServerRemoveDevice");
if (!g_connectedDeviceList)
{
JNIEnv *env, jobject obj, jobject device, jint requestId, jint offset,
jobject characteristic, jbyteArray data)
{
- OIC_LOG_V(DEBUG, TAG, "CALeInterface - Gatt Server Characteristic Read Request Callback");
+ OIC_LOG(DEBUG, TAG, "CALeInterface - Gatt Server Characteristic Read Request Callback");
CANativeLEServerSendResponse(env, device, requestId, 0, offset, NULL);
}
jbyteArray data, jboolean preparedWrite, jboolean responseNeeded, jint offset,
jbyteArray value)
{
- OIC_LOG_V(DEBUG, TAG, "CALeInterface - Gatt Server Characteristic Write Request Callback");
+ OIC_LOG(DEBUG, TAG, "CALeInterface - Gatt Server Characteristic Write Request Callback");
CANativeLEServerSendResponse(env, device, requestId, 0, offset, value);
if (data == NULL)
{
- OIC_LOG_V(ERROR, TAG, "Reqeust data is null");
+ OIC_LOG(ERROR, TAG, "Reqeust data is null");
return;
}
requestData = (char*) OICCalloc(1, length + 1);
if (NULL == requestData)
{
- OIC_LOG_V(ERROR, TAG, "requestData is null");
+ OIC_LOG(ERROR, TAG, "requestData is null");
return;
}
jint offset,
jobject descriptor)
{
- OIC_LOG_V(DEBUG, TAG, "CALeInterface_CALeGattServerDescriptorReadRequestCallback");
+ OIC_LOG(DEBUG, TAG, "CALeInterface_CALeGattServerDescriptorReadRequestCallback");
}
JNIEXPORT void JNICALL
JNIEnv *env, jobject obj, jobject device, jint requestId, jobject descriptor,
jboolean preparedWrite, jboolean responseNeeded, jint offset, jbyteArray value)
{
- OIC_LOG_V(DEBUG, TAG, "CALeInterface_CALeGattServerDescriptorWriteRequestCallback");
+ OIC_LOG(DEBUG, TAG, "CALeInterface_CALeGattServerDescriptorWriteRequestCallback");
}
JNIEXPORT void JNICALL
jint requestId,
jboolean execute)
{
- OIC_LOG_V(DEBUG, TAG, "CALeInterface_CALeGattServerExecuteWriteCallback");
+ OIC_LOG(DEBUG, TAG, "CALeInterface_CALeGattServerExecuteWriteCallback");
CANativeLEServerSendResponse(env, device, requestId, 0, 0, NULL);
}
jobject device,
jint status)
{
- OIC_LOG_V(DEBUG, TAG, "CALeInterface - Gatt Server Notification Sent Callback");
+ OIC_LOG(DEBUG, TAG, "CALeInterface - Gatt Server Notification Sent Callback");
}
JNIEXPORT void JNICALL
Java_com_iotivity_jar_caleinterface_CALeAdvertiseStartSuccessCallback(JNIEnv *env, jobject obj,
jobject settingsInEffect)
{
- OIC_LOG_V(DEBUG, TAG, "CALeInterface - LE Advertise Start Success Callback");
+ OIC_LOG(DEBUG, TAG, "CALeInterface - LE Advertise Start Success Callback");
}
JNIEXPORT void JNICALL
Java_com_iotivity_jar_caleinterface_CARegisterLeGattServerCallback(JNIEnv *env, jobject obj,
jobject callback)
{
- OIC_LOG_V(DEBUG, TAG, "CALeInterface - Register Le Gatt Server Callback");
+ OIC_LOG(DEBUG, TAG, "CALeInterface - Register Le Gatt Server Callback");
g_bluetoothGattServerCallback = (*env)->NewGlobalRef(env, callback);
}
Java_com_iotivity_jar_caleinterface_CARegisterBluetoothLeAdvertiseCallback(JNIEnv *env, jobject obj,
jobject callback)
{
- OIC_LOG_V(DEBUG, TAG, "CALeInterface - Register Le Advertise Callback");
+ OIC_LOG(DEBUG, TAG, "CALeInterface - Register Le Advertise Callback");
g_leAdvertiseCallback = (*env)->NewGlobalRef(env, callback);
}
jint status,
jint newState)
{
- OIC_LOG_V(DEBUG, TAG, "CALeInterface - Gatt Server ConnectionStateChange Callback");
+ OIC_LOG(DEBUG, TAG, "CALeInterface - Gatt Server ConnectionStateChange Callback");
OIC_LOG_V(DEBUG, TAG, "New connection State: %d", newState);
if (newState == jni_int_state_connected)
{
- OIC_LOG_V(DEBUG, TAG, "LE CONNECTED");
+ OIC_LOG(DEBUG, TAG, "LE CONNECTED");
jstring jni_remoteAddress = CALEGetAddressFromBTDevice(env, device);
if (!jni_remoteAddress)
if (g_connectedDeviceList == NULL)
{
- OIC_LOG_V(ERROR, TAG, "g_connectedDeviceList is null");
+ OIC_LOG(ERROR, TAG, "g_connectedDeviceList is null");
}
if (CALEServerIsDeviceInList(env, remoteAddress) == JNI_FALSE)
{
- OIC_LOG_V(DEBUG, TAG, "add connected device to cache");
+ OIC_LOG(DEBUG, TAG, "add connected device to cache");
CALEServerAddDeviceToList(env, device);
}
}
else if (newState == jni_int_state_disconnected)
{
- OIC_LOG_V(DEBUG, TAG, "LE DISCONNECTED");
+ OIC_LOG(DEBUG, TAG, "LE DISCONNECTED");
}
}
jobject CALEGetUuidFromString(JNIEnv *env, const char* uuid)
{
- OIC_LOG_V(DEBUG, TAG, "CALEGetUuidFromString");
+ OIC_LOG(DEBUG, TAG, "CALEGetUuidFromString");
jclass jni_cid_UUID = (*env)->FindClass(env, "java/util/UUID");
str_uuid);
if (!jni_obj_uuid)
{
- OIC_LOG_V(DEBUG, TAG, "Fail to get jni uuid object");
+ OIC_LOG(DEBUG, TAG, "Fail to get jni uuid object");
return NULL;
}
jobject CALEGetParcelUuid(JNIEnv *env, jobject uuid)
{
- OIC_LOG_V(DEBUG, TAG, "CALEGetParcelUuid");
+ OIC_LOG(DEBUG, TAG, "CALEGetParcelUuid");
jclass jni_cid_ParcelUuid = (*env)->FindClass(env, "android/os/ParcelUuid");
jobject jni_ParcelUuid = (*env)->NewObject(env, jni_cid_ParcelUuid, jni_mid_ParcelUuid, uuid);
if (!jni_ParcelUuid)
{
- OIC_LOG_V(DEBUG, TAG, "Fail to get jni ParcelUuid");
+ OIC_LOG(DEBUG, TAG, "Fail to get jni ParcelUuid");
return NULL;
}
result = CAInitializeLENetworkMonitor();
if (CA_STATUS_OK != result)
{
- OIC_LOG_V(ERROR, CALEADAPTER_TAG, "CAInitializeLENetworkMonitor() failed");
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "CAInitializeLENetworkMonitor() failed");
return CA_STATUS_FAILED;
}
if (CA_STATUS_OK != CAQueueingThreadStart(g_sendQueueHandle))
{
- OIC_LOG_V(ERROR, CALEADAPTER_TAG, "u_thread_pool_add_task failed ");
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "u_thread_pool_add_task failed ");
OICFree(g_sendQueueHandle);
g_sendQueueHandle = NULL;
return CA_STATUS_FAILED;
if (CA_STATUS_OK != CAQueueingThreadStart(g_bLEClientSendQueueHandle))
{
- OIC_LOG_V(ERROR, CALEADAPTER_TAG, "u_thread_pool_add_task failed ");
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "u_thread_pool_add_task failed ");
OICFree(g_bLEClientSendQueueHandle);
g_bLEClientSendQueueHandle = NULL;
return CA_STATUS_FAILED;
if (CA_STATUS_OK != CAQueueingThreadStart(g_bleServerReceiverQueue))
{
- OIC_LOG_V(ERROR, CALEADAPTER_TAG, "u_thread_pool_add_task failed ");
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "u_thread_pool_add_task failed ");
OICFree(g_bleServerReceiverQueue);
g_bleServerReceiverQueue = NULL;
return CA_STATUS_FAILED;
}
if (CA_STATUS_OK != CAQueueingThreadStart(g_bleClientReceiverQueue))
{
- OIC_LOG_V(ERROR, CALEADAPTER_TAG, "u_thread_pool_add_task failed ");
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "u_thread_pool_add_task failed ");
OICFree(g_bleClientReceiverQueue);
g_bleClientReceiverQueue = NULL;
return CA_STATUS_FAILED;
}
void CABLEServerDataReceiverHandler(void *threadData)
{
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "IN");
static uint32_t recvDataLen = 0;
static uint32_t totalDataLen = 0;
if (g_dataReceiverHandlerState)
{
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "checking for DE Fragmentation");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "checking for DE Fragmentation");
CALEData_t *bleData = (CALEData_t *) threadData;
if (!bleData)
return;
}
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "checking for DE Fragmentation");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "checking for DE Fragmentation");
if (!isHeaderAvailable)
{
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Parsing the header");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "Parsing the header");
totalDataLen = CAParseHeader((char*)bleData->data);
OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Total data to be accumulated [%d] bytes", totalDataLen);
u_mutex_unlock(g_bleAdapterReqRespCbMutex);
return;
}
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Sending data up !");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "Sending data up !");
g_networkPacketReceivedCallback(remoteEndpoint, defragData, recvDataLen);
recvDataLen = 0;
totalDataLen = 0;
if (false == g_dataReceiverHandlerState)
{
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "GATTClient is terminating. Cleaning up");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "GATTClient is terminating. Cleaning up");
recvDataLen = 0;
totalDataLen = 0;
isHeaderAvailable = false;
}
}
u_mutex_unlock(g_bleClientReceiveDataMutex);
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "OUT");
}
void CABLEClientDataReceiverHandler(void *threadData)
{
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "IN");
static const char *remoteAddress = NULL;
static const char *serviceUUID = NULL;
if (g_dataReceiverHandlerState)
{
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "checking for DE Fragmentation");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "checking for DE Fragmentation");
CALEData_t *bleData = (CALEData_t *) threadData;
if (!bleData)
return;
}
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "checking for DE Fragmentation");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "checking for DE Fragmentation");
if (!isHeaderAvailable)
{
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Parsing the header");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "Parsing the header");
totalDataLen = CAParseHeader(bleData->data);
OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Total data to be accumulated [%d] bytes",
u_mutex_unlock(g_bleAdapterReqRespCbMutex);
return;
}
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "Sending data up !");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "Sending data up !");
g_networkPacketReceivedCallback(remoteEndpoint, defragData, recvDataLen);
recvDataLen = 0;
totalDataLen = 0;
if (false == g_dataReceiverHandlerState)
{
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "GATTClient is terminating. Cleaning up");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "GATTClient is terminating. Cleaning up");
OICFree(defragData);
CAAdapterFreeRemoteEndpoint(remoteEndpoint);
u_mutex_unlock(g_bleClientReceiveDataMutex);
}
}
u_mutex_unlock(g_bleClientReceiveDataMutex);
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "OUT");
}
void CABLEServerSendDataThread(void *threadData)
CALEData_t *bleData = CACreateBLEData(remoteEndpoint, data, dataLen);
if (!bleData)
{
- OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Failed to create bledata!");
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "Failed to create bledata!");
return CA_MEMORY_ALLOC_FAILED;
}
// Add message to send queue
CALEData_t *bleData = CACreateBLEData(remoteEndpoint, data, dataLen);
if (!bleData)
{
- OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Failed to create bledata!");
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "Failed to create bledata!");
return CA_MEMORY_ALLOC_FAILED;
}
// Add message to send queue
CAResult_t CABLEServerReceivedData(const char *remoteAddress, const char *serviceUUID,
const void *data, uint32_t dataLength, uint32_t *sentLength)
{
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "IN");
//Input validation
VERIFY_NON_NULL(serviceUUID, CALEADAPTER_TAG, "service UUID is null");
serviceUUID);
if (NULL == remoteEndpoint)
{
- OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Failed to create remote endpoint !");
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "Failed to create remote endpoint !");
return CA_STATUS_FAILED;
}
CALEData_t *bleData = CACreateBLEData(remoteEndpoint, data, dataLength);
if (!bleData)
{
- OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Failed to create bledata!");
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "Failed to create bledata!");
CAAdapterFreeRemoteEndpoint(remoteEndpoint);
return CA_MEMORY_ALLOC_FAILED;
}
*sentLength = dataLength;
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CABLEClientReceivedData(const char *remoteAddress, const char *serviceUUID,
const void *data, uint32_t dataLength, uint32_t *sentLength)
{
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "IN");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "IN");
//Input validation
VERIFY_NON_NULL(serviceUUID, CALEADAPTER_TAG, "service UUID is null");
serviceUUID);
if (NULL == remoteEndpoint)
{
- OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Failed to create remote endpoint !");
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "Failed to create remote endpoint !");
return CA_STATUS_FAILED;
}
CALEData_t *bleData = CACreateBLEData(remoteEndpoint, data, dataLength);
if (!bleData)
{
- OIC_LOG_V(ERROR, CALEADAPTER_TAG, "Failed to create bledata!");
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "Failed to create bledata!");
CAAdapterFreeRemoteEndpoint(remoteEndpoint);
return CA_MEMORY_ALLOC_FAILED;
}
*sentLength = dataLength;
- OIC_LOG_V(DEBUG, CALEADAPTER_TAG, "OUT");
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}
CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback,
u_thread_pool_t handle)
{
- OIC_LOG_V(DEBUG, TAG, "CAInitializeLE");
+ OIC_LOG(DEBUG, TAG, "CAInitializeLE");
g_leReceivedCallback = reqRespCallback;
g_threadPoolHandle = handle;
CAResult_t CAStartLE()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartLE");
+ OIC_LOG(DEBUG, TAG, "CAStartLE");
return CA_STATUS_OK;
}
CAResult_t CAStartLEListeningServer()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartLEListeningServer");
+ OIC_LOG(DEBUG, TAG, "CAStartLEListeningServer");
return CA_STATUS_OK;
}
CAResult_t CAStartLEDiscoveryServer()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartLEDiscoveryServer");
+ OIC_LOG(DEBUG, TAG, "CAStartLEDiscoveryServer");
return CA_STATUS_OK;
}
int32_t CASendLEUnicastData(const CARemoteEndpoint_t *endpoint, const void *data, uint32_t dataLen)
{
- OIC_LOG_V(DEBUG, TAG, "CASendLEUnicastData");
+ OIC_LOG(DEBUG, TAG, "CASendLEUnicastData");
return -1;
}
int32_t CASendLEMulticastData(const void *data, uint32_t dataLen)
{
- OIC_LOG_V(DEBUG, TAG, "CASendLEMulticastData");
+ OIC_LOG(DEBUG, TAG, "CASendLEMulticastData");
return -1;
}
CAResult_t CAGetLEInterfaceInformation(CALocalConnectivity_t **info, uint32_t *size)
{
- OIC_LOG_V(DEBUG, TAG, "CAGetLEInterfaceInformation");
+ OIC_LOG(DEBUG, TAG, "CAGetLEInterfaceInformation");
return CA_STATUS_OK;
}
CAResult_t CAReadLEData()
{
- OIC_LOG_V(DEBUG, TAG, "Read LE Data");
+ OIC_LOG(DEBUG, TAG, "Read LE Data");
return CA_STATUS_OK;
}
CAResult_t CAStopLE()
{
- OIC_LOG_V(DEBUG, TAG, "CAStopLE");
+ OIC_LOG(DEBUG, TAG, "CAStopLE");
return CA_STATUS_OK;
}
void CATerminateLE()
{
- OIC_LOG_V(DEBUG, TAG, "TerminatLE");
+ OIC_LOG(DEBUG, TAG, "TerminatLE");
}
OICFree(data);
return;
}
- OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "Sending data up !");
+ OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "Sending data up !");
u_mutex_lock(g_bleServerBDAddressMutex);
uint32_t sentLength = 0;
stTemp);
if (CA_STATUS_OK != ret)
{
- OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "u_thread_pool_add_task failed");
+ OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "u_thread_pool_add_task failed");
bt_gatt_destroy_attribute_handle(stTemp->characteristic);
OICFree(stTemp->desc);
OICFree(stTemp);
CAResult_t retVal = CAAppendBLECharInfo(characteristic, BLE_GATT_READ_CHAR, bleServiceInfo);
if (CA_STATUS_OK != retVal)
{
- OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG , "CAAppendBLECharInfo failed ");
+ OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "CAAppendBLECharInfo failed ");
return false;
}
char *uuid = NULL;
CAResult_t retVal = CAAppendBLECharInfo(characteristic, BLE_GATT_WRITE_CHAR, bleServiceInfo);
if (CA_STATUS_OK != retVal)
{
- OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG , "CAAppendBLECharInfo failed! ");
+ OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "CAAppendBLECharInfo failed! ");
return false;
}
char *uuid = NULL;
{
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "Its OIC service");
- OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG , "Registering to watch characteristics changes \n");
+ OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG , "Registering to watch characteristics changes \n");
result = CABleGattWatchCharacteristicChanges(service);
if (CA_STATUS_OK != result)
u_mutex_unlock(g_bleServiceListMutex);
if (CA_STATUS_OK != result)
{
- OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG , "CAAddBLEServiceInfoToList failed!");
+ OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "CAAddBLEServiceInfoToList failed!");
OICFree(stTemp->address);
OICFree(stTemp);
CAFreeBLEServiceInfo(bleServiceInfo);
ret = CABleGattStartDeviceDiscovery();
if (CA_STATUS_OK != ret)
{
- OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "CABleGattStartDeviceDiscovery failed");
+ OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "CABleGattStartDeviceDiscovery failed");
return;
}
}
NULL);
if (CA_STATUS_OK != retVal)
{
- OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "u_thread_pool_add_task failed");
+ OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "u_thread_pool_add_task failed");
CATerminateGattClientMutexVariables();
u_mutex_unlock(g_bleClientThreadPoolMutex);
return CA_STATUS_FAILED;
CAResult_t result = CABleGattDiscoverCharacteristics(stTemp->serviceInfo, stTemp->address);
if (CA_STATUS_OK != result)
{
- OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG , "CABleGattDiscoverCharacteristics failed!");
+ OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "CABleGattDiscoverCharacteristics failed!");
bt_gatt_destroy_attribute_handle(stTemp->serviceInfo);
OICFree(stTemp->address);
OICFree(stTemp);
CAResult_t CABleGattDiscoverCharacteristics(bt_gatt_attribute_h service,
const char *remoteAddress)
{
- OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
+ OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
VERIFY_NON_NULL_RET(service, NULL, "service is NULL", CA_STATUS_FAILED);
CAResult_t CABleGattDiscoverDescriptor(bt_gatt_attribute_h service, const char *remoteAddress)
{
- OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
+ OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
VERIFY_NON_NULL_RET(service, NULL, "service is NULL", CA_STATUS_FAILED);
CAResult_t result = CASetCharacteristicDescriptorValue(stTemp);
if (CA_STATUS_OK != result)
{
- OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG , "CASetCharacteristicDescriptorValue failed!");
+ OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG , "CASetCharacteristicDescriptorValue failed!");
bt_gatt_destroy_attribute_handle(stTemp->characteristic);
OICFree(stTemp->desc);
OICFree(stTemp);
if (0 >= dataLen)
{
- OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "dataLen is less than or equal zero. Invalid input!");
+ OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "dataLen is less than or equal zero. Invalid input!");
return CA_STATUS_INVALID_PARAM;
}
if (CA_STATUS_OK != ret)
{
- OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "CAGetBLEServiceInfoByPosition is failed");
+ OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "CAGetBLEServiceInfoByPosition is failed");
return CA_STATUS_FAILED;
}
if (0 >= dataLen)
{
- OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG, "dataLen is less than or equal zero. Invalid input !");
+ OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "dataLen is less than or equal zero. Invalid input !");
return CA_STATUS_INVALID_PARAM;
}
CAResult_t res = CAInitLENetworkMonitorMutexVariables();
if (CA_STATUS_OK != res)
{
- OIC_LOG_V(ERROR, TZ_LE_NWK_MONITOR_TAG, "CAInitLENetworkMonitorMutexVariables() failed");
+ OIC_LOG(ERROR, TZ_LE_NWK_MONITOR_TAG, "CAInitLENetworkMonitorMutexVariables() failed");
return CA_STATUS_FAILED;
}
OIC_LOG(DEBUG, TZ_LE_NWK_MONITOR_TAG, "OUT");
int ret = bt_initialize();
if (0 != ret)
{
- OIC_LOG_V(ERROR, TZ_LE_NWK_MONITOR_TAG, "bt_initialize failed");
+ OIC_LOG(ERROR, TZ_LE_NWK_MONITOR_TAG, "bt_initialize failed");
return CA_STATUS_FAILED;
}
ret = bt_adapter_set_visibility(BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE, 0);
if (0 != ret)
{
- OIC_LOG_V(ERROR, TZ_LE_NWK_MONITOR_TAG, "bt_adapter_set_visibility failed");
+ OIC_LOG(ERROR, TZ_LE_NWK_MONITOR_TAG, "bt_adapter_set_visibility failed");
return CA_STATUS_FAILED;
}
return;
}
- OIC_LOG_V(DEBUG, TZ_BLE_SERVER_TAG, "Sending data up !");
+ OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "Sending data up !");
u_mutex_lock(g_bleClientBDAddressMutex);
uint32_t sentLength = 0;
g_bleServerDataReceivedCallback(g_remoteClientAddress, OIC_BLE_SERVICE_ID,
CAResult_t CAInitialize()
{
- OIC_LOG_V(DEBUG, TAG, "CAInitialize");
+ OIC_LOG(DEBUG, TAG, "CAInitialize");
return CAInitializeMessageHandler();;
}
void CATerminate()
{
- OIC_LOG_V(DEBUG, TAG, "CATerminate");
+ OIC_LOG(DEBUG, TAG, "CATerminate");
CATerminateMessageHandler();
CAResult_t CAStartListeningServer()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartListeningServer");
+ OIC_LOG(DEBUG, TAG, "CAStartListeningServer");
return CAStartListeningServerAdapters();
}
CAResult_t CAStartDiscoveryServer()
{
- OIC_LOG_V(DEBUG, TAG, "CAStartDiscoveryServer");
+ OIC_LOG(DEBUG, TAG, "CAStartDiscoveryServer");
return CAStartDiscoveryServerAdapters();
}
void CARegisterHandler(CARequestCallback ReqHandler, CAResponseCallback RespHandler)
{
- OIC_LOG_V(DEBUG, TAG, "CARegisterHandler");
+ OIC_LOG(DEBUG, TAG, "CARegisterHandler");
CASetRequestResponseCallbacks(ReqHandler, RespHandler);
}
CAResult_t CACreateRemoteEndpoint(const CAURI_t uri,
const CAConnectivityType_t connectivityType,CARemoteEndpoint_t **remoteEndpoint)
{
- OIC_LOG_V(DEBUG, TAG, "CACreateRemoteEndpoint");
+ OIC_LOG(DEBUG, TAG, "CACreateRemoteEndpoint");
CARemoteEndpoint_t *remote = CACreateRemoteEndpointUriInternal(uri, connectivityType);
if (remote == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "remote is NULL!");
+ OIC_LOG(DEBUG, TAG, "remote is NULL!");
return CA_STATUS_FAILED;
}
void CADestroyRemoteEndpoint(CARemoteEndpoint_t *rep)
{
- OIC_LOG_V(DEBUG, TAG, "CADestroyRemoteEndpoint");
+ OIC_LOG(DEBUG, TAG, "CADestroyRemoteEndpoint");
CADestroyRemoteEndpointInternal(rep);
}
CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
{
- OIC_LOG_V(DEBUG, TAG, "CAGenerateToken");
+ OIC_LOG(DEBUG, TAG, "CAGenerateToken");
return CAGenerateTokenInternal(token, tokenLength);
}
void CADestroyToken(CAToken_t token)
{
- OIC_LOG_V(DEBUG, TAG, "CADestroyToken");
+ OIC_LOG(DEBUG, TAG, "CADestroyToken");
CADestroyTokenInternal(token);
}
CAResult_t CAGetNetworkInformation(CALocalConnectivity_t **info, uint32_t *size)
{
- OIC_LOG_V(DEBUG, TAG, "CAGetNetworkInformation");
+ OIC_LOG(DEBUG, TAG, "CAGetNetworkInformation");
return CAGetNetworkInformationInternal(info, size);
}
CAResult_t CAFindResource(const CAURI_t resourceUri, const CAToken_t token, uint8_t tokenLength)
{
- OIC_LOG_V(DEBUG, TAG, "CAFindResource");
+ OIC_LOG(DEBUG, TAG, "CAFindResource");
return CADetachMessageResourceUri(resourceUri, token, tokenLength, NULL, 0);
CAResult_t CASendRequest(const CARemoteEndpoint_t *object,const CARequestInfo_t *requestInfo)
{
- OIC_LOG_V(DEBUG, TAG, "CASendGetRequest");
+ OIC_LOG(DEBUG, TAG, "CASendGetRequest");
return CADetachRequestMessage(object, requestInfo);
}
CAResult_t CASendRequestToAll(const CAGroupEndpoint_t *object,
const CARequestInfo_t *requestInfo)
{
- OIC_LOG_V(DEBUG, TAG, "CASendRequestToAll");
+ OIC_LOG(DEBUG, TAG, "CASendRequestToAll");
return CADetachRequestToAllMessage(object, requestInfo);
}
CAResult_t CASendNotification(const CARemoteEndpoint_t *object,
const CAResponseInfo_t *responseInfo)
{
- OIC_LOG_V(DEBUG, TAG, "CASendNotification");
+ OIC_LOG(DEBUG, TAG, "CASendNotification");
return CADetachResponseMessage(object, responseInfo);
CAResult_t CASendResponse(const CARemoteEndpoint_t *object,
const CAResponseInfo_t *responseInfo)
{
- OIC_LOG_V(DEBUG, TAG, "CASendResponse");
+ OIC_LOG(DEBUG, TAG, "CASendResponse");
return CADetachResponseMessage(object, responseInfo);
uint8_t tokenLength, const CAHeaderOption_t *options,
const uint8_t numOptions)
{
- OIC_LOG_V(DEBUG, TAG, "CAAdvertiseResource");
+ OIC_LOG(DEBUG, TAG, "CAAdvertiseResource");
return CADetachMessageResourceUri(resourceUri, token, tokenLength, options, numOptions);
CAResult_t CAHandleRequestResponse()
{
- OIC_LOG_V(DEBUG, TAG, "CAHandleRequestResponse");
+ OIC_LOG(DEBUG, TAG, "CAHandleRequestResponse");
CAHandleRequestResponseCallbacks();
#define TAG PCF("CA")
#define CA_MEMORY_ALLOC_CHECK(arg) {if (arg == NULL) \
- {OIC_LOG_V(ERROR, TAG, "memory error");goto memory_error_exit;} }
+ {OIC_LOG(ERROR, TAG, "memory error");goto memory_error_exit;} }
#define CA_CONNECTIVITY_TYPE_NUM 4
res = CA_STATUS_OK;
- OIC_LOG_V(DEBUG, TAG, "each network info save success!");
+ OIC_LOG(DEBUG, TAG, "each network info save success!");
return res;
if (endpoint == NULL)
{
- OIC_LOG_V(DEBUG, TAG, "Invalid endpoint");
+ OIC_LOG(DEBUG, TAG, "Invalid endpoint");
return CA_STATUS_INVALID_PARAM;
}
void *payload = (void *) OICMalloc(length);
if (!payload)
{
- OIC_LOG_V(ERROR, TAG, "Out of memory!");
+ OIC_LOG(ERROR, TAG, "Out of memory!");
return CA_MEMORY_ALLOC_FAILED;
}
memcpy(payload, data, length);
}
else
{
- OIC_LOG_V(ERROR, TAG, "sendDataToAll failed!");
+ OIC_LOG(ERROR, TAG, "sendDataToAll failed!");
}
}
if (index == -1)
{
- OIC_LOG_V(DEBUG, TAG, "unknown connectivity type!");
+ OIC_LOG(DEBUG, TAG, "unknown connectivity type!");
continue;
}
if (NULL == pduData)
{
OICFree(retData);
- OIC_LOG_V(ERROR, TAG, "memory error!!");
+ OIC_LOG(ERROR, TAG, "memory error!!");
return CA_MEMORY_ALLOC_FAILED;
}
memcpy(pduData, pdu, size);
const CARemoteEndpoint_t *endpoint, const void *pdu,
uint32_t size, void **retransmissionPdu)
{
- OIC_LOG_V(DEBUG, TAG, "IN - CARetransmissionReceivedData");
+ OIC_LOG(DEBUG, TAG, "IN - CARetransmissionReceivedData");
if (NULL == context || NULL == endpoint || NULL == pdu || NULL == retransmissionPdu)
{
OIC_LOG(ERROR, TAG, "invalid parameter..");
CALocalConnectivity_t *localEndpoint = CAAdapterCreateLocalEndpoint(CA_ETHERNET, address);
if (!localEndpoint)
{
- OIC_LOG_V(ERROR, ETHERNET_ADAPTER_TAG, "Out of memory");
+ OIC_LOG(ERROR, ETHERNET_ADAPTER_TAG, "Out of memory");
return;
}
if (0 == dataLength)
{
- OIC_LOG_V(ERROR, ETHERNET_ADAPTER_TAG, "Invalid Data Length");
+ OIC_LOG(ERROR, ETHERNET_ADAPTER_TAG, "Invalid Data Length");
return -1;
}
CAEthernetData *ethernetData = CACreateEthernetData(remoteEndpoint, data, dataLength);
if (!ethernetData)
{
- OIC_LOG_V(ERROR, ETHERNET_ADAPTER_TAG, "Failed to create ethernetData!");
+ OIC_LOG(ERROR, ETHERNET_ADAPTER_TAG, "Failed to create ethernetData!");
return -1;
}
else
if (0 == dataLength)
{
- OIC_LOG_V(ERROR, ETHERNET_ADAPTER_TAG, "Invalid Data Length");
+ OIC_LOG(ERROR, ETHERNET_ADAPTER_TAG, "Invalid Data Length");
return -1;
}
CAEthernetData *EthernetData = CACreateEthernetData(NULL, data, dataLength);
if (!EthernetData)
{
- OIC_LOG_V(ERROR, ETHERNET_ADAPTER_TAG, "Failed to create ethernetData!");
+ OIC_LOG(ERROR, ETHERNET_ADAPTER_TAG, "Failed to create ethernetData!");
return -1;
}
else
CAResult_t CAEthernetInitializeNetworkMonitor(const u_thread_pool_t threadPool)
{
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "IN");
g_threadPool = threadPool;
nwConnectivityStatus = (g_ethernetIPAddress) ? CA_INTERFACE_UP : CA_INTERFACE_DOWN;
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
void CAEthernetTerminateNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "IN");
g_threadPool = NULL;
g_ethernetNetInfoMutex = NULL;
}
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
}
CAResult_t CAEthernetStartNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "IN");
g_stopNetworkMonitor = false;
if (g_stopNetworkMonitor)
{
- OIC_LOG_V(ERROR, ETHERNET_MONITOR_TAG, "Stop network monitor requested");
+ OIC_LOG(ERROR, ETHERNET_MONITOR_TAG, "Stop network monitor requested");
return CA_STATUS_FAILED;
}
CAResult_t CAEthernetStopNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "IN");
if (g_stopNetworkMonitor)
{
g_stopNetworkMonitor = true;
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEthernetGetInterfaceInfo(char **interfaceName, char **ipAddress)
{
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "IN");
VERIFY_NON_NULL(interfaceName, ETHERNET_MONITOR_TAG, "interface name");
VERIFY_NON_NULL(ipAddress, ETHERNET_MONITOR_TAG, "ip address");
u_mutex_lock(g_ethernetNetInfoMutex);
if (g_ethernetInterfaceName == NULL || g_ethernetIPAddress == NULL)
{
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "Network not enabled");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "Network not enabled");
u_mutex_unlock(g_ethernetNetInfoMutex);
return CA_ADAPTER_NOT_ENABLED;
u_mutex_unlock(g_ethernetNetInfoMutex);
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAEthernetGetInterfaceSubnetMask(char **subnetMask)
{
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "IN");
VERIFY_NON_NULL(subnetMask, ETHERNET_MONITOR_TAG, "subnet mask");
u_mutex_lock(g_ethernetNetInfoMutex);
if (NULL == g_ethernetSubnetMask)
{
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "There is no subnet mask information!");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "There is no subnet mask information!");
u_mutex_unlock(g_ethernetNetInfoMutex);
return CA_STATUS_FAILED;
: NULL;
u_mutex_unlock(g_ethernetNetInfoMutex);
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
bool CAEthernetIsConnected(void)
{
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "IN");
if (CA_INTERFACE_DOWN == nwConnectivityStatus) {
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
return false;
}
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
return true;
}
void CAEthernetSetConnectionStateChangeCallback
(CAEthernetConnectionStateChangeCallback callback)
{
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "IN");
g_networkChangeCb = callback;
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
}
void CAEthernetGetInterfaceInformation(char **interfaceName,
void CANetworkMonitorThread(void *threadData)
{
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "IN");
while (!g_stopNetworkMonitor)
{
OICFree(subnetMask);
}
- OIC_LOG_V(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, ETHERNET_MONITOR_TAG, "OUT");
}
char *netMask = NULL;
if (CA_STATUS_OK != CAEthernetGetInterfaceSubnetMask(&netMask))
{
- OIC_LOG_V(ERROR, ETHERNET_SERVER_TAG, "Failed to get ethernet subnet");
+ OIC_LOG(ERROR, ETHERNET_SERVER_TAG, "Failed to get ethernet subnet");
continue;
}
#endif //__WITH_DTLS__
default:
// Should never occur
- OIC_LOG_V(DEBUG, ETHERNET_SERVER_TAG, "Invalid server type");
+ OIC_LOG(DEBUG, ETHERNET_SERVER_TAG, "Invalid server type");
if (ctx->stopFd != -1)
{
close(ctx->stopFd);
if (0 >= *port)
{
- OIC_LOG_V(ERROR, ETHERNET_SERVER_TAG, "Invalid input: port is invalid!");
+ OIC_LOG(ERROR, ETHERNET_SERVER_TAG, "Invalid input: port is invalid!");
return CA_STATUS_INVALID_PARAM;
}
if (CA_STATUS_OK != CAStartUnicastServer(localAddress, port, forceStart, isSecured,
&g_unicastServerSocketFD))
{
- OIC_LOG_V(ERROR, ETHERNET_SERVER_TAG, "Failed to start unicast server!");
+ OIC_LOG(ERROR, ETHERNET_SERVER_TAG, "Failed to start unicast server!");
g_unicastServerSocketFD = -1;
u_mutex_unlock(g_mutexUnicastServer);
return CA_STATUS_FAILED;
if (CA_STATUS_OK != CAStartUnicastServer(localAddress, port, forceStart, isSecured,
&g_secureUnicastServerSocketFD))
{
- OIC_LOG_V(ERROR, ETHERNET_SERVER_TAG, "Failed to start unicast server!");
+ OIC_LOG(ERROR, ETHERNET_SERVER_TAG, "Failed to start unicast server!");
g_secureUnicastServerSocketFD = -1;
u_mutex_unlock(g_mutexSecureUnicastServer);
return CA_STATUS_FAILED;
uint16_t port = multicastPort;
if (0 >= port)
{
- OIC_LOG_V(ERROR, ETHERNET_SERVER_TAG, "Invalid input: Multicast port is invalid!");
+ OIC_LOG(ERROR, ETHERNET_SERVER_TAG, "Invalid input: Multicast port is invalid!");
return CA_STATUS_INVALID_PARAM;
}
if (g_multicastServerSocketFD != -1)
{
- OIC_LOG_V(ERROR, ETHERNET_SERVER_TAG, "Multicast Server is already running!");
+ OIC_LOG(ERROR, ETHERNET_SERVER_TAG, "Multicast Server is already running!");
u_mutex_unlock(g_mutexMulticastServer);
return CA_SERVER_STARTED_ALREADY;
}
CAResult_t CAWiFiInitializeNetworkMonitor(const u_thread_pool_t threadPool)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
g_threadPool = threadPool;
g_nwConnectivityStatus = (g_wifiIPAddress) ? CA_INTERFACE_UP : CA_INTERFACE_DOWN;
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
void CAWiFiTerminateNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
g_threadPool = NULL;
g_wifiNetInfoMutex = NULL;
}
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
}
CAResult_t CAWiFiStartNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
u_mutex_lock(g_wifiNetInfoMutex);
g_stopNetworkMonitor = false;
CAResult_t CAWiFiStopNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
u_mutex_lock(g_wifiNetInfoMutex);
u_mutex_unlock(g_wifiNetInfoMutex);
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAWiFiGetInterfaceInfo(char **interfaceName, char **ipAddress)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
VERIFY_NON_NULL(interfaceName, WIFI_MONITOR_TAG, "interface name");
VERIFY_NON_NULL(ipAddress, WIFI_MONITOR_TAG, "ip address");
if(g_wifiInterfaceName == NULL || g_wifiIPAddress == NULL)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "Network not enabled");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "Network not enabled");
return CA_ADAPTER_NOT_ENABLED;
}
CAResult_t CAWiFiGetInterfaceSubnetMask(char **subnetMask)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
VERIFY_NON_NULL(subnetMask, WIFI_MONITOR_TAG, "subnet mask");
u_mutex_lock(g_wifiNetInfoMutex);
if(NULL == g_wifiSubnetMask)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "There is no subnet mask information!");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "There is no subnet mask information!");
u_mutex_unlock(g_wifiNetInfoMutex);
return CA_STATUS_FAILED;
}
: NULL;
u_mutex_unlock(g_wifiNetInfoMutex);
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
void CAWiFiSetConnectionStateChangeCallback(
CAWiFiConnectionStateChangeCallback callback)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
g_networkChangeCb = callback;
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
}
void CAWiFiUpdateInterfaceInformation(char **interfaceName, char **ipAddress,
}
else
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "did not match name : wlan");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "did not match name : wlan");
}
OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG,
void CAWiFiJniInit(JavaVM* jvm)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] CAWiFiJniInit");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] CAWiFiJniInit");
g_jvm = jvm;
}
void CAJniSetContext(jobject context)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "caWifiSetObject");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "caWifiSetObject");
g_context = context;
}
void CACreateWiFiJNIInterfaceObject(jobject context)
{
JNIEnv* env;
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] CACreateWiFiJNIInterfaceObject");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] CACreateWiFiJNIInterfaceObject");
if ((*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6) != JNI_OK)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] Could not get JNIEnv pointer");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] Could not get JNIEnv pointer");
return;
}
jclass contextClass = (*env)->FindClass(env, "android/content/Context");
if (contextClass == 0)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] Could not get context object class");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] Could not get context object class");
return;
}
"getApplicationContext", "()Landroid/content/Context;");
if (getApplicationContextMethod == 0)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] Could not get getApplicationContext method");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] Could not get getApplicationContext method");
return;
}
jclass WiFiJniInterface = (*env)->FindClass(env, "com/iotivity/jar/CAWiFiInterface");
if (!WiFiJniInterface)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] Could not get CAWiFiInterface class");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] Could not get CAWiFiInterface class");
return;
}
WiFiJniInterface, "<init>", "(Landroid/content/Context;)V");
if (!WiFiInterfaceConstructorMethod)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] Could not get CAWiFiInterface constructor method");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] Could not get CAWiFiInterface constructor method");
return;
}
(*env)->NewObject(env, WiFiJniInterface, WiFiInterfaceConstructorMethod, gApplicationContext);
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WIFICore]Create CAWiFiInterface instance");
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] NewObject Successs");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WIFICore]Create CAWiFiInterface instance");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WIFICore] NewObject Successs");
}
if(NULL == g_networkChangeCb)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WiFiCore] g_networkChangeCb is NULL");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WiFiCore] g_networkChangeCb is NULL");
u_mutex_lock(g_wifiNetInfoMutex);
return;
}
(JNIEnv *env, jclass class)
{
CANetworkStatus_t currNetworkStatus = CA_INTERFACE_UP;
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WiFiCore] CAWiFiStateEnabled");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WiFiCore] CAWiFiStateEnabled");
if (currNetworkStatus == g_nwConnectivityStatus)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WiFiCore] Network State not changed");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WiFiCore] Network State not changed");
return;
}
(JNIEnv *env, jclass class)
{
CANetworkStatus_t currNetworkStatus = CA_INTERFACE_DOWN;
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WiFiCore] CAWiFiStateDisabled");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WiFiCore] CAWiFiStateDisabled");
if (currNetworkStatus == g_nwConnectivityStatus)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "[WiFiCore] Network State not changed");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "[WiFiCore] Network State not changed");
return;
}
CASendNetworkChangeCallback(currNetworkStatus);
if(NULL == srcIPAddress)
{
OICFree(ctx);
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Error in OICStrdup, exit CAReceiveHandler");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Error in OICStrdup, exit CAReceiveHandler");
break;
}
char *netMask = NULL;
if (CA_STATUS_OK != CAWiFiGetInterfaceSubnetMask(&netMask))
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Failed to get ethernet subnet");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Failed to get ethernet subnet");
OICFree(srcIPAddress);
continue;
}
#endif //__WITH_DTLS__
default:
// Should never occur
- OIC_LOG_V(DEBUG, WIFI_SERVER_TAG, "Invalid server type");
+ OIC_LOG(DEBUG, WIFI_SERVER_TAG, "Invalid server type");
OICFree(srcIPAddress);
OICFree(ctx);
return;
if (0 >= *port)
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Invalid input: port is invalid!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Invalid input: port is invalid!");
return CA_STATUS_INVALID_PARAM;
}
if (CA_STATUS_OK != CAStartUnicastServer(localAddress, port, forceStart, isSecured,
&g_unicastServerSocketFD))
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
close(g_unicastServerSocketFD);
g_unicastServerSocketFD = -1;
u_mutex_unlock(g_mutexUnicastServer);
if (CA_STATUS_OK != CAStartUnicastServer(localAddress, port, forceStart, isSecured,
&g_secureUnicastServerSocketFD))
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
g_secureUnicastServerSocketFD = -1;
u_mutex_unlock(g_mutexSecureUnicastServer);
return CA_STATUS_FAILED;
uint16_t port = multicastPort;
if (0 >= port)
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Invalid input: Multicast port is invalid!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Invalid input: Multicast port is invalid!");
return CA_STATUS_INVALID_PARAM;
}
if (g_multicastServerSocketFD != -1)
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Multicast Server is already running!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Multicast Server is already running!");
u_mutex_unlock(g_mutexMulticastServer);
return CA_SERVER_STARTED_ALREADY;
}
CALocalConnectivity_t *localEndpoint = CAAdapterCreateLocalEndpoint(CA_WIFI, address);
if (!localEndpoint)
{
- OIC_LOG_V(ERROR, WIFI_ADAPTER_TAG, "Out of memory");
+ OIC_LOG(ERROR, WIFI_ADAPTER_TAG, "Out of memory");
return;
}
if (0 == dataLength)
{
- OIC_LOG_V(ERROR, WIFI_ADAPTER_TAG, "Invalid Data Length");
+ OIC_LOG(ERROR, WIFI_ADAPTER_TAG, "Invalid Data Length");
return dataSize;
}
CAWiFiData *wifiData = CACreateWiFiData(remoteEndpoint, data, dataLength);
if (!wifiData)
{
- OIC_LOG_V(ERROR, WIFI_ADAPTER_TAG, "Failed to create wifidata!");
+ OIC_LOG(ERROR, WIFI_ADAPTER_TAG, "Failed to create wifidata!");
return dataSize;
}
CAResult_t CAWiFiInitializeNetworkMonitor(const u_thread_pool_t threadPool)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
g_threadPool = threadPool;
g_nwConnectivityStatus = (g_wifiIPAddress) ? CA_INTERFACE_UP : CA_INTERFACE_DOWN;
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
void CAWiFiTerminateNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
g_threadPool = NULL;
g_wifiNetInfoMutex = NULL;
}
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
}
CAResult_t CAWiFiStartNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
u_mutex_lock(g_wifiNetInfoMutex);
g_stopNetworkMonitor = false;
if (g_stopNetworkMonitor)
{
- OIC_LOG_V(ERROR, WIFI_MONITOR_TAG, "Stop network monitor requested!");
+ OIC_LOG(ERROR, WIFI_MONITOR_TAG, "Stop network monitor requested!");
return CA_STATUS_FAILED;
}
CAResult_t CAWiFiStopNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
if (g_stopNetworkMonitor)
{
g_stopNetworkMonitor = true;
u_mutex_unlock(g_wifiNetInfoMutex);
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAWiFiGetInterfaceInfo(char **interfaceName, char **ipAddress)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
VERIFY_NON_NULL(interfaceName, WIFI_MONITOR_TAG, "interface name");
VERIFY_NON_NULL(ipAddress, WIFI_MONITOR_TAG, "ip address");
if (g_wifiInterfaceName == NULL || g_wifiIPAddress == NULL)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "Network not enabled");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "Network not enabled");
return CA_ADAPTER_NOT_ENABLED;
}
CAResult_t CAWiFiGetInterfaceSubnetMask(char **subnetMask)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
VERIFY_NON_NULL(subnetMask, WIFI_MONITOR_TAG, "subnet mask");
u_mutex_lock(g_wifiNetInfoMutex);
if (NULL == g_wifiSubnetMask)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "There is no subnet mask information!");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "There is no subnet mask information!");
return CA_STATUS_FAILED;
}
: NULL;
u_mutex_unlock(g_wifiNetInfoMutex);
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
bool CAWiFiIsConnected(void)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
if (g_nwConnectivityStatus == CA_INTERFACE_DOWN)
return false;
void CAWiFiSetConnectionStateChangeCallback(
CAWiFiConnectionStateChangeCallback callback)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
g_networkChangeCb = callback;
}
}
void CANetworkMonitorThread(void *threadData)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
while (!g_stopNetworkMonitor)
{
OICFree(subnetMask);
}
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
}
char *netMask = NULL;
if (CA_STATUS_OK != CAWiFiGetInterfaceSubnetMask(&netMask))
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Failed to get ethernet subnet");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Failed to get ethernet subnet");
continue;
}
#endif //__WITH_DTLS__
default:
// Should never occur
- OIC_LOG_V(DEBUG, WIFI_SERVER_TAG, "Invalid server type");
+ OIC_LOG(DEBUG, WIFI_SERVER_TAG, "Invalid server type");
if (ctx->stopFd != -1)
{
close(ctx->stopFd);
if (0 >= *port)
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Invalid input: port is invalid!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Invalid input: port is invalid!");
return CA_STATUS_INVALID_PARAM;
}
!= CAStartUnicastServer(localAddress, port, forceStart, isSecured,
&g_unicastServerSocketFD))
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
g_unicastServerSocketFD = -1;
u_mutex_unlock(g_mutexUnicastServer);
return CA_STATUS_FAILED;
if (CA_STATUS_OK != CAStartUnicastServer(localAddress, port, forceStart, isSecured,
&g_secureUnicastServerSocketFD))
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
g_secureUnicastServerSocketFD = -1;
u_mutex_unlock(g_mutexSecureUnicastServer);
return CA_STATUS_FAILED;
uint16_t port = multicastPort;
if (0 >= port)
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Invalid input: Multicast port is invalid!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Invalid input: Multicast port is invalid!");
return CA_STATUS_INVALID_PARAM;
}
if (g_multicastServerSocketFD != -1)
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Multicast Server is already running!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Multicast Server is already running!");
u_mutex_unlock(g_mutexMulticastServer);
return CA_SERVER_STARTED_ALREADY;
}
CAResult_t CAWiFiInitializeNetworkMonitor(const u_thread_pool_t threadPool)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
// Initialize Wifi service
wifi_error_e ret = wifi_initialize();
if (WIFI_ERROR_NONE != ret)
{
- OIC_LOG_V(ERROR, WIFI_MONITOR_TAG, "wifi_initialize failed");
+ OIC_LOG(ERROR, WIFI_MONITOR_TAG, "wifi_initialize failed");
return CA_STATUS_FAILED;
}
g_wifiNetInfoMutex = u_mutex_new();
}
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
void CAWiFiTerminateNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
// Deinitialize Wifi service
wifi_error_e ret = wifi_deinitialize();
if (WIFI_ERROR_NONE != ret)
{
- OIC_LOG_V(INFO, WIFI_MONITOR_TAG, "wifi_deinitialize failed");
+ OIC_LOG(INFO, WIFI_MONITOR_TAG, "wifi_deinitialize failed");
}
if (g_wifiInterfaceName)
g_wifiNetInfoMutex = NULL;
}
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
}
CAResult_t CAWiFiStartNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
// Set callback for receiving state changes
wifi_error_e ret = wifi_set_device_state_changed_cb(CAWIFIDeviceStateChangedCb, NULL);
if (WIFI_ERROR_NONE != ret)
{
- OIC_LOG_V(ERROR, WIFI_MONITOR_TAG, "wifi_set_device_state_changed_cb failed");
+ OIC_LOG(ERROR, WIFI_MONITOR_TAG, "wifi_set_device_state_changed_cb failed");
return CA_STATUS_FAILED;
}
ret = wifi_set_connection_state_changed_cb(CAWIFIConnectionStateChangedCb, NULL);
if (WIFI_ERROR_NONE != ret)
{
- OIC_LOG_V(ERROR, WIFI_MONITOR_TAG, "wifi_set_connection_state_changed_cb failed");
+ OIC_LOG(ERROR, WIFI_MONITOR_TAG, "wifi_set_connection_state_changed_cb failed");
return CA_STATUS_FAILED;
}
CAWiFiGetInterfaceInformation(&g_wifiInterfaceName, &g_wifiIPAddress, &g_wifiSubnetMask);
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAWiFiStopNetworkMonitor(void)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
// Reset callback for receiving state changes
wifi_error_e ret = wifi_unset_device_state_changed_cb();
if (WIFI_ERROR_NONE != ret)
{
- OIC_LOG_V(INFO, WIFI_MONITOR_TAG, "wifi_unset_device_state_changed_cb failed");
+ OIC_LOG(INFO, WIFI_MONITOR_TAG, "wifi_unset_device_state_changed_cb failed");
}
// Reset callback for receiving connection state changes
ret = wifi_unset_connection_state_changed_cb();
if (WIFI_ERROR_NONE != ret)
{
- OIC_LOG_V(INFO, WIFI_MONITOR_TAG, "wifi_unset_connection_state_changed_cb failed");
+ OIC_LOG(INFO, WIFI_MONITOR_TAG, "wifi_unset_connection_state_changed_cb failed");
}
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAWiFiGetInterfaceInfo(char **interfaceName, char **ipAddress)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
VERIFY_NON_NULL(interfaceName, WIFI_MONITOR_TAG, "interface name holder is NULL");
VERIFY_NON_NULL(ipAddress, WIFI_MONITOR_TAG, "IP address holder is NULL");
if (NULL == g_wifiInterfaceName || NULL == g_wifiIPAddress)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "Network not enabled");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "Network not enabled");
u_mutex_unlock(g_wifiNetInfoMutex);
return CA_ADAPTER_NOT_ENABLED;
}
u_mutex_unlock(g_wifiNetInfoMutex);
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAWiFiGetInterfaceSubnetMask(char **subnetMask)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
VERIFY_NON_NULL(subnetMask, WIFI_MONITOR_TAG, "subnet mask");
u_mutex_lock(g_wifiNetInfoMutex);
if (NULL == g_wifiSubnetMask)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "There is no subnet mask information!");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "There is no subnet mask information!");
u_mutex_unlock(g_wifiNetInfoMutex);
return CA_STATUS_FAILED;
}
*subnetMask = (g_wifiSubnetMask) ? OICStrdup((const char *)g_wifiSubnetMask): NULL;
u_mutex_unlock(g_wifiNetInfoMutex);
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
bool CAWiFiIsConnected(void)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
wifi_connection_state_e connection_state;
wifi_error_e ret = wifi_get_connection_state(&connection_state);
if (WIFI_ERROR_NONE != ret)
{
- OIC_LOG_V(ERROR, WIFI_MONITOR_TAG, "Failed to get the Connection State");
+ OIC_LOG(ERROR, WIFI_MONITOR_TAG, "Failed to get the Connection State");
return false;
}
if (WIFI_CONNECTION_STATE_DISCONNECTED == connection_state)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "WIFI is not Connected");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "WIFI is not Connected");
return false;
}
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return true;
}
void CAWiFiSetConnectionStateChangeCallback(
CAWiFiConnectionStateChangeCallback callback)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
g_networkChangeCb = callback;
}
void CAWIFIConnectionStateChangedCb(wifi_connection_state_e state, wifi_ap_h ap,
void *userData)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
if (WIFI_CONNECTION_STATE_ASSOCIATION == state
|| WIFI_CONNECTION_STATE_CONFIGURATION == state)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "Connection is in Association State");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "Connection is in Association State");
return;
}
g_networkChangeCb(g_wifiIPAddress, nwStatus);
}
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return;
}
void CAWIFIDeviceStateChangedCb(wifi_device_state_e state, void *userData)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
if (WIFI_DEVICE_STATE_ACTIVATED == state)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "Wifi is in Activated State");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "Wifi is in Activated State");
}
else
{
CAWIFIConnectionStateChangedCb(WIFI_CONNECTION_STATE_DISCONNECTED, NULL, NULL);
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "Wifi is in Deactivated State");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "Wifi is in Deactivated State");
}
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
return;
}
void CAWiFiGetInterfaceInformation(char **interfaceName, char **ipAddress, char **subnetMask)
{
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "IN");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "IN");
int ret = WIFI_ERROR_NONE;
u_mutex_unlock(g_wifiNetInfoMutex);
- OIC_LOG_V(DEBUG, WIFI_MONITOR_TAG, "OUT");
+ OIC_LOG(DEBUG, WIFI_MONITOR_TAG, "OUT");
}
char *netMask = NULL;
if (CA_STATUS_OK != CAWiFiGetInterfaceSubnetMask(&netMask))
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Failed to get ethernet subnet");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Failed to get ethernet subnet");
continue;
}
#endif //__WITH_DTLS__
default:
// Should never occur
- OIC_LOG_V(DEBUG, WIFI_SERVER_TAG, "Invalid server type");
+ OIC_LOG(DEBUG, WIFI_SERVER_TAG, "Invalid server type");
OICFree(ctx);
return;
}
if (0 >= *port)
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Invalid input: port is invalid!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Invalid input: port is invalid!");
return CA_STATUS_INVALID_PARAM;
}
if (CA_STATUS_OK != CAStartUnicastServer(localAddress, port, forceStart, isSecured,
&g_unicastServerSocketFD))
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
g_unicastServerSocketFD = -1;
u_mutex_unlock(g_mutexUnicastServer);
return CA_STATUS_FAILED;
if (CA_STATUS_OK != CAStartUnicastServer(localAddress, port, forceStart, isSecured,
&g_secureUnicastServerSocketFD))
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Failed to start unicast server!");
g_secureUnicastServerSocketFD = -1;
u_mutex_unlock(g_mutexSecureUnicastServer);
return CA_STATUS_FAILED;
uint16_t port = multicastPort;
if (0 >= port)
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Invalid input: Multicast port is invalid!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Invalid input: Multicast port is invalid!");
return CA_STATUS_INVALID_PARAM;
}
if (g_multicastServerSocketFD != -1)
{
- OIC_LOG_V(ERROR, WIFI_SERVER_TAG, "Multicast Server is already running!");
+ OIC_LOG(ERROR, WIFI_SERVER_TAG, "Multicast Server is already running!");
u_mutex_unlock(g_mutexMulticastServer);
return CA_SERVER_STARTED_ALREADY;
}