}
private static native void stopLeScanImpl();
+ /**
+ * start BLE Advertising.
+ */
+ public synchronized static void startLeAdvertising(){
+ CaInterface.startLeAdvertisingImpl();
+ }
+ private static native void startLeAdvertisingImpl();
+
+ /**
+ * stop BLE Advertising.
+ */
+ public synchronized static void stopLeAdvertising(){
+ CaInterface.stopLeAdvertisingImpl();
+ }
+ private static native void stopLeAdvertisingImpl();
+
public synchronized static int setCipherSuite(OicCipher cipher, OcConnectivityType connType){
return CaInterface.setCipherSuiteImpl(cipher.getValue(), connType.getValue());
}
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 jint JNICALL Java_org_iotivity_ca_CaInterface_setCipherSuiteImpl
(JNIEnv *env, jclass clazz, jint cipherSuite, jint adapter)
{
CAResult_t CAUtilStopLEScan();
#endif //__JAVA__
+#if defined(LE_ADAPTER)
+// BLE util
+/**
+ * start BLE advertising.
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CAUtilStartLEAdvertising();
+
+/**
+ * stop BLE advertising.
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CAUtilStopLEAdvertising();
+#endif // LE_ADAPTER
+
#ifdef __cplusplus
} /* extern "C" */
#endif //__cplusplus
* stop BLE scan.
*/
void CAManagerLEStopScan();
-
#endif
+/**
+ * start BLE advertising.
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CAManagerLEStartAdvertising();
+
+/**
+ * stop BLE advertising.
+ * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
+ */
+CAResult_t CAManagerLEStopAdvertising();
+
#ifdef __cplusplus
} /* extern "C" */
#endif
CALERestartScanWithInterval(0, 0, BLE_SCAN_DISABLE);
}
+CAResult_t CAManagerLEStartAdvertising()
+{
+ CAResult_t ret = CALEServerStartAdvertise();
+ if (CA_STATUS_OK != ret)
+ {
+ OIC_LOG(ERROR, TAG, "CALEServerStartAdvertise has failed");
+ }
+ return ret;
+}
+
+CAResult_t CAManagerLEStopAdvertising()
+{
+ CAResult_t ret = CALEServerStopAdvertise();
+ if (CA_STATUS_OK != ret)
+ {
+ OIC_LOG(ERROR, TAG, "CALEServerStopAdvertise has failed");
+ }
+ return ret;
+}
+
JNIEXPORT void JNICALL
Java_org_iotivity_ca_CaLeClientInterface_caManagerAdapterStateChangedCallback(
JNIEnv *env, jobject obj, jint state)
return CA_NOT_SUPPORTED;
#endif
}
+#endif // __JAVA__
+
+#if defined(LE_ADAPTER)
+CAResult_t CAUtilStartLEAdvertising()
+{
+ OIC_LOG(DEBUG, TAG, "CAUtilStartLEAdvertising");
+#if defined(__ANDROID__) || defined(__TIZEN__)
+ return CAManagerLEStartAdvertising();
+#else
+ OIC_LOG(DEBUG, TAG, "it is not supported");
+ return CA_NOT_SUPPORTED;
+#endif
+}
+
+CAResult_t CAUtilStopLEAdvertising()
+{
+ OIC_LOG(DEBUG, TAG, "CAUtilStopLEAdvertising");
+#if defined(__ANDROID__) || defined(__TIZEN__)
+ return CAManagerLEStopAdvertising();
+#else
+ OIC_LOG(DEBUG, TAG, "it is not supported");
+ return CA_NOT_SUPPORTED;
+#endif
+}
#endif