- m_ocResource->post(OC_RSRVD_ES_RES_TYPE_PROV, BATCH_INTERFACE,
- provisioningRepresentation, QueryParamsMap(),
- std::function<
- void(const HeaderOptions& headerOptions,
- const OCRepresentation& rep, const int eCode) >(
- std::bind(&EnrolleeResource::checkProvInformationCb, this,
- std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3)));
+ ESEnrolleeResourceCb cb = std::bind(&EnrolleeResource::onEnrolleeResourceSafetyCB,
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
+ static_cast<ESEnrolleeResourceCb>(
+ std::bind(&EnrolleeResource::onProvisioningResponse, this,
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)),
+ shared_from_this());
+
+ m_ocResource->post(OC_RSRVD_ES_RES_TYPE_EASYSETUP, BATCH_INTERFACE,
+ provisioningRepresentation, QueryParamsMap(), cb, OC::QualityOfService::HighQos);
+
+ OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "provisionProperties OUT");
+ }
+
+ void EnrolleeResource::requestToConnect(const std::vector<ES_CONNECT_TYPE> &connectTypes)
+ {
+ OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "requestToConnect IN");
+ if (m_ocResource == nullptr)
+ {
+ throw ESBadRequestException("Resource is not initialized");
+ }
+
+ OC::QueryParamsMap query;
+ OC::OCRepresentation requestRepresentation;
+ std::vector<int> connectTypes_int;
+ connectTypes_int.clear();
+
+ for(auto it : connectTypes)
+ {
+ connectTypes_int.push_back(static_cast<int>(it));
+ }
+
+ requestRepresentation.setValue<std::vector<int>>(OC_RSRVD_ES_CONNECT, connectTypes_int);
+
+ ESEnrolleeResourceCb cb = std::bind(&EnrolleeResource::onEnrolleeResourceSafetyCB,
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
+ static_cast<ESEnrolleeResourceCb>(
+ std::bind(&EnrolleeResource::onConnectRequestResponse, this,
+ std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)),
+ shared_from_this());
+
+ m_ocResource->post(OC_RSRVD_ES_RES_TYPE_EASYSETUP, OC_RSRVD_INTERFACE_DEFAULT,
+ requestRepresentation, QueryParamsMap(), cb, OC::QualityOfService::HighQos);
+
+ OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "requestToConnect OUT");