sb.append("Set Connect with : ");
try {
final String address = mBluetoothDevices.get(pos).getAddress();
+ Common.setLeAddress(address);
CaInterface.setAutoConnectionDevice(address);
OcPlatform.OnResourceFoundListener resourceFoundListener =
new OcPlatform.OnResourceFoundListener() {
import android.content.Context;
import android.widget.Toast;
+import android.util.Log;
import org.iotivity.base.OcPlatform;
import org.iotivity.base.ResourceProperty;
*/
public class Common {
+ private static final String TAG = "OIC_SIMPLE_COMMON";
public static final int DATA_SIZE = 3000;
public static String HOST = "coap+tcp://192.168.0.1:5683";
public static final String COAP_TCP = "coap+tcp://";
public final static String MQ_DEFAULT_TOPIC_URI = "/oic/ps/cleanroom";
public final static String MQ_BROKER_URI = "/oic/ps";
+ private static String mLeAddress = null;
+
public static String getDateCurrentTimeZone() {
StringBuilder sb = new StringBuilder();
try {
public static void showToast(Context context, String msg) {
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}
+
+ public static void setLeAddress(String address)
+ {
+ Log.i(TAG, "setLeAddress : " + address.toString());
+ mLeAddress = address;
+ }
+
+ public static String getLeAddress()
+ {
+ Log.i(TAG, "getLeAddress : " + mLeAddress);
+ return mLeAddress;
+ }
}
OcPlatform.WELL_KNOWN_QUERY,
EnumSet.of(OcConnectivityType.CT_ADAPTER_IP),
resourceFoundListener, mQos);
+ } else if (OcConnectivityType.CT_ADAPTER_GATT_BTLE == connectivityType) {
+ if (null != Common.getLeAddress())
+ {
+ OcPlatform.findResource("",
+ Common.getLeAddress() + OcPlatform.WELL_KNOWN_QUERY,
+ EnumSet.of(OcConnectivityType.CT_ADAPTER_GATT_BTLE),
+ resourceFoundListener, QualityOfService.LOW);
+ } else {
+ Common.showToast(mContext, "Please scan ble device");
+ Log.e(TAG, "invalid ble device");
+ }
} else {
OcPlatform.findResource("",
OcPlatform.WELL_KNOWN_QUERY,