+
+jobject CALEGetRemoteDevice(JNIEnv *env, jstring address)
+{
+ OIC_LOG(DEBUG, TAG, "IN - CALEGetRemoteDevice");
+
+ VERIFY_NON_NULL_RET(env, TAG, "env is null", NULL);
+ VERIFY_NON_NULL_RET(address, TAG, "address is null", NULL);
+
+ jclass jni_cid_BTAdapter = (*env)->FindClass(env, CLASSPATH_BT_ADAPTER);
+ if (!jni_cid_BTAdapter)
+ {
+ OIC_LOG(ERROR, TAG, "jni_cid_BTAdapter is null");
+ return NULL;
+ }
+
+ // get remote bt adapter method
+ jmethodID jni_mid_getDefaultAdapter = (*env)->GetStaticMethodID(env, jni_cid_BTAdapter,
+ "getDefaultAdapter",
+ METHODID_OBJECTNONPARAM);
+ if (!jni_mid_getDefaultAdapter)
+ {
+ OIC_LOG(ERROR, TAG, "jni_mid_getDefaultAdapter is null");
+ return NULL;
+ }
+
+ // gat bt adapter object
+ jobject jni_obj_BTAdapter = (*env)->CallStaticObjectMethod(env, jni_cid_BTAdapter,
+ jni_mid_getDefaultAdapter);
+ if (!jni_obj_BTAdapter)
+ {
+ OIC_LOG(ERROR, TAG, "jni_obj_BTAdapter is null");
+ return NULL;
+ }
+
+ jmethodID jni_mid_getRemoteDevice = (*env)->GetMethodID(env, jni_cid_BTAdapter,
+ "getRemoteDevice",
+ METHODID_BT_REMOTE_DEVICE);
+ if (!jni_mid_getRemoteDevice)
+ {
+ OIC_LOG(ERROR, TAG, "jni_mid_getRemoteDevice is null");
+ return NULL;
+ }
+
+ jobject jni_obj_device = (*env)->CallObjectMethod(env, jni_obj_BTAdapter,
+ jni_mid_getRemoteDevice,
+ address);
+ if (!jni_obj_device)
+ {
+ OIC_LOG(ERROR, TAG, "jni_obj_device is null");
+ return NULL;
+ }
+
+ OIC_LOG(DEBUG, TAG, "OUT - CALEGetRemoteDevice");
+ return jni_obj_device;
+}