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 // Do not remove the include below
27 #include "ESEnrolleeCommon.h"
30 #ifndef ES_RESOURCE_HANDLER_H_
31 #define ES_RESOURCE_HANDLER_H_
37 typedef void (*ESWiFiCB) (ESResult, ESWiFiProvData *);
38 typedef void (*ESCloudCB) (ESResult, ESCloudProvData *);
39 typedef void (*ESDevConfCB) (ESResult, ESDevConfProvData *);
41 typedef void (*ESWriteUserdataCb)(OCRepPayload* payload, char* resourceType);
42 typedef void (*ESReadUserdataCb)(OCRepPayload* payload, char* resourceType, void** userdata);
44 /* Structure to represent a Light resource */
45 typedef struct PROVRESOURCE
47 OCResourceHandle handle;
48 ProvStatus status; // provisiong status
49 ESErrorCode lastErrCode;
54 OCResourceHandle handle;
55 WIFI_MODE supportedMode[NUM_WIFIMODE];
56 uint8_t numMode; // the number of device's supported wifi modes
57 WIFI_FREQ supportedFreq;
58 char ssid[OIC_STRING_MAX_VALUE]; // SSID
59 char cred[OIC_STRING_MAX_VALUE]; // credential information.
60 WIFI_AUTHTYPE authType;
66 OCResourceHandle handle;
67 char authCode[OIC_STRING_MAX_VALUE];
68 char authProvider[OIC_STRING_MAX_VALUE];
69 char ciServer[OIC_STRING_MAX_VALUE];
74 OCResourceHandle handle;
75 char devName[OIC_STRING_MAX_VALUE];
76 char modelNumber[OIC_STRING_MAX_VALUE];
77 char location[OIC_STRING_MAX_VALUE];
78 char language[OIC_STRING_MAX_VALUE];
79 char country[OIC_STRING_MAX_VALUE];
82 OCStackResult CreateEasySetupResources(bool isSecured, ESResourceMask resourceMask);
83 OCStackResult DeleteEasySetupResources();
85 OCStackResult SetDeviceProperty(ESDeviceProperty *deviceProperty);
86 OCStackResult SetEnrolleeState(ESEnrolleeState esState);
87 OCStackResult SetEnrolleeErrCode(ESErrorCode esErrCode);
88 OCEntityHandlerResult CheckEhRequestPayload(OCEntityHandlerRequest *ehRequest);
90 void RegisterWifiRsrcEventCallBack(ESWiFiCB);
91 void RegisterCloudRsrcEventCallBack(ESCloudCB);
92 void RegisterDevConfRsrcEventCallBack(ESDevConfCB);
93 void UnRegisterResourceEventCallBack(void);
94 ESResult SetCallbackForUserData(ESReadUserdataCb readCb, ESWriteUserdataCb writeCb);
100 #endif //ES_RESOURCE_HANDLER_H_