replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / android / android_api / base / src / main / java / org / iotivity / base / PlatformConfig.java
index e298514..e02602c 100644 (file)
@@ -1,30 +1,30 @@
 /*
- * //******************************************************************
- * //
- * // Copyright 2015 Intel Corporation.
- * //
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- * //
- * // Licensed under the Apache License, Version 2.0 (the "License");
- * // you may not use this file except in compliance with the License.
- * // You may obtain a copy of the License at
- * //
- * //      http://www.apache.org/licenses/LICENSE-2.0
- * //
- * // Unless required by applicable law or agreed to in writing, software
- * // distributed under the License is distributed on an "AS IS" BASIS,
- * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * // See the License for the specific language governing permissions and
- * // limitations under the License.
- * //
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ *******************************************************************
+ *
+ * Copyright 2015 Intel Corporation.
+ *
+ *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  */
 
 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
@@ -105,7 +135,7 @@ public class PlatformConfig {
      *                         specify port
      * @param qualityOfService quality of service
      */
-    //Avoid breaking building java samples due to persistent storage SVR DB changes.
+    // Avoid breaking building java samples due to persistent storage SVR DB changes.
     public PlatformConfig(Context context,
                           ServiceType serviceType,
                           ModeType modeType,
@@ -128,9 +158,9 @@ public class PlatformConfig {
      *                         specify port
      * @param qualityOfService quality of service
      */
-    //Avoid breaking building java samples due to persistent storage SVR DB changes.
+    // Avoid breaking building java samples due to persistent storage SVR DB changes.
     public PlatformConfig(Activity activity,
-                            Context context,
+                          Context context,
                           ServiceType serviceType,
                           ModeType modeType,
                           String ipAddress,
@@ -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;
+    }
 }