replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / easy-setup / mediator / richsdk / unittests / ESEnrolleeSimulator.h
1 //******************************************************************
2 //
3 // Copyright 2016 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 #ifndef _ES_MEDIATOR_SIMULATOR_H_
22 #define _ES_MEDIATOR_SIMULATOR_H_
23
24 #include <iostream>
25
26 #include "OCPlatform.h"
27 #include "OCApi.h"
28 #include "oic_malloc.h"
29
30 #include "escommon.h"
31 #include "ESEnrolleeCommon.h"
32 #include "easysetup.h"
33
34 class ESEnrolleeSimulator
35 {
36 public:
37     ESEnrolleeSimulator()
38     {
39     };
40     ~ESEnrolleeSimulator() = default;
41
42     ESEnrolleeSimulator(const ESEnrolleeSimulator &) = delete;
43     ESEnrolleeSimulator & operator = (const ESEnrolleeSimulator &) = delete;
44
45     ESEnrolleeSimulator(ESEnrolleeSimulator &&) = delete;
46     ESEnrolleeSimulator & operator = (ESEnrolleeSimulator &&) = delete;
47
48     ESResult initEnrollee()
49     {
50         ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFICONF_RESOURCE |
51                                                     ES_COAPCLOUDCONF_RESOURCE |
52                                                     ES_DEVCONF_RESOURCE);
53         ESProvisioningCallbacks callbacks;
54
55         callbacks.WiFiConfProvCb = &onWiFiProvisioning;
56         callbacks.DevConfProvCb = &onDevConfProvisioning;
57         callbacks.CoapCloudConfProvCb = &onCloudProvisioning;
58
59         return ESInitEnrollee(false, resourcemMask, callbacks);
60     }
61
62     ESResult setDeviceProperty()
63     {
64         ESDeviceProperty deviceProperty = {
65             {{WIFI_11G, WiFi_EOF}, WIFI_5G}, {"Test Device"}
66         };
67
68         return ESSetDeviceProperty(&deviceProperty);
69     }
70
71     ESResult setESState()
72     {
73         return ESSetState(ES_STATE_CONNECTED_TO_ENROLLER);
74     }
75
76     ESResult setESErrorCode()
77     {
78         return ESSetErrorCode(ES_ERRCODE_NO_INTERNETCONNECTION);
79     }
80
81 private:
82     static void onWiFiProvisioning(ESWiFiConfData* /*data*/)
83     {
84     }
85
86     static void onDevConfProvisioning(ESDevConfData* /*data*/)
87     {
88     }
89
90     static void onCloudProvisioning(ESCoapCloudConfData* /*data*/)
91     {
92     }
93 };
94
95 #endif //_NS_CONSUMER_SIMULATOR_H_