90c5d7dc0e92324b43654193c4353c8e394762f8
[platform/upstream/iotivity.git] / service / easy-setup / enrollee / inc / samsung / sc_easysetup.h
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #include "easysetup.h"
22 #include "escommon.h"
23
24 #ifndef EASYSETUPX_ENROLLEE_H__
25 #define EASYSETUPX_ENROLLEE_H__
26
27 #define MAXLEN_STRING 1000
28 #define MAXNUM_LOCATION 20
29 #define MAXLEN_DATE_TIME 33
30 #define MAXNUM_CANDIDATE_AP 20
31
32 #define SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE  "x.com.samsung.ncs"
33 #define SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL    "x.com.samsung.chn"
34 #define SC_RSRVD_ES_VENDOR_DEVICE_TYPE          "x.com.samsung.dt"
35 #define SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE       "x.com.samsung.sdt"
36 #define SC_RSRVD_ES_VENDOR_LOCATION             "x.com.samsung.location"
37 #define SC_RSRVD_ES_VENDOR_CLIENTID             "x.com.samsung.clientid"
38 #define SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV  "x.com.samsung.rmd"
39 #define SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV     "x.com.samsung.rsd"
40 #define SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO    "x.com.samsung.npi"
41 #define SC_RSRVD_ES_VENDOR_ACCOUNT              "x.com.samsung.account"
42 #define SC_RSRVD_ES_VENDOR_SSO_LIST             "x.com.samsung.ssolist"
43 #define SC_RSRVD_ES_VENDOR_AAC                  "x.com.samsung.aac"
44 #define SC_RSRVD_ES_VENDOR_TNC_HEADER           "x.com.samsung.tcheader"
45 #define SC_RSRVD_ES_VENDOR_TNC_VERSION          "x.com.samsung.tcversion"
46 #define SC_RSRVD_ES_VENDOR_TNC_RESULT           "x.com.samsung.tcresult"
47 #define SC_RSRVD_ES_VENDOR_TNC_STATUS           "x.com.samsung.tcstatus"
48 #define SC_RSRVD_ES_VENDOR_REFRESH_TOKEN        "x.com.samsung.refreshtoken"
49 #define SC_RSRVD_ES_VENDOR_UID                  "x.com.samsung.uid"
50 #define SC_RSRVD_ES_VENDOR_BSSID                "x.com.samsung.bssid"
51 #define SC_RSRVD_ES_VENDOR_PNP_PIN              "x.com.samsung.pnppin"
52 #define SC_RSRVD_ES_VENDOR_MODEL_NUMBER         "x.com.samsung.modelnumber"
53 #define SC_RSRVD_ES_VENDOR_LANGUAGE             "x.com.samsung.language"
54 #define SC_RSRVD_ES_VENDOR_COUNTRY              "x.com.samsung.country"
55 #define SC_RSRVD_ES_VENDOR_GPSLOCATION          "x.com.samsung.gpslocation"
56 #define SC_RSRVD_ES_VENDOR_UTC_DATE_TIME        "x.com.samsung.datetime"
57 #define SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME   "x.com.samsung.regionaldatetime"
58 #define SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION  "x.com.samsung.espv"
59 #define SC_RSRVD_ES_VENDOR_TIMEZONE_ID          "x.com.samsung.timezoneid"
60 #define SC_RSRVD_ES_VENDOR_HIDDEN               "x.com.samsung.hidden"
61 #define SC_RSRVD_ES_VENDOR_HUB_ID               "x.com.samsung.hubid"
62 #define SC_RSRVD_ES_VENDOR_CANDIDATEAPS         "x.com.samsung.candidateaps"
63 #define SC_RSRVD_ES_VENDOR_SSID                 "x.com.samsung.ssid"
64 #define SC_RSRVD_ES_VENDOR_PASSPHRASE           "x.com.samsung.passphrase"
65 #define SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL    "x.com.samsung.channel"
66 #define SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT   "x.com.samsung.deployenv"
67 #define SC_RSRVD_ES_VENDOR_IATT                 "x.com.samsung.iatt"
68
69 #define WIFI_DISCOVERY_CHANNEL_INIT             -1
70
71 /**
72  * @brief  Supported WIFI frequency like 2.4G and 5G
73  */
74 typedef enum
75 {
76     NET_STATE_INIT = -1,                /**< Init state **/
77     NET_STATE_WIRED_CONNECTED = 0,      /**< Wired connected **/
78     NET_STATE_WIRELESS_CONNECTED,       /**< Wireless connected **/
79     NET_STATE_NOT_CONNECTED             /**< Not connected, at all **/
80 } NETCONNECTION_STATE;
81
82 typedef struct SCCandidateAPInfo
83 {
84     char ssid[MAXLEN_STRING];
85     char passphrase[MAXLEN_STRING];
86     int channel;
87     char bssid[MAXLEN_STRING];
88 } SCCandidateAPInfo;
89
90 typedef struct SCWiFiConfProperties
91 {
92     int discoveryChannel;                   /**< Wi-Fi AP Channel used for fast discovery **/
93     char bssid[MAXLEN_STRING];              /**< Wi-Fi bssid information. **/
94     bool isHidden;
95     int numCandidateAP;
96     SCCandidateAPInfo candidateAPInfo[MAXNUM_CANDIDATE_AP];
97 } SCWiFiConfProperties;
98
99 typedef struct SCTncInfo
100 {
101     char header[MAXLEN_STRING]; /**< Terms & Conditions header **/
102     char version[MAXLEN_STRING];    /**< Terms & Conditions version **/
103 }SCTncInfo;
104
105 typedef struct SCDevConfProperties
106 {
107     int numLocation;
108     char location[MAXNUM_LOCATION][MAXLEN_STRING];  /**< Samsung-specific location-related information **/
109     char regMobileDev[MAXLEN_STRING];               /**< Samsung-specific mobile device information for 'register TV' **/
110     char account[MAXLEN_STRING];  /**< Samsung-specific account-related information **/
111     char ssoList[MAXLEN_STRING];            /**< Samsung-specific SSO list information which is registered in device **/
112     SCTncInfo scTnCInfo;    /**< Samsung-specific Terms & Conditions information **/
113     char modelNumber[MAXLEN_STRING];                /**< Samsung-specific model number **/
114     char language[MAXLEN_STRING];                   /**< IETF language tag using ISO 639X **/
115     char country[MAXLEN_STRING];                    /**< ISO Country Code (ISO 3166-1 Alpha-2) **/
116     char gpsLocation[MAXLEN_STRING];                /**< GPS information of device. Longitude and latitude in json format **/
117     char utcDateTime[MAXLEN_DATE_TIME];             /**< UTC date time **/
118     char regionalDateTime[MAXLEN_DATE_TIME];        /**< Regional date time **/
119     char timeZoneId[MAXLEN_STRING];                 /** Name of Time Zone **/
120     char hubId[MAXLEN_STRING];                      /** HubId of device **/
121 } SCDevConfProperties;
122
123 typedef struct SCCoapCloudServerConfProperties
124 {
125     char clientID[MAXLEN_STRING];               /**< Samsung-specific clientId for sign-up to IoT Cloud **/
126     char aac[MAXLEN_STRING];                    /**< Samsung-specific aac information **/
127     char tncResult[MAXLEN_STRING];              /**< Samsung-specific Terms & Conditions result **/
128     char refreshToken[MAXLEN_STRING];           /**< Samsung-specific refreshToken information. Indicate refresh token to be used if the access token is expired**/
129     char uid[MAXLEN_STRING];                    /**< Samsung-specific aac information. Indicate user ID corresponding to user account **/
130     char deployEnv[MAXLEN_STRING];              /**< Samsung-specific deployment server with which device is connected to. For example "PROD", "STG" and etc **/
131     int iatt;                                   /**< Samsung-specific Access token type indicator. 0 for SA token, 1 for IoT JWT **/
132 } SCCoapCloudServerConfProperties;
133
134 typedef struct SCProperties
135 {
136     NETCONNECTION_STATE netConnectionState; /**< A state of network connection **/
137     int discoveryChannel;                   /**< Wi-Fi AP Channel used for fast discovery **/
138     char deviceType[MAXLEN_STRING];         /**< Generated with Device Type + Icon Type **/
139     char deviceSubType[MAXLEN_STRING];      /**< Device Sub Category **/
140     int numLocation;
141     char location[MAXNUM_LOCATION][MAXLEN_STRING];  /**< Samsung-specific location-related information **/
142     char clientID[MAXLEN_STRING];           /**< Samsung-specific clientId for sign-up to IoT Cloud **/
143     char regMobileDev[MAXLEN_STRING];       /**< Samsung-specific mobile device information for 'register TV' **/
144     char regSetDev[MAXLEN_STRING];          /**< Samsung-specific set device information for 'register TV' **/
145     char nwProvInfo[MAXLEN_STRING];         /**< Samsung-specific network provisioning information for cellular network vendor **/
146     char account[MAXLEN_STRING];            /**< Samsung-specific account-related information **/
147     char ssoList[MAXLEN_STRING];            /**< Samsung-specific SSO list information which is registered in device **/
148     char aac[MAXLEN_STRING];                /**< Samsung-specific aac information **/
149     SCTncInfo tncInfo;                      /**< Samsung-specific Terms & Conditions information **/
150     char tncResult[MAXLEN_STRING];          /**< Samsung-specific Terms & Conditions result **/
151     int tncStatus;                          /**< Samsung-specific Terms & Conditions status **/
152     char refreshToken[MAXLEN_STRING];       /**< Samsung-specific refreshToken information. Indicate refresh token to be used if the access token is expired**/
153     char uid[MAXLEN_STRING];                /**< Samsung-specific aac information. Indicate user ID corresponding to user account **/
154     char bssid[MAXLEN_STRING];              /**< Samsung-specific Wi-Fi bssid information. **/
155     char pnpPin[MAXLEN_STRING];             /**< Samsung-specific PnP Pin **/
156     char modelNumber[MAXLEN_STRING];                /**< Samsung-specific model number **/
157     char language[MAXLEN_STRING];                   /**< IETF language tag using ISO 639X **/
158     char country[MAXLEN_STRING];                    /**< ISO Country Code (ISO 3166-1 Alpha-2) **/
159     char gpsLocation[MAXLEN_STRING];                /**< GPS information of device. Longitude and latitude in json format **/
160     char utcDateTime[MAXLEN_DATE_TIME];             /**< UTC date time **/
161     char regionalDateTime[MAXLEN_DATE_TIME];        /**< Regional date time **/
162     char esProtocolVersion[MAXLEN_STRING];          /**< Samsung Easy Setup Protocol Version **/
163     char timeZoneId[MAXLEN_STRING];
164     bool isHidden;
165     char hubId[MAXLEN_STRING];                /**< HubId of device **/
166     int numCandidateAP;
167     SCCandidateAPInfo candidateAPInfo[MAXNUM_CANDIDATE_AP];
168     char deployEnv[MAXLEN_STRING];
169     int iatt;
170 } SCProperties;
171
172 void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata);
173 void WriteUserdataCb(OCRepPayload* payload, char* resourceType);
174
175 ESResult SetSCProperties(const SCProperties *prop);
176
177 ESResult SetRegisterSetDevice(const char *regSetDevice);
178 ESResult SetNetworkProvInfo(const char *nwProvInfo);
179
180 ESResult SetSCTncInfo(SCTncInfo *tncInfo);
181 ESResult SetSCTncStatus(int status);
182 ESResult SetSCNetConnectionState(NETCONNECTION_STATE netConnectionState);
183 ESResult SetSCPnPPin(const char *pnp);
184
185 ESResult SetESVersionInfo(const char *esVersionInfo);
186 ESResult SetSSOList(const char *ssoList);
187
188 #endif /* EASYSETUPX_ENROLLEE_H__ */