package org.iotivity.base;
import android.content.Context;
+import android.app.Activity;
/**
* Data structure to provide the configuration.
*/
public class PlatformConfig {
-
+ private Activity mActivity;
private Context mContext;
private ServiceType mServiceType;
private ModeType mModeType;
private QualityOfService mQualityOfService;
private String mSvrDbPath; //TODO: Instead of SVRDB file, it should be Persistent Storage.
//this is only for 0.9.2
-
/**
+ * @param activity app activity
* @param context app context
* @param serviceType indicate IN_PROC or OUT_OF_PROC
* @param modeType indicate whether we want to do server, client or both
* @param qualityOfService quality of service
* @param dbPath Persistant storage file for SVR Database.
*/
- public PlatformConfig(Context context,
+ public PlatformConfig(Activity activity,
+ Context context,
ServiceType serviceType,
ModeType modeType,
String ipAddress,
int port,
QualityOfService qualityOfService,
String dbPath) {
+ this.mActivity=activity;
this.mContext = context;
this.mServiceType = serviceType;
this.mModeType = modeType;
* if you specify 5683 : client discovery can work even if they don't
* specify port
* @param qualityOfService quality of service
+ * @param dbPath Persistant storage file for SVR Database.
+ */
+ public PlatformConfig(Context context,
+ ServiceType serviceType,
+ ModeType modeType,
+ String ipAddress,
+ int port,
+ QualityOfService qualityOfService,
+ String dbPath) {
+ this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, dbPath);
+ }
+
+ /**
+ * @param context app context
+ * @param serviceType indicate IN_PROC or OUT_OF_PROC
+ * @param modeType indicate whether we want to do server, client or both
+ * @param ipAddress ip address of server
+ * if you specify 0.0.0.0 : it listens on any interface
+ * @param port port of server
+ * if you specifiy 0 : next available random port is used
+ * if you specify 5683 : client discovery can work even if they don't
+ * 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,
String ipAddress,
int port,
QualityOfService qualityOfService) {
- this(context,serviceType,modeType,ipAddress,port,qualityOfService, "");
+ this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, "");
}
+ /**
+ * @param activity app activity
+ * @param context app context
+ * @param serviceType indicate IN_PROC or OUT_OF_PROC
+ * @param modeType indicate whether we want to do server, client or both
+ * @param ipAddress ip address of server
+ * if you specify 0.0.0.0 : it listens on any interface
+ * @param port port of server
+ * if you specifiy 0 : next available random port is used
+ * if you specify 5683 : client discovery can work even if they don't
+ * specify port
+ * @param qualityOfService quality of service
+ */
+ // Avoid breaking building java samples due to persistent storage SVR DB changes.
+ public PlatformConfig(Activity activity,
+ Context context,
+ ServiceType serviceType,
+ ModeType modeType,
+ String ipAddress,
+ int port,
+ QualityOfService qualityOfService) {
+ this(activity,context,serviceType,modeType,ipAddress,port,qualityOfService, "");
+ }
public Context getContext() {
return mContext;
}
public String getSvrDbPath() {
return mSvrDbPath;
}
+
+ public Activity getActivity() {
+ return mActivity;
+ }
+
}