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
31 #define SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE "x.com.samsung.ncs"
32 #define SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL "x.com.samsung.chn"
33 #define SC_RSRVD_ES_VENDOR_DEVICE_TYPE "x.com.samsung.dt"
34 #define SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE "x.com.samsung.sdt"
35 #define SC_RSRVD_ES_VENDOR_LOCATION "x.com.samsung.location"
36 #define SC_RSRVD_ES_VENDOR_CLIENTID "x.com.samsung.clientid"
37 #define SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV "x.com.samsung.rmd"
38 #define SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV "x.com.samsung.rsd"
39 #define SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO "x.com.samsung.npi"
40 #define SC_RSRVD_ES_VENDOR_ACCOUNT "x.com.samsung.account"
41 #define SC_RSRVD_ES_VENDOR_AAC "x.com.samsung.aac"
42 #define SC_RSRVD_ES_VENDOR_TNC_HEADER "x.com.samsung.tcheader"
43 #define SC_RSRVD_ES_VENDOR_TNC_VERSION "x.com.samsung.tcversion"
44 #define SC_RSRVD_ES_VENDOR_TNC_RESULT "x.com.samsung.tcresult"
45 #define SC_RSRVD_ES_VENDOR_TNC_STATUS "x.com.samsung.tcstatus"
46 #define SC_RSRVD_ES_VENDOR_REFRESH_TOKEN "x.com.samsung.refreshtoken"
47 #define SC_RSRVD_ES_VENDOR_UID "x.com.samsung.uid"
48 #define SC_RSRVD_ES_VENDOR_BSSID "x.com.samsung.bssid"
49 #define SC_RSRVD_ES_VENDOR_PNP_PIN "x.com.samsung.pnppin"
50 #define SC_RSRVD_ES_VENDOR_MODEL_NUMBER "x.com.samsung.modelnumber"
51 #define SC_RSRVD_ES_VENDOR_LANGUAGE "x.com.samsung.language"
52 #define SC_RSRVD_ES_VENDOR_COUNTRY "x.com.samsung.country"
53 #define SC_RSRVD_ES_VENDOR_GPSLOCATION "x.com.samsung.gpslocation"
54 #define SC_RSRVD_ES_VENDOR_UTC_DATE_TIME "x.com.samsung.datetime"
55 #define SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME "x.com.samsung.regionaldatetime"
56 #define SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION "x.com.samsung.espv"
59 #define WIFI_DISCOVERY_CHANNEL_INIT -1
62 * @brief Supported WIFI frequency like 2.4G and 5G
66 NET_STATE_INIT = -1, /**< Init state **/
67 NET_STATE_WIRED_CONNECTED = 0, /**< Wired connected **/
68 NET_STATE_WIRELESS_CONNECTED, /**< Wireless connected **/
69 NET_STATE_NOT_CONNECTED /**< Not connected, at all **/
70 } NETCONNECTION_STATE;
72 typedef struct SCWiFiConfProperties
74 int discoveryChannel; /**< Wi-Fi AP Channel used for fast discovery **/
75 char bssid[MAXLEN_STRING]; /**< Wi-Fi bssid information. **/
76 } SCWiFiConfProperties;
78 typedef struct SCTncInfo
80 char header[MAXLEN_STRING]; /**< Terms & Conditions header **/
81 char version[MAXLEN_STRING]; /**< Terms & Conditions version **/
84 typedef struct SCDevConfProperties
87 char location[MAXNUM_LOCATION][MAXLEN_STRING]; /**< Samsung-specific location-related information **/
88 char regMobileDev[MAXLEN_STRING]; /**< Samsung-specific mobile device information for 'register TV' **/
89 char account[MAXLEN_STRING]; /**< Samsung-specific account-related information **/
90 SCTncInfo scTnCInfo; /**< Samsung-specific Terms & Conditions information **/
91 char modelNumber[MAXLEN_STRING]; /**< Samsung-specific model number **/
92 char language[MAXLEN_STRING]; /**< IETF language tag using ISO 639X **/
93 char country[MAXLEN_STRING]; /**< ISO Country Code (ISO 3166-1 Alpha-2) **/
94 char gpsLocation[MAXLEN_STRING]; /**< GPS information of device. Longitude and latitude in json format **/
95 char utcDateTime[MAXLEN_DATE_TIME]; /**< UTC date time **/
96 char regionalDateTime[MAXLEN_DATE_TIME]; /**< Regional date time **/
97 } SCDevConfProperties;
99 typedef struct SCCoapCloudServerConfProperties
101 char clientID[MAXLEN_STRING]; /**< Samsung-specific clientId for sign-up to IoT Cloud **/
102 char aac[MAXLEN_STRING]; /**< Samsung-specific aac information **/
103 char tncResult[MAXLEN_STRING]; /**< Samsung-specific Terms & Conditions result **/
104 char refreshToken[MAXLEN_STRING]; /**< Samsung-specific refreshToken information. Indicate refresh token to be used if the access token is expired**/
105 char uid[MAXLEN_STRING]; /**< Samsung-specific aac information. Indicate user ID corresponding to user account **/
106 } SCCoapCloudServerConfProperties;
108 typedef struct SCProperties
110 NETCONNECTION_STATE netConnectionState; /**< A state of network connection **/
111 int discoveryChannel; /**< Wi-Fi AP Channel used for fast discovery **/
112 char deviceType[MAXLEN_STRING]; /**< Generated with Device Type + Icon Type **/
113 char deviceSubType[MAXLEN_STRING]; /**< Device Sub Category **/
115 char location[MAXNUM_LOCATION][MAXLEN_STRING]; /**< Samsung-specific location-related information **/
116 char clientID[MAXLEN_STRING]; /**< Samsung-specific clientId for sign-up to IoT Cloud **/
117 char regMobileDev[MAXLEN_STRING]; /**< Samsung-specific mobile device information for 'register TV' **/
118 char regSetDev[MAXLEN_STRING]; /**< Samsung-specific set device information for 'register TV' **/
119 char nwProvInfo[MAXLEN_STRING]; /**< Samsung-specific network provisioning information for cellular network vendor **/
120 char account[MAXLEN_STRING]; /**< Samsung-specific account-related information **/
121 char aac[MAXLEN_STRING]; /**< Samsung-specific aac information **/
122 SCTncInfo tncInfo; /**< Samsung-specific Terms & Conditions information **/
123 char tncResult[MAXLEN_STRING]; /**< Samsung-specific Terms & Conditions result **/
124 int tncStatus; /**< Samsung-specific Terms & Conditions status **/
125 char refreshToken[MAXLEN_STRING]; /**< Samsung-specific refreshToken information. Indicate refresh token to be used if the access token is expired**/
126 char uid[MAXLEN_STRING]; /**< Samsung-specific aac information. Indicate user ID corresponding to user account **/
127 char bssid[MAXLEN_STRING]; /**< Samsung-specific Wi-Fi bssid information. **/
128 char pnpPin[MAXLEN_STRING]; /**< Samsung-specific PnP Pin **/
129 char modelNumber[MAXLEN_STRING]; /**< Samsung-specific model number **/
130 char language[MAXLEN_STRING]; /**< IETF language tag using ISO 639X **/
131 char country[MAXLEN_STRING]; /**< ISO Country Code (ISO 3166-1 Alpha-2) **/
132 char gpsLocation[MAXLEN_STRING]; /**< GPS information of device. Longitude and latitude in json format **/
133 char utcDateTime[MAXLEN_DATE_TIME]; /**< UTC date time **/
134 char regionalDateTime[MAXLEN_DATE_TIME]; /**< Regional date time **/
135 char esProtocolVersion[MAXLEN_STRING]; /**< Samsung Easy Setup Protocol Version **/
138 void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata);
139 void WriteUserdataCb(OCRepPayload* payload, char* resourceType);
141 ESResult SetSCProperties(const SCProperties *prop);
143 ESResult SetRegisterSetDevice(const char *regSetDevice);
144 ESResult SetNetworkProvInfo(const char *nwProvInfo);
146 ESResult SetSCTncInfo(SCTncInfo *tncInfo);
147 ESResult SetSCTncStatus(int status);
148 ESResult SetSCNetConnectionState(NETCONNECTION_STATE netConnectionState);
149 ESResult SetSCPnPPin(const char *pnp);
151 ESResult SetESVersionInfo(const char *esVersionInfo);
153 #endif /* EASYSETUPX_ENROLLEE_H__ */