jni_mid_getDescriptor, jni_obj_cc_uuid);
if (!jni_obj_descriptor)
{
- OIC_LOG(ERROR, TAG, "jni_obj_descriptor is null");
- return CA_STATUS_FAILED;
+ OIC_LOG(INFO, TAG, "jni_obj_descriptor is null");
+ return CA_NOT_SUPPORTED;
}
OIC_LOG(DEBUG, TAG, "set value in descriptor");
CAResult_t CALEClientAddScanDeviceToList(JNIEnv *env, jobject device)
{
- OIC_LOG(DEBUG, TAG, "IN - CALEClientAddScanDeviceToList");
VERIFY_NON_NULL(device, TAG, "device is null");
VERIFY_NON_NULL(env, TAG, "env is null");
jobject gdevice = (*env)->NewGlobalRef(env, device);
u_arraylist_add(g_deviceList, gdevice);
ca_cond_signal(g_deviceDescCond);
- OIC_LOG(DEBUG, TAG, "Set Object to Array as Element");
+ OIC_LOG_V(DEBUG, TAG, "Added this Device[%d] in the List", remoteAddress);
}
(*env)->ReleaseStringUTFChars(env, jni_remoteAddress, remoteAddress);
ca_mutex_unlock(g_deviceListMutex);
- OIC_LOG(DEBUG, TAG, "OUT - CALEClientAddScanDeviceToList");
return CA_STATUS_OK;
}
bool CALEClientIsDeviceInScanDeviceList(JNIEnv *env, const char* remoteAddress)
{
- OIC_LOG(DEBUG, TAG, "IN - CALEClientIsDeviceInScanDeviceList");
VERIFY_NON_NULL_RET(env, TAG, "env is null", NULL);
VERIFY_NON_NULL_RET(remoteAddress, TAG, "remoteAddress is null", true);
(*env)->ReleaseStringUTFChars(env, jni_setAddress, setAddress);
}
- OIC_LOG(DEBUG, TAG, "OUT - CALEClientIsDeviceInScanDeviceList");
OIC_LOG(DEBUG, TAG, "there are no the device in list. we can add");
return false;
CAResult_t CALEClientInitGattMutexVaraibles()
{
- OIC_LOG(DEBUG, TAG, "IN");
-
if (NULL == g_bleReqRespClientCbMutex)
{
g_bleReqRespClientCbMutex = ca_mutex_new();
}
}
- OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
void CALEClientTerminateGattMutexVariables()
{
- OIC_LOG(DEBUG, TAG, "IN");
-
ca_mutex_free(g_bleReqRespClientCbMutex);
g_bleReqRespClientCbMutex = NULL;
ca_mutex_free(g_scanMutex);
g_scanMutex = NULL;
-
- OIC_LOG(DEBUG, TAG, "OUT");
}
void CALEClientSetSendFinishFlag(bool flag)
void CASetLEReqRespClientCallback(CABLEDataReceivedCallback callback)
{
- OIC_LOG(DEBUG, TAG, "IN");
-
ca_mutex_lock(g_bleReqRespClientCbMutex);
g_CABLEClientDataReceivedCallback = callback;
ca_mutex_unlock(g_bleReqRespClientCbMutex);
-
- OIC_LOG(DEBUG, TAG, "OUT");
}
void CASetLEClientThreadPoolHandle(ca_thread_pool_t handle)
{
- OIC_LOG(DEBUG, TAG, "IN");
-
CALEClientInitialize(handle);
-
- OIC_LOG(DEBUG, TAG, "OUT");
}
CAResult_t CAGetLEAddress(char **local_address)
res = CALEClientSetUUIDToDescriptor(env, gatt, jni_obj_GattCharacteristic);
if (CA_STATUS_OK != res)
{
- OIC_LOG(INFO, TAG, "Descriptor of the uuid is not found");
+ OIC_LOG_V(INFO, TAG, "Descriptor is not found : %d", res);
CAResult_t res = CALEClientWriteCharacteristic(env, gatt);
if (CA_STATUS_OK != res)
{
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (JNI_OK != res)
{
- OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(INFO, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (JNI_OK != res)
CAResult_t CALEServerStopAdvertise(JNIEnv *env, jobject advertiseCallback)
{
- OIC_LOG(DEBUG, TAG, "IN - LEServerStopAdvertise");
+ OIC_LOG(DEBUG, TAG, "LEServerStopAdvertise");
VERIFY_NON_NULL(env, TAG, "env is null");
VERIFY_NON_NULL(advertiseCallback, TAG, "advertiseCallback is null");
}
OIC_LOG(DEBUG, TAG, "Advertising stopped!!");
-
- OIC_LOG(DEBUG, TAG, "OUT - LEServerStopAdvertise");
return CA_STATUS_OK;
}
CAResult_t CALEServerAddDescriptor(JNIEnv *env, jobject characteristic)
{
- OIC_LOG(DEBUG, TAG, "IN - CALEServerAddDescriptor");
+ OIC_LOG(DEBUG, TAG, "CALEServerAddDescriptor");
VERIFY_NON_NULL(env, TAG, "env is null");
VERIFY_NON_NULL(characteristic, TAG, "characteristic is null");
{
OIC_LOG(DEBUG, TAG, "addDescriptor success");
}
-
- OIC_LOG(DEBUG, TAG, "OUT - CALEServerAddDescriptor");
return CA_STATUS_OK;
}
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (JNI_OK != res)
{
- OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(INFO, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (JNI_OK != res)
CAResult_t CALEServerSendUnicastMessage(const char* address, const uint8_t* data, uint32_t dataLen)
{
- OIC_LOG_V(DEBUG, TAG, "IN - CALEServerSendUnicastMessage(%s, %p)", address, data);
+ OIC_LOG_V(DEBUG, TAG, "CALEServerSendUnicastMessage(%s, %p)", address, data);
VERIFY_NON_NULL(address, TAG, "address is null");
VERIFY_NON_NULL(data, TAG, "data is null");
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (JNI_OK != res)
{
- OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(INFO, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (JNI_OK != res)
(*g_jvm)->DetachCurrentThread(g_jvm);
}
- OIC_LOG(DEBUG, TAG, "OUT - CALEServerSendUnicastMessage");
return ret;
}
CAResult_t CALEServerSendMulticastMessage(const uint8_t* data, uint32_t dataLen)
{
- OIC_LOG_V(DEBUG, TAG, "IN - CALEServerSendMulticastMessage(%p)", data);
+ OIC_LOG_V(DEBUG, TAG, "CALEServerSendMulticastMessage(%p)", data);
VERIFY_NON_NULL(data, TAG, "data is null");
if (!g_jvm)
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (JNI_OK != res)
{
- OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(INFO, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (JNI_OK != res)
(*g_jvm)->DetachCurrentThread(g_jvm);
}
- OIC_LOG(DEBUG, TAG, "OUT - CALEServerSendMulticastMessage");
return ret;
}
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (JNI_OK != res)
{
- OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(INFO, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (JNI_OK != res)
jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
if (JNI_OK != res)
{
- OIC_LOG(ERROR, TAG, "Could not get JNIEnv pointer");
+ OIC_LOG(INFO, TAG, "Could not get JNIEnv pointer");
res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
if (JNI_OK != res)
CAResult_t CALEServerSendUnicastMessageImpl(JNIEnv *env, const char* address, const uint8_t* data,
uint32_t dataLen)
{
- OIC_LOG_V(DEBUG, TAG, "IN - CALEServerSendUnicastMessageImpl, address: %s, data: %p",
+ OIC_LOG_V(DEBUG, TAG, "CALEServerSendUnicastMessageImpl, address: %s, data: %p",
address, data);
VERIFY_NON_NULL(env, TAG, "env is null");
VERIFY_NON_NULL(address, TAG, "address is null");
return CA_STATUS_FAILED;
}
- OIC_LOG(DEBUG, TAG, "OUT - CALEServerSendUnicastMessageImpl");
return CA_STATUS_OK;
}
CAResult_t CALEServerSendMulticastMessageImpl(JNIEnv *env, const uint8_t *data, uint32_t dataLen)
{
- OIC_LOG_V(DEBUG, TAG, "IN - CALEServerSendMulticastMessageImpl, send to, data: %s", data);
+ OIC_LOG_V(DEBUG, TAG, "CALEServerSendMulticastMessageImpl, send to, data: %s", data);
VERIFY_NON_NULL(env, TAG, "env is null");
VERIFY_NON_NULL(data, TAG, "data is null");
}
}
- OIC_LOG(DEBUG, TAG, "OUT - CALEServerSendMulticastMessageImpl");
return CA_STATUS_OK;
}
void CALEServerCreateCachedDeviceList()
{
- OIC_LOG(DEBUG, TAG, "IN - CALEServerCreateCachedDeviceList");
-
ca_mutex_lock(g_connectedDeviceListMutex);
// create new object array
if (!g_connectedDeviceList)
g_connectedDeviceList = u_arraylist_create();
}
ca_mutex_unlock(g_connectedDeviceListMutex);
-
- OIC_LOG(DEBUG, TAG, "OUT - CALEServerCreateCachedDeviceList");
}
bool CALEServerIsDeviceInList(JNIEnv *env, const char* remoteAddress)
{
- OIC_LOG(DEBUG, TAG, "IN - CALEServerIsDeviceInList");
VERIFY_NON_NULL_RET(env, TAG, "env is null", false);
VERIFY_NON_NULL_RET(remoteAddress, TAG, "remoteAddress is null", false);
}
OIC_LOG(DEBUG, TAG, "there are no device in the list");
- OIC_LOG(DEBUG, TAG, "OUT - CALEServerCreateCachedDeviceList");
return false;
}
CAResult_t CAStartLEGattServer()
{
- OIC_LOG(DEBUG, TAG, "IN");
-
CAResult_t ret = CALEServerInitMutexVaraibles();
if (CA_STATUS_OK != ret)
{
// start gatt service
CALEServerStartMulticastServer();
- OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
CAResult_t CAStopLEGattServer()
{
- OIC_LOG(DEBUG, TAG, "IN");
-
- OIC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "this method is not supported");
return CA_STATUS_OK;
}
void CATerminateLEGattServer()
{
- OIC_LOG(DEBUG, TAG, "IN");
-
OIC_LOG(DEBUG, TAG, "Terminat Gatt Server");
CALEServerTerminate();
-
- OIC_LOG(DEBUG, TAG, "OUT");
}
void CASetLEReqRespServerCallback(CABLEDataReceivedCallback callback)
{
- OIC_LOG(DEBUG, TAG, "IN");
-
ca_mutex_lock(g_bleReqRespCbMutex);
g_CABLEServerDataReceivedCallback = callback;
ca_mutex_unlock(g_bleReqRespCbMutex);
-
- OIC_LOG(DEBUG, TAG, "OUT");
}
void CASetBLEServerErrorHandleCallback(CABLEErrorHandleCallback callback)
uint32_t charValueLen)
{
CAResult_t result = CA_SEND_FAILED;
- OIC_LOG(DEBUG, TAG, "IN");
VERIFY_NON_NULL(address, TAG, "env is null");
VERIFY_NON_NULL(charValue, TAG, "device is null");
if (address)
{
- OIC_LOG(DEBUG, TAG, "CALEServerSendUnicastData");
result = CALEServerSendUnicastMessage(address, charValue, charValueLen);
}
- OIC_LOG(DEBUG, TAG, "OUT");
-
return result;
}
CAResult_t CAUpdateCharacteristicsToAllGattClients(const uint8_t *charValue,
uint32_t charValueLen)
{
- OIC_LOG(DEBUG, TAG, "IN");
VERIFY_NON_NULL(charValue, TAG, "device is null");
- OIC_LOG(DEBUG, TAG, "CALEServerSendMulticastMessage");
CAResult_t result = CALEServerSendMulticastMessage(charValue, charValueLen);
- OIC_LOG(DEBUG, TAG, "OUT");
return result;
}
void CASetLEServerThreadPoolHandle(ca_thread_pool_t handle)
{
- OIC_LOG(DEBUG, TAG, "IN");
-
CALEServerInitialize(handle);
-
- OIC_LOG(DEBUG, TAG, "OUT");
}
CAResult_t CALEServerInitMutexVaraibles()
{
- OIC_LOG(DEBUG, TAG, "IN");
if (NULL == g_bleReqRespCbMutex)
{
g_bleReqRespCbMutex = ca_mutex_new();
}
}
- OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
void CALEServerTerminateMutexVaraibles()
{
- OIC_LOG(DEBUG, TAG, "IN");
-
ca_mutex_free(g_bleReqRespCbMutex);
g_bleReqRespCbMutex = NULL;
ca_mutex_free(g_connectedDeviceListMutex);
g_connectedDeviceListMutex = NULL;
-
- OIC_LOG(DEBUG, TAG, "OUT");
}
void CALEServerTerminateConditionVaraibles()