X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=android%2Fandroid_api%2Fbase%2Fsrc%2Fmain%2Fjava%2Forg%2Fiotivity%2Fca%2FCaInterface.java;h=73fec6c8721dea542f1ced25992c01f2c560d977;hb=3c093548382bb2542c87a67e6e5fa32552c29cb3;hp=6924eb417b53d256a08acf6ea8b956dcdb8ce2cb;hpb=edcfc3d2329da7b914771c0dcff5f42c9b74fd93;p=platform%2Fupstream%2Fiotivity.git diff --git a/android/android_api/base/src/main/java/org/iotivity/ca/CaInterface.java b/android/android_api/base/src/main/java/org/iotivity/ca/CaInterface.java index 6924eb4..73fec6c 100644 --- a/android/android_api/base/src/main/java/org/iotivity/ca/CaInterface.java +++ b/android/android_api/base/src/main/java/org/iotivity/ca/CaInterface.java @@ -28,6 +28,8 @@ import android.bluetooth.BluetoothDevice; import org.iotivity.base.OcException; import org.iotivity.base.OcConnectivityType; +import java.util.EnumSet; + public class CaInterface { static { System.loadLibrary("connectivity_abstraction"); @@ -186,17 +188,72 @@ public class CaInterface { * @param intervalTime interval time(Seconds). * @param workingCount working count with interval time. */ - public synchronized static void setLeScanIntervalTime(int intervalTime, int workingCount){ CaInterface.setLeScanIntervalTimeImpl(intervalTime, workingCount); } - private static native void setLeScanIntervalTimeImpl(int intervalTime, int workingCount); + /** + * stop BLE scan. + * if you want to start scan, it can be triggered by setLeScanIntervalTime or + * other request API like findResource. + */ + public synchronized static void stopLeScan(){ + CaInterface.stopLeScanImpl(); + } + 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(); + + /** + * set BT configure + */ + public synchronized static void setBTConfigure(int flag){ + CaInterface.setBTConfigureImpl(flag); + } + private static native void setBTConfigureImpl(int flag); public synchronized static int setCipherSuite(OicCipher cipher, OcConnectivityType connType){ return CaInterface.setCipherSuiteImpl(cipher.getValue(), connType.getValue()); } private static native int setCipherSuiteImpl(int cipher, int adapter); + /** + * Disconnect TCP session. + * It will disconnect the current TCP session. + * + * @param address host address [IP address]. + * @param port Port number. + * @param transportFlags Set of Transport flags. + * + * @return Result of the API call. + * + * @see CaTransportFlags + */ + public synchronized static int disconnectTCPSession(String address, int port, + EnumSet transportFlags) { + int transPortFlagsInt = 0; + for (CaTransportFlags flag : CaTransportFlags.values()) { + if (transportFlags.contains(flag)) { + transPortFlagsInt |= flag.getValue(); + } + } + + return CaInterface.disconnectTCPSessionImpl(address, port, transPortFlagsInt); + } + private static native int disconnectTCPSessionImpl(String address, int port, int flags); }