X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=android%2Fandroid_api%2Fbase%2Fjni%2FJniCaInterface.c;h=2a7861bc465a1f1e72095c9d71954b281d23c5c4;hb=7f00f942c39b7bc27c7eeecf213a239c3fe4173c;hp=8fdedd9b55a531f7ba701d9699c4daec6142e24b;hpb=edcfc3d2329da7b914771c0dcff5f42c9b74fd93;p=platform%2Fupstream%2Fiotivity.git diff --git a/android/android_api/base/jni/JniCaInterface.c b/android/android_api/base/jni/JniCaInterface.c index 8fdedd9..2a7861b 100644 --- a/android/android_api/base/jni/JniCaInterface.c +++ b/android/android_api/base/jni/JniCaInterface.c @@ -356,6 +356,43 @@ Java_org_iotivity_ca_CaInterface_setLeScanIntervalTimeImpl(JNIEnv *env, jclass c 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) { @@ -370,3 +407,33 @@ JNIEXPORT jint JNICALL Java_org_iotivity_ca_CaInterface_setCipherSuiteImpl 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; +} +