static ca_cond g_threadSendNotifyCond = NULL;
static bool g_isSignalSetFlag = false;
+static const char CLASSPATH_BT_ADVERTISE_CB[] = "android/bluetooth/le/AdvertiseCallback";
+
void CALEServerJNISetContext()
{
OIC_LOG(DEBUG, TAG, "CALEServerJNISetContext");
return CA_STATUS_FAILED;
}
+ // Device name has to be included in advertise packet after Android API 23
+ OIC_LOG(DEBUG, TAG, "device name will be added into advertise packet");
+ jmethodID jni_mid_setIncludeDeviceName = (*env)->GetMethodID(env, jni_cid_AdvertiseDataBuilder,
+ "setIncludeDeviceName",
+ "(Z)Landroid/"
+ "bluetooth/le/"
+ "AdvertiseData$Builder;");
+ if (!jni_mid_setIncludeDeviceName)
+ {
+ OIC_LOG(ERROR, TAG, "jni_mid_setIncludeDeviceName is null");
+ return CA_STATUS_FAILED;
+ }
+
+ jobject jni_obj_setIncludeDeviceName = (*env)->CallObjectMethod(env, jni_AdvertiseDataBuilder,
+ jni_mid_setIncludeDeviceName,
+ JNI_TRUE);
+ if (!jni_obj_setIncludeDeviceName)
+ {
+ OIC_LOG(ERROR, TAG, "jni_obj_setIncludeDeviceName is null");
+ return CA_STATUS_FAILED;
+ }
+
jclass jni_cid_BTAdapter = (*env)->FindClass(env, "android/bluetooth/BluetoothAdapter");
if (!jni_cid_BTAdapter)
{
VERIFY_NON_NULL_VOID(obj, TAG, "obj");
OIC_LOG_V(INFO, TAG, "LE Advertise Start Failure Callback(%d)", errorCode);
+
+ jint data_too_large = CALEGetConstantsValue(env, CLASSPATH_BT_ADVERTISE_CB,
+ "ADVERTISE_FAILED_DATA_TOO_LARGE");
+ if (data_too_large == errorCode)
+ {
+ OIC_LOG_V(ERROR, TAG, "advertise data too large. please check length of device name");
+ }
}
/**