replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / android / android_api / base / src / main / java / org / iotivity / base / PlatformConfig.java
index b41b65c..e02602c 100644 (file)
@@ -24,7 +24,7 @@ package org.iotivity.base;
 
 import android.content.Context;
 import android.app.Activity;
-
+import java.util.EnumSet;
 /**
  * Data structure to provide the configuration.
  */
@@ -38,6 +38,11 @@ public class PlatformConfig {
     private QualityOfService mQualityOfService;
     private String mSvrDbPath; //TODO: Instead of SVRDB file, it should be Persistent Storage.
                               //this is only for 0.9.2
+    private String mSvrDbPathDefault;
+    private String mSvrDbPathRescue;
+    private int mKeySize;
+    private byte[] mKey;
+    private int mTransportType;
     /**
      * @param activity         app activity
      * @param context          app context
@@ -68,8 +73,33 @@ public class PlatformConfig {
         this.mPort = port;
         this.mQualityOfService = qualityOfService;
         this.mSvrDbPath = dbPath;
+        this.mTransportType = 0;
     }
 
+    public PlatformConfig(Context context,
+                          ServiceType serviceType,
+                          ModeType modeType,
+                          String ipAddress,
+                          int port,
+                          QualityOfService qualityOfService,
+                          String dbPath,
+                          String dbPathDefault,
+                          String dbPathRescue,
+                          int keySize,
+                          byte[] key) {
+        this.mContext = context;
+        this.mServiceType = serviceType;
+        this.mModeType = modeType;
+        this.mIpAddress = ipAddress;
+        this.mPort = port;
+        this.mQualityOfService = qualityOfService;
+        this.mSvrDbPath = dbPath;
+        this.mSvrDbPathDefault = dbPathDefault;
+        this.mSvrDbPathRescue = dbPathRescue;
+        this.mKeySize = keySize;
+        this.mKey = key;
+        this.mTransportType = 0;
+    }
     /**
      * @param context          app context
      * @param serviceType      indicate IN_PROC or OUT_OF_PROC
@@ -170,4 +200,32 @@ public class PlatformConfig {
         return mActivity;
     }
 
+    public String getDBDefaultPath() {
+        return mSvrDbPathDefault;
+    }
+
+    public String getDBRescuePath() {
+        return mSvrDbPathRescue;
+    }
+
+    public int getKeySize()
+    {
+        return mKeySize;
+    }
+
+    public byte[] getKey()
+    {
+        return mKey;
+    }
+
+    public void setAvailableTransportType(EnumSet<OcConnectivityType> type) {
+        for (OcConnectivityType connType : OcConnectivityType.values()) {
+            if (type.contains(connType))
+                mTransportType |= connType.getValue();
+        }
+    }
+
+    public int getAvailableTransportType() {
+        return mTransportType;
+    }
 }