/*
- * //******************************************************************
- * //
- * // 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.
*/
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
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
* 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,
* 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,
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;
+ }
}