Add activity for NFC Transport.
[platform/upstream/iotivity.git] / android / android_api / base / src / main / java / org / iotivity / base / PlatformConfig.java
1 /*
2  * //******************************************************************
3  * //
4  * // Copyright 2015 Intel Corporation.
5  * //
6  * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7  * //
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
11  * //
12  * //      http://www.apache.org/licenses/LICENSE-2.0
13  * //
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.
19  * //
20  * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21  */
22
23 package org.iotivity.base;
24
25 import android.content.Context;
26 import android.app.Activity;
27
28 /**
29  * Data structure to provide the configuration.
30  */
31 public class PlatformConfig {
32     private Activity mActivity;
33     private Context mContext;
34     private ServiceType mServiceType;
35     private ModeType mModeType;
36     private String mIpAddress;
37     private int mPort;
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
41     /**
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
51      *                         specify port
52      * @param qualityOfService quality of service
53      * @param dbPath           Persistant storage file for SVR Database.
54      */
55     public PlatformConfig(Activity activity,
56                           Context context,
57                           ServiceType serviceType,
58                           ModeType modeType,
59                           String ipAddress,
60                           int port,
61                           QualityOfService qualityOfService,
62                           String dbPath) {
63         this.mActivity=activity;
64         this.mContext = context;
65         this.mServiceType = serviceType;
66         this.mModeType = modeType;
67         this.mIpAddress = ipAddress;
68         this.mPort = port;
69         this.mQualityOfService = qualityOfService;
70         this.mSvrDbPath = dbPath;
71     }
72
73     /**
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
82      *                         specify port
83      * @param qualityOfService quality of service
84      * @param dbPath           Persistant storage file for SVR Database.
85      */
86     public PlatformConfig(Context context,
87                           ServiceType serviceType,
88                           ModeType modeType,
89                           String ipAddress,
90                           int port,
91                           QualityOfService qualityOfService,
92                           String dbPath) {
93         this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, dbPath);
94     }
95
96     /**
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
105      *                         specify port
106      * @param qualityOfService quality of service
107      */
108     // Avoid breaking building java samples due to persistent storage SVR DB changes.
109     public PlatformConfig(Context context,
110                           ServiceType serviceType,
111                           ModeType modeType,
112                           String ipAddress,
113                           int port,
114                           QualityOfService qualityOfService) {
115         this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, "");
116     }
117
118     /**
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
128      *                         specify port
129      * @param qualityOfService quality of service
130      */
131     // Avoid breaking building java samples due to persistent storage SVR DB changes.
132     public PlatformConfig(Activity activity,
133                           Context context,
134                           ServiceType serviceType,
135                           ModeType modeType,
136                           String ipAddress,
137                           int port,
138                           QualityOfService qualityOfService) {
139         this(activity,context,serviceType,modeType,ipAddress,port,qualityOfService, "");
140     }
141     public Context getContext() {
142         return mContext;
143     }
144
145     public ServiceType getServiceType() {
146         return mServiceType;
147     }
148
149     public ModeType getModeType() {
150         return mModeType;
151     }
152
153     public String getIpAddress() {
154         return mIpAddress;
155     }
156
157     public int getPort() {
158         return mPort;
159     }
160
161     public QualityOfService getQualityOfService() {
162         return mQualityOfService;
163     }
164
165     public String getSvrDbPath() {
166         return mSvrDbPath;
167     }
168
169     public Activity getActivity() {
170         return mActivity;
171     }
172
173 }