1 //******************************************************************
3 // Copyright 2016 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 #ifndef _ES_MEDIATOR_SIMULATOR_H_
22 #define _ES_MEDIATOR_SIMULATOR_H_
26 #include "OCPlatform.h"
28 #include "oic_malloc.h"
31 #include "ESEnrolleeCommon.h"
32 #include "easysetup.h"
34 #define PROV_RESOURCE_TYPE "ocf.wk.prov"
36 class ESEnrolleeSimulator
42 ~ESEnrolleeSimulator() = default;
44 ESEnrolleeSimulator(const ESEnrolleeSimulator &) = delete;
45 ESEnrolleeSimulator & operator = (const ESEnrolleeSimulator &) = delete;
47 ESEnrolleeSimulator(ESEnrolleeSimulator &&) = delete;
48 ESEnrolleeSimulator & operator = (ESEnrolleeSimulator &&) = delete;
50 ESResult initEnrollee()
52 ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFI_RESOURCE |
55 ESProvisioningCallbacks callbacks;
57 callbacks.WiFiProvCb = &onWiFiProvisioning;
58 callbacks.DevConfProvCb = &onDevConfProvisioning;
59 callbacks.CloudDataProvCb = &onCloudProvisioning;
61 return ESInitEnrollee(false, resourcemMask, callbacks);
64 ESResult setDeviceProperty()
66 ESDeviceProperty deviceProperty = {
67 {{WIFI_11G, WiFi_EOF}, WIFI_5G}, {"Test Device", "Test Model Number"}
70 return ESSetDeviceProperty(&deviceProperty);
75 return ESSetState(ES_STATE_CONNECTED_TO_ENROLLER);
78 ESResult setESErrorCode()
80 return ESSetErrorCode(ES_ERRCODE_NO_INTERNETCONNECTION);
84 static void onWiFiProvisioning(ESWiFiProvData* /*data*/)
88 static void onDevConfProvisioning(ESDevConfProvData* /*data*/)
92 static void onCloudProvisioning(ESCloudProvData* /*data*/)
97 #endif //_NS_CONSUMER_SIMULATOR_H_