(*env)->DeleteGlobalRef(env, g_jni_cls_enum);
g_jni_cls_enum = NULL;
}
-
- if (g_jni_mid_enum)
- {
- (*env)->DeleteGlobalRef(env, g_jni_mid_enum);
- g_jni_mid_enum = NULL;
- }
}
JNIEXPORT void JNICALL
jstring jaddress)
{
LOGI("CaManager_setAutoConnectionDeviceInfo");
+ if (!jaddress)
+ {
+ LOGE("jaddress is null");
+ return;
+ }
const char* address = (*env)->GetStringUTFChars(env, jaddress, NULL);
if (!address)
jstring jaddress)
{
LOGI("CaManager_unsetAutoConnectionDeviceInfo");
+ if (!jaddress)
+ {
+ LOGE("jaddress is null");
+ return;
+ }
const char* address = (*env)->GetStringUTFChars(env, jaddress, NULL);
if (!address)
CAUtilSetLEScanInterval(intervalTime, workignCount);
}
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_CaInterface_stopLeScanImpl(JNIEnv *env, jclass clazz)
+{
+ LOGI("stopLeScan");
+ (void)env;
+ (void)clazz;
+ CAUtilStopLEScan();
+}
+
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_CaInterface_startLeAdvertisingImpl(JNIEnv *env, jclass clazz)
+{
+ LOGI("startLeAdvertising");
+ (void)env;
+ (void)clazz;
+ CAUtilStartLEAdvertising();
+}
+
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_CaInterface_stopLeAdvertisingImpl(JNIEnv *env, jclass clazz)
+{
+ LOGI("stopLeAdvertising");
+ (void)env;
+ (void)clazz;
+ CAUtilStopLEAdvertising();
+}
+
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_CaInterface_setBTConfigureImpl(JNIEnv *env, jclass clazz, jint flag)
+{
+ LOGI("setConfigureImpl");
+ (void)env;
+ (void)clazz;
+ CAUtilConfig_t configs = {(CATransportBTFlags_t)flag};
+ CAUtilSetBTConfigure(configs);
+}
+
+JNIEXPORT jint JNICALL Java_org_iotivity_ca_CaInterface_setCipherSuiteImpl
+ (JNIEnv *env, jclass clazz, jint cipherSuite, jint adapter)
+{
+ LOGI("setCipherSuiteImpl");
+ (void)env;
+ (void)clazz;
+ CAResult_t ret = CASelectCipherSuite(cipherSuite, (CATransportAdapter_t) adapter);
+ if (CA_STATUS_OK != ret)
+ {
+ LOGE("CASelectCipherSuite has failed");
+ }
+ return ret;
+}
+
+JNIEXPORT jint JNICALL Java_org_iotivity_ca_CaInterface_disconnectTCPSessionImpl
+ (JNIEnv *env, jclass clazz, jstring address, jint port, jint transportFlags)
+{
+ LOGI("disconnectTCPSessionImpl");
+ (void)env;
+ (void)clazz;
+
+ if(!address)
+ {
+ LOGE("Java address is null");
+ return CA_STATUS_INVALID_PARAM;
+ }
+
+ //convert java string to native string
+ const char* nativeAddress = (*env)->GetStringUTFChars(env, address, NULL);
+ if (!nativeAddress)
+ {
+ LOGE("Native address is null");
+ return CA_STATUS_INVALID_PARAM;
+ }
+
+ CAResult_t result = CAUtilTCPDisconnectSession(nativeAddress, (int)port,
+ (CATransportFlags_t)transportFlags);
+ if (CA_STATUS_OK != result)
+ {
+ LOGE("disconnectTCPSessionImpl failed");
+ }
+ return result;
+}
+