replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / android / examples / simplebase / src / main / java / org / iotivity / base / examples / Common.java
index 96f90c6..8382e4b 100644 (file)
@@ -24,6 +24,7 @@ package org.iotivity.base.examples;
 
 import android.content.Context;
 import android.widget.Toast;
+import android.util.Log;
 
 import org.iotivity.base.OcPlatform;
 import org.iotivity.base.ResourceProperty;
@@ -39,10 +40,14 @@ import java.util.Locale;
  */
 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 static final String COAPS_TCP          = "coaps+tcp://";
     public static String       TCP_ADDRESS        = "192.168.0.1";
-    public static final String TCP_PORT           = ":8000";
+    public static String       TCP_PORT           = "5683";
+    public static final String PORT_SEPARATOR     = ":";
     public static final String IP_ADDRESS         = "0.0.0.0";
     public static final int    IP_PORT            = 0;
     public static final String GET_COMMAND        = "get_command";
@@ -56,14 +61,20 @@ public class Common {
     public static final EnumSet<ResourceProperty> RESOURCE_PROPERTIES =
             EnumSet.of(ResourceProperty.DISCOVERABLE, ResourceProperty.OBSERVABLE);
 
+    // MQ
+    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 {
             Calendar calendar = Calendar.getInstance();
             calendar.setTimeInMillis(System.currentTimeMillis());
             DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT,
-                                                                   DateFormat.DEFAULT,
-                                                                   Locale.getDefault());
+                    DateFormat.DEFAULT,
+                    Locale.getDefault());
             Date currentTimeZone = calendar.getTime();
             sb.append(dateFormat.format(currentTimeZone));
         } catch (Exception e) {
@@ -75,4 +86,17 @@ public class Common {
     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;
+    }
 }
+