Merge branch 'master' into extended-easysetup
[platform/upstream/iotivity.git] / service / easy-setup / enrollee / src / resourcehandler.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 // Do not remove the include below
22
23 #include <string.h>
24 #include "logger.h"
25 #include "ocstack.h"
26 #include "escommon.h"
27 #include "octypes.h"
28
29 #ifndef ES_RESOURCE_HANDLER_H_
30 #define ES_RESOURCE_HANDLER_H_
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 typedef void (*ESWiFiCB) (ESResult, ESWiFiProvData *);
37 typedef void (*ESCloudCB) (ESResult, ESCloudProvData *);
38 typedef void (*ESDevConfCB) (ESResult, ESDevConfProvData *);
39
40 /* Structure to represent a Light resource */
41 typedef struct PROVRESOURCE
42 {
43     OCResourceHandle handle;
44     ProvStatus status; // provisiong status
45     ESErrorCode lastErrCode;
46     char ocfWebLinks[MAX_WEBLINKLEN];
47 } ProvResource;
48
49 typedef struct
50 {
51     OCResourceHandle handle;
52     WIFI_MODE supportedMode[NUM_WIFIMODE];
53     uint8_t numMode;        // the number of device's supported wifi modes
54     WIFI_FREQ supportedFreq;
55     char ssid[MAX_SSIDLEN]; // target network name, i.e. SSID for WLAN, MAC address for BT.
56     char cred[MAX_CREDLEN]; // credential information.
57     WIFI_AUTHTYPE authType;
58     WIFI_ENCTYPE encType;
59 } WiFiResource;
60
61 typedef struct
62 {
63     OCResourceHandle handle;
64     char authCode[OIC_STRING_MAX_VALUE];
65     char authProvider[OIC_STRING_MAX_VALUE];
66     char ciServer[OIC_STRING_MAX_VALUE];
67 } CloudResource;
68
69 typedef struct
70 {
71     OCResourceHandle handle;
72     char devName[MAX_DEVICELEN];
73     char language[OIC_STRING_MAX_VALUE];
74     char country[OIC_STRING_MAX_VALUE];
75 } DevConfResource;
76
77
78 OCStackResult CreateEasySetupResources(bool isSecured, ESResourceMask resourceMask);
79 OCStackResult DeleteEasySetupResources();
80
81 OCStackResult SetDeviceProperty(ESDeviceProperty *deviceProperty);
82 OCStackResult SetEnrolleeState(ESEnrolleeState esState);
83 OCStackResult SetEnrolleeErrCode(ESErrorCode esErrCode);
84
85 void GetTargetNetworkInfoFromProvResource(char *, char *);
86 void RegisterWifiRsrcEventCallBack(ESWiFiCB);
87 void RegisterCloudRsrcEventCallBack(ESCloudCB);
88 void RegisterDevConfRsrcEventCallBack(ESDevConfCB);
89 void UnRegisterResourceEventCallBack(void);
90
91 #ifdef __cplusplus
92 }
93 #endif
94
95 #endif //ES_RESOURCE_HANDLER_H_