2 *******************************************************************
4 * Copyright 2015 Intel Corporation.
6 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
20 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
23 package org.iotivity.base;
25 import android.content.Context;
26 import android.app.Activity;
29 * Data structure to provide the configuration.
31 public class PlatformConfig {
32 private Activity mActivity;
33 private Context mContext;
34 private ServiceType mServiceType;
35 private ModeType mModeType;
36 private String mIpAddress;
38 private QualityOfService mQualityOfService;
39 private String mSvrDbPath; //TODO: Instead of SVRDB file, it should be Persistent Storage.
40 //this is only for 0.9.2
42 * @param activity app activity
43 * @param context app context
44 * @param serviceType indicate IN_PROC or OUT_OF_PROC
45 * @param modeType indicate whether we want to do server, client or both
46 * @param ipAddress ip address of server
47 * if you specify 0.0.0.0 : it listens on any interface
48 * @param port port of server
49 * if you specifiy 0 : next available random port is used
50 * if you specify 5683 : client discovery can work even if they don't
52 * @param qualityOfService quality of service
53 * @param dbPath Persistant storage file for SVR Database.
55 public PlatformConfig(Activity activity,
57 ServiceType serviceType,
61 QualityOfService qualityOfService,
63 this.mActivity=activity;
64 this.mContext = context;
65 this.mServiceType = serviceType;
66 this.mModeType = modeType;
67 this.mIpAddress = ipAddress;
69 this.mQualityOfService = qualityOfService;
70 this.mSvrDbPath = dbPath;
74 * @param context app context
75 * @param serviceType indicate IN_PROC or OUT_OF_PROC
76 * @param modeType indicate whether we want to do server, client or both
77 * @param ipAddress ip address of server
78 * if you specify 0.0.0.0 : it listens on any interface
79 * @param port port of server
80 * if you specifiy 0 : next available random port is used
81 * if you specify 5683 : client discovery can work even if they don't
83 * @param qualityOfService quality of service
84 * @param dbPath Persistant storage file for SVR Database.
86 public PlatformConfig(Context context,
87 ServiceType serviceType,
91 QualityOfService qualityOfService,
93 this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, dbPath);
97 * @param context app context
98 * @param serviceType indicate IN_PROC or OUT_OF_PROC
99 * @param modeType indicate whether we want to do server, client or both
100 * @param ipAddress ip address of server
101 * if you specify 0.0.0.0 : it listens on any interface
102 * @param port port of server
103 * if you specifiy 0 : next available random port is used
104 * if you specify 5683 : client discovery can work even if they don't
106 * @param qualityOfService quality of service
108 // Avoid breaking building java samples due to persistent storage SVR DB changes.
109 public PlatformConfig(Context context,
110 ServiceType serviceType,
114 QualityOfService qualityOfService) {
115 this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, "");
119 * @param activity app activity
120 * @param context app context
121 * @param serviceType indicate IN_PROC or OUT_OF_PROC
122 * @param modeType indicate whether we want to do server, client or both
123 * @param ipAddress ip address of server
124 * if you specify 0.0.0.0 : it listens on any interface
125 * @param port port of server
126 * if you specifiy 0 : next available random port is used
127 * if you specify 5683 : client discovery can work even if they don't
129 * @param qualityOfService quality of service
131 // Avoid breaking building java samples due to persistent storage SVR DB changes.
132 public PlatformConfig(Activity activity,
134 ServiceType serviceType,
138 QualityOfService qualityOfService) {
139 this(activity,context,serviceType,modeType,ipAddress,port,qualityOfService, "");
141 public Context getContext() {
145 public ServiceType getServiceType() {
149 public ModeType getModeType() {
153 public String getIpAddress() {
157 public int getPort() {
161 public QualityOfService getQualityOfService() {
162 return mQualityOfService;
165 public String getSvrDbPath() {
169 public Activity getActivity() {