Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / android / android_api / base / src / main / java / org / iotivity / base / PlatformConfig.java
1 /*\r
2  * //******************************************************************\r
3  * //\r
4  * // Copyright 2015 Intel Corporation.\r
5  * //\r
6  * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
7  * //\r
8  * // Licensed under the Apache License, Version 2.0 (the "License");\r
9  * // you may not use this file except in compliance with the License.\r
10  * // You may obtain a copy of the License at\r
11  * //\r
12  * //      http://www.apache.org/licenses/LICENSE-2.0\r
13  * //\r
14  * // Unless required by applicable law or agreed to in writing, software\r
15  * // distributed under the License is distributed on an "AS IS" BASIS,\r
16  * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
17  * // See the License for the specific language governing permissions and\r
18  * // limitations under the License.\r
19  * //\r
20  * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
21  */\r
22 \r
23 package org.iotivity.base;\r
24 \r
25 import android.content.Context;\r
26 \r
27 /**\r
28  * Data structure to provide the configuration.\r
29  */\r
30 public class PlatformConfig {\r
31 \r
32     private Context mContext;\r
33     private ServiceType mServiceType;\r
34     private ModeType mModeType;\r
35     private String mIpAddress;\r
36     private int mPort;\r
37     private QualityOfService mQualityOfService;\r
38     private String mSvrDbPath; //TODO: Instead of SVRDB file, it should be Persistent Storage.
39                               //this is only for 0.9.2
40 \r
41     /**\r
42      * @param context          app context\r
43      * @param serviceType      indicate IN_PROC or OUT_OF_PROC\r
44      * @param modeType         indicate whether we want to do server, client or both\r
45      * @param ipAddress        ip address of server\r
46      *                         if you specify 0.0.0.0 : it listens on any interface\r
47      * @param port             port of server\r
48      *                         if you specifiy 0 : next available random port is used\r
49      *                         if you specify 5683 : client discovery can work even if they don't\r
50      *                         specify port\r
51      * @param qualityOfService quality of service\r
52      * @param dbPath           Persistant storage file for SVR Database.
53      */\r
54     public PlatformConfig(Context context,\r
55                           ServiceType serviceType,\r
56                           ModeType modeType,\r
57                           String ipAddress,\r
58                           int port,\r
59                           QualityOfService qualityOfService,
60                           String dbPath) {
61         this.mContext = context;\r
62         this.mServiceType = serviceType;\r
63         this.mModeType = modeType;\r
64         this.mIpAddress = ipAddress;\r
65         this.mPort = port;\r
66         this.mQualityOfService = qualityOfService;\r
67         this.mSvrDbPath = dbPath;
68     }
69
70     /**
71      * @param context          app context
72      * @param serviceType      indicate IN_PROC or OUT_OF_PROC
73      * @param modeType         indicate whether we want to do server, client or both
74      * @param ipAddress        ip address of server
75      *                         if you specify 0.0.0.0 : it listens on any interface
76      * @param port             port of server
77      *                         if you specifiy 0 : next available random port is used
78      *                         if you specify 5683 : client discovery can work even if they don't
79      *                         specify port
80      * @param qualityOfService quality of service
81      */
82     //Avoid breaking building java samples due to persistent storage SVR DB changes.
83     public PlatformConfig(Context context,
84                           ServiceType serviceType,
85                           ModeType modeType,
86                           String ipAddress,
87                           int port,
88                           QualityOfService qualityOfService) {
89         this(context,serviceType,modeType,ipAddress,port,qualityOfService, "");
90     }\r
91 \r
92     public Context getContext() {\r
93         return mContext;\r
94     }\r
95 \r
96     public ServiceType getServiceType() {\r
97         return mServiceType;\r
98     }\r
99 \r
100     public ModeType getModeType() {\r
101         return mModeType;\r
102     }\r
103 \r
104     public String getIpAddress() {\r
105         return mIpAddress;\r
106     }\r
107 \r
108     public int getPort() {\r
109         return mPort;\r
110     }\r
111 \r
112     public QualityOfService getQualityOfService() {\r
113         return mQualityOfService;\r
114     }
115
116     public String getSvrDbPath() {
117         return mSvrDbPath;
118     }\r
119 }\r