1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #include "easysetup.h"
24 #ifndef EASYSETUPX_ENROLLEE_H__
25 #define EASYSETUPX_ENROLLEE_H__
27 #define MAXLEN_STRING 1000
28 #define MAXNUM_LOCATION 20
29 #define MAXLEN_DATE_TIME 33
30 #define MAXNUM_CANDIDATE_AP 20
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"
69 #define WIFI_DISCOVERY_CHANNEL_INIT -1
72 * @brief Supported WIFI frequency like 2.4G and 5G
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;
82 typedef struct SCCandidateAPInfo
84 char ssid[MAXLEN_STRING];
85 char passphrase[MAXLEN_STRING];
87 char bssid[MAXLEN_STRING];
90 typedef struct SCWiFiConfProperties
92 int discoveryChannel; /**< Wi-Fi AP Channel used for fast discovery **/
93 char bssid[MAXLEN_STRING]; /**< Wi-Fi bssid information. **/
96 SCCandidateAPInfo candidateAPInfo[MAXNUM_CANDIDATE_AP];
97 } SCWiFiConfProperties;
99 typedef struct SCTncInfo
101 char header[MAXLEN_STRING]; /**< Terms & Conditions header **/
102 char version[MAXLEN_STRING]; /**< Terms & Conditions version **/
105 typedef struct SCDevConfProperties
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;
123 typedef struct SCCoapCloudServerConfProperties
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;
134 typedef struct SCProperties
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 **/
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];
165 char hubId[MAXLEN_STRING]; /**< HubId of device **/
167 SCCandidateAPInfo candidateAPInfo[MAXNUM_CANDIDATE_AP];
168 char deployEnv[MAXLEN_STRING];
172 void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata);
173 void WriteUserdataCb(OCRepPayload* payload, char* resourceType);
175 ESResult SetSCProperties(const SCProperties *prop);
177 ESResult SetRegisterSetDevice(const char *regSetDevice);
178 ESResult SetNetworkProvInfo(const char *nwProvInfo);
180 ESResult SetSCTncInfo(SCTncInfo *tncInfo);
181 ESResult SetSCTncStatus(int status);
182 ESResult SetSCNetConnectionState(NETCONNECTION_STATE netConnectionState);
183 ESResult SetSCPnPPin(const char *pnp);
185 ESResult SetESVersionInfo(const char *esVersionInfo);
186 ESResult SetSSOList(const char *ssoList);
188 #endif /* EASYSETUPX_ENROLLEE_H__ */