Master branch merge for VS build success
[platform/upstream/iotivity.git] / service / easy-setup / enrollee / inc / 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
22 #ifndef EASYSETUP_ENROLLEE_H__
23 #define EASYSETUP_ENROLLEE_H__
24
25 #include "escommon.h"
26
27 /**
28  * @file
29  *
30  * This file contains Enrollee APIs
31  */
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif // __cplusplus
36
37 /*
38  * Callback function for updating the Enrollee OnBoarding and Provisioning status result
39  * to the application
40  *
41  * @param esResult ESResult provides the current state of the Enrollee Device
42  */
43 typedef void (*ESEnrolleeEventCallback)(ESResult esResult, ESEnrolleeState enrolleeState);
44
45
46
47 typedef struct
48 {
49     void (*WiFiProvCb) (ESWiFiProvData *);
50     void (*DevConfProvCb) (ESDevConfProvData *);
51     void (*CloudDataProvCb) (ESCloudProvData *);
52 } ESProvisioningCallbacks;
53
54 /**
55  * This function Initializes the EasySetup. This API must be called prior to invoking any other API
56  *
57  * @param isSecured         True if the Enrollee is operating in secured mode.
58  * @param resourceMask      Provisining Resource Type which application wants to make.
59  *                          ES_WIFI_RESOURCE = 0x01,
60  *                          ES_CLOUD_RESOURCE = 0x02,
61  *                          ES_DEVCONF_RESOURCE = 0x04
62  * @param callbacks         ESProvisioningCallbacks for updating Provisioning Resources' data to the application
63  * @return ::ES_OK on success, some other value upon failure.
64  */
65 ESResult ESInitEnrollee(bool isSecured, ESResourceMask resourceMask, ESProvisioningCallbacks callbacks);
66
67
68 /**
69  * This function Sets Device Information.
70  *
71  * @param deviceProperty   Contains device information composed of WiFi Structure & DevConf Structure
72  * @return ::ES_OK on success, some other value upon failure.
73  */
74 ESResult ESSetDeviceProperty(ESDeviceProperty *deviceProperty);
75
76
77 /**
78  * This function Sets Enrollee's State.
79  *
80  * @param esState   Contains current enrollee's state.
81  * @return ::ES_OK on success, some other value upon failure.
82  */
83 ESResult ESSetState(ESEnrolleeState esState);
84
85
86 /**
87  * This function Sets Enrollee's Error Code.
88  *
89  * @param esErrCode   Contains enrollee's error code.
90  * @return ::ES_OK on success, some other value upon failure.
91  */
92 ESResult ESSetErrorCode(ESErrorCode esErrCode);
93
94 /**
95  * This function performs termination of Provisioning and Network resources.
96  * Also terminates the IoTivity core stack.
97  *
98  * @return ::ES_OK on success, some other value upon failure.
99  */
100 ESResult ESTerminateEnrollee();
101
102 #ifdef __cplusplus
103 }
104 #endif // __cplusplus
105
106
107 #endif /* EASYSETUP_ENROLLEE_H__ */
108