static void start()
{
- OC_LOG(INFO, LOG_TAG, "START");
+ OIC_LOG(INFO, LOG_TAG, "START");
ESActivateWifi();
}
void ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCallback cb)
{
- OC_LOG_V(INFO, LOG_TAG, "ConnectToWiFiNetwork %s %s",ssid,pass);
+ OIC_LOG_V(INFO, LOG_TAG, "ConnectToWiFiNetwork %s %s",ssid,pass);
gPass = pass;
gSsid = ssid;
gNetworkEventCb = cb;
void OnboardingCallback(ESResult esResult)
{
- OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "OnboardingCallback with result = %d", esResult);
+ OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "OnboardingCallback with result = %d", esResult);
if(esResult == ES_OK)
{
gEnrolleeStatusCb(esResult, ES_ON_BOARDED_STATE);
}
else
{
- OC_LOG_V(DEBUG, ES_ENROLLEE_TAG,
+ OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG,
"Onboarding is failed callback result is = %d", esResult);
gEnrolleeStatusCb(esResult, ES_INIT_STATE);
}
void ProvisioningCallback(ESResult esResult)
{
- OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ProvisioningCallback with result = %d", esResult);
+ OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ProvisioningCallback with result = %d", esResult);
if (esResult == ES_RECVTRIGGEROFPROVRES)
{
GetTargetNetworkInfoFromProvResource(gTargetSsid, gTargetPass);
gEnrolleeStatusCb(ES_OK, ES_PROVISIONED_STATE);
- OC_LOG(DEBUG, ES_ENROLLEE_TAG, "Connecting with target network");
+ OIC_LOG(DEBUG, ES_ENROLLEE_TAG, "Connecting with target network");
// Connecting/onboarding to target network
ConnectToWiFiNetwork(gTargetSsid, gTargetPass, OnboardingCallbackTargetNet);
}
else
{
- OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Provisioning is failed callback result is = %d", esResult);
+ OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Provisioning is failed callback result is = %d", esResult);
// Resetting Enrollee to ONBOARDED_STATE as Enrollee is alreday onboarded in previous step
gEnrolleeStatusCb(ES_OK, ES_ON_BOARDED_STATE);
}
void OnboardingCallbackTargetNet(ESResult esResult)
{
- OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "OnboardingCallback on target network with result = %d",
+ OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "OnboardingCallback on target network with result = %d",
esResult);
if(esResult == ES_OK)
{
}
else
{
- OC_LOG_V(DEBUG, ES_ENROLLEE_TAG,
+ OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG,
"Onboarding is failed on target network and callback result is = %d", esResult);
// Resetting Enrollee state to the ES_PROVISIONED_STATE
// as device is already being provisioned with target network creds.
bool isSecured,
EventCallback cb)
{
- OC_LOG(INFO, ES_ENROLLEE_TAG, "InitEasySetup IN");
+ OIC_LOG(INFO, ES_ENROLLEE_TAG, "InitEasySetup IN");
if(!ValidateParam(networkType,ssid,passwd,cb))
{
- OC_LOG(ERROR, ES_ENROLLEE_TAG,
+ OIC_LOG(ERROR, ES_ENROLLEE_TAG,
"InitEasySetup::Stopping Easy setup due to invalid parameters");
return ES_ERROR;
}
// knows when actually on-boarding started.
cb(ES_ERROR,ES_ON_BOARDING_STATE);
- OC_LOG(INFO, ES_ENROLLEE_TAG, "received callback");
- OC_LOG(INFO, ES_ENROLLEE_TAG, "onboarding now..");
+ OIC_LOG(INFO, ES_ENROLLEE_TAG, "received callback");
+ OIC_LOG(INFO, ES_ENROLLEE_TAG, "onboarding now..");
if(!ESOnboard(ssid, passwd, OnboardingCallback))
{
- OC_LOG(ERROR, ES_ENROLLEE_TAG, "InitEasySetup::On-boarding failed");
+ OIC_LOG(ERROR, ES_ENROLLEE_TAG, "InitEasySetup::On-boarding failed");
cb(ES_ERROR, ES_INIT_STATE);
return ES_ERROR;
}
- OC_LOG(INFO, ES_ENROLLEE_TAG, "InitEasySetup OUT");
+ OIC_LOG(INFO, ES_ENROLLEE_TAG, "InitEasySetup OUT");
return ES_OK;
}
//Delete Prov resource
if (DeleteProvisioningResource() != OC_STACK_OK)
{
- OC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!");
+ OIC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!");
return ES_ERROR;
}
#ifdef ESWIFI
if (DeleteNetworkResource() != OC_STACK_OK)
{
- OC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!");
+ OIC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!");
return ES_ERROR;
}
#endif
- OC_LOG(ERROR, ES_ENROLLEE_TAG, "TerminateEasySetup success");
+ OIC_LOG(ERROR, ES_ENROLLEE_TAG, "TerminateEasySetup success");
return ES_OK;
}
ESResult InitProvisioning()
{
- OC_LOG(INFO, ES_ENROLLEE_TAG, "InitProvisioning <<IN>>");
+ OIC_LOG(INFO, ES_ENROLLEE_TAG, "InitProvisioning <<IN>>");
if (CreateProvisioningResource(gIsSecured) != OC_STACK_OK)
{
- OC_LOG(ERROR, ES_ENROLLEE_TAG, "CreateProvisioningResource error");
+ OIC_LOG(ERROR, ES_ENROLLEE_TAG, "CreateProvisioningResource error");
return ES_ERROR;
}
#ifdef ESWIFI
if (CreateNetworkResource() != OC_STACK_OK)
{
- OC_LOG(ERROR, ES_ENROLLEE_TAG, "CreateNetworkResource error");
+ OIC_LOG(ERROR, ES_ENROLLEE_TAG, "CreateNetworkResource error");
return ES_ERROR;
}
#endif
RegisterResourceEventCallBack(ProvisioningCallback);
- OC_LOG(INFO, ES_ENROLLEE_TAG, "InitProvisioning OUT");
+ OIC_LOG(INFO, ES_ENROLLEE_TAG, "InitProvisioning OUT");
return ES_RESOURCECREATED;
}
-static bool ValidateParam(OCConnectivityType networkType, const char *ssid, const char *passwd,
+static bool ValidateParam(OCConnectivityType /*networkType*/, const char *ssid, const char *passwd,
EventCallback cb)
{
if (!ssid || !passwd || !cb)
{
- OC_LOG(ERROR, ES_ENROLLEE_TAG, "ValidateParam - Invalid parameters");
+ OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ValidateParam - Invalid parameters");
return false;
}
return true;
*/
bool ESOnboard(const char * ssid, const char* passwd, NetworkEventCallback cb)
{
- OC_LOG(DEBUG, ES_ENROLLEE_TAG, "ESOnboard IN");
+ OIC_LOG(DEBUG, ES_ENROLLEE_TAG, "ESOnboard IN");
if (ESSoftapOnboarding())
{
}
else if (ESBleOnboarding())
{
- OC_LOG(ERROR, ES_ENROLLEE_TAG, "ESOnboard::Ble onboarding is not supported");
+ OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESOnboard::Ble onboarding is not supported");
// TODO:
return false;
}
else
{
// TODO:
- OC_LOG(ERROR, ES_ENROLLEE_TAG, "ESOnboard::Invalid onboarding option");
+ OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESOnboard::Invalid onboarding option");
return false;
}
}
OC_DISCOVERABLE | OC_OBSERVABLE);
}
- OC_LOG_V(INFO, ES_RH_TAG, "Created Prov resource with result: %s", getResult(res));
+ OIC_LOG_V(INFO, ES_RH_TAG, "Created Prov resource with result: %s", getResult(res));
return res;
}
OCStackResult res = OCDeleteResource(gProvResource.handle);
if (res != OC_STACK_OK)
{
- OC_LOG_V(INFO, ES_RH_TAG, "Deleting Prov resource error with result: %s", getResult(res));
+ OIC_LOG_V(INFO, ES_RH_TAG, "Deleting Prov resource error with result: %s", getResult(res));
}
return res;
}
sprintf(gNetResource.cnn, "%s", netInfo.ssid);
- OC_LOG_V(INFO, ES_RH_TAG, "SSID: %s", gNetResource.cnn);
- OC_LOG_V(INFO, ES_RH_TAG, "IP Address: %s", gNetResource.ipaddr);
+ OIC_LOG_V(INFO, ES_RH_TAG, "SSID: %s", gNetResource.cnn);
+ OIC_LOG_V(INFO, ES_RH_TAG, "IP Address: %s", gNetResource.ipaddr);
OCStackResult res = OCCreateResource(&gNetResource.handle, "oic.r.net", OC_RSRVD_INTERFACE_DEFAULT,
OC_RSRVD_ES_URI_NET, OCEntityHandlerCb,NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
- OC_LOG_V(INFO, ES_RH_TAG, "Created Net resource with result: %s", getResult(res));
+ OIC_LOG_V(INFO, ES_RH_TAG, "Created Net resource with result: %s", getResult(res));
return res;
}
OCStackResult res = OCDeleteResource(gNetResource.handle);
if (res != OC_STACK_OK)
{
- OC_LOG_V(INFO, ES_RH_TAG, "Deleting Network resource error with result: %s",
+ OIC_LOG_V(INFO, ES_RH_TAG, "Deleting Network resource error with result: %s",
getResult(res));
}
OCEntityHandlerResult ehResult = OC_EH_ERROR;
if (!ehRequest)
{
- OC_LOG(ERROR, ES_RH_TAG, "Request is Null");
+ OIC_LOG(ERROR, ES_RH_TAG, "Request is Null");
return ehResult;
}
if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
{
- OC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation");
+ OIC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation");
return ehResult;
}
OCRepPayload *getResp = constructResponse(ehRequest);
if (!getResp)
{
- OC_LOG(ERROR, ES_RH_TAG, "constructResponse failed");
+ OIC_LOG(ERROR, ES_RH_TAG, "constructResponse failed");
return OC_EH_ERROR;
}
OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest,
OCRepPayload** payload)
{
- OC_LOG(INFO, ES_RH_TAG, "ProcessPutRequest enter");
+ OIC_LOG(INFO, ES_RH_TAG, "ProcessPutRequest enter");
OCEntityHandlerResult ehResult = OC_EH_ERROR;
if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
{
- OC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation");
+ OIC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation");
return ehResult;
}
OCRepPayload* input = (OCRepPayload*) (ehRequest->payload);
if (!input)
{
- OC_LOG(ERROR, ES_RH_TAG, "Failed to parse");
+ OIC_LOG(ERROR, ES_RH_TAG, "Failed to parse");
return ehResult;
}
// information.
if (gProvResource.ps == ES_PS_PROVISIONING_COMPLETED)
{
- OC_LOG(DEBUG, ES_RH_TAG, "Provisioning already completed. "
+ OIC_LOG(DEBUG, ES_RH_TAG, "Provisioning already completed. "
"This a request to override the existing the network provisioning information");
}
if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_TNN, &tnn))
{
sprintf(gProvResource.tnn, "%s", tnn);
- OC_LOG(INFO, ES_RH_TAG, "got ssid");
+ OIC_LOG(INFO, ES_RH_TAG, "got ssid");
}
- OC_LOG_V(INFO, ES_RH_TAG, "gProvResource.tnn %s", gProvResource.tnn);
+ OIC_LOG_V(INFO, ES_RH_TAG, "gProvResource.tnn %s", gProvResource.tnn);
char* cd;
if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_CD, &cd))
{
sprintf(gProvResource.cd, "%s", cd);
- OC_LOG(INFO, ES_RH_TAG, "got password");
+ OIC_LOG(INFO, ES_RH_TAG, "got password");
}
- OC_LOG_V(INFO, ES_RH_TAG, "gProvResource.cd %s", gProvResource.cd);
+ OIC_LOG_V(INFO, ES_RH_TAG, "gProvResource.cd %s", gProvResource.cd);
gProvResource.ps = 2;
- OC_LOG_V(INFO, ES_RH_TAG, "gProvResource.ps %d", gProvResource.ps);
+ OIC_LOG_V(INFO, ES_RH_TAG, "gProvResource.ps %d", gProvResource.ps);
g_flag = 1;
OCRepPayload *getResp = constructResponse(ehRequest);
if (!getResp)
{
- OC_LOG(ERROR, ES_RH_TAG, "constructResponse failed");
+ OIC_LOG(ERROR, ES_RH_TAG, "constructResponse failed");
return OC_EH_ERROR;
}
}
OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest,
- OCRepPayload** payload)
+ OCRepPayload** /*payload*/)
{
OCEntityHandlerResult ehResult = OC_EH_ERROR;
if (!ehRequest)
{
- OC_LOG(ERROR, ES_RH_TAG, "Request is Null");
+ OIC_LOG(ERROR, ES_RH_TAG, "Request is Null");
return ehResult;
}
if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
{
- OC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation");
+ OIC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation");
return ehResult;
}
OCRepPayload* input = (OCRepPayload*) (ehRequest->payload);
if (!input)
{
- OC_LOG(ERROR, ES_RH_TAG, "Failed to parse");
+ OIC_LOG(ERROR, ES_RH_TAG, "Failed to parse");
return ehResult;
}
char* tr;
OCRepPayload* payload = OCRepPayloadCreate();
if (!payload)
{
- OC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
+ OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
return NULL;
}
if (ehRequest->resource == gProvResource.handle)
{
- OC_LOG(INFO, ES_RH_TAG, "constructResponse prov res");
+ OIC_LOG(INFO, ES_RH_TAG, "constructResponse prov res");
OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_PROV);
OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_PS, gProvResource.ps);
OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_TNT, gProvResource.tnt);
{
(void) callback;
OCEntityHandlerResult ehRet = OC_EH_OK;
- OCEntityHandlerResponse response = { 0 };
+ OCEntityHandlerResponse response = { 0, 0, OC_EH_ERROR, 0, 0, { },{ 0 }, false };
OCRepPayload* payload = NULL;
if (entityHandlerRequest && (flag & OC_REQUEST_FLAG))
{
if (OC_REST_GET == entityHandlerRequest->method)
{
- OC_LOG(INFO, ES_RH_TAG, "Received GET request");
+ OIC_LOG(INFO, ES_RH_TAG, "Received GET request");
ehRet = ProcessGetRequest(entityHandlerRequest, &payload);
}
else if (OC_REST_PUT == entityHandlerRequest->method)
{
- OC_LOG(INFO, ES_RH_TAG, "Received PUT request");
+ OIC_LOG(INFO, ES_RH_TAG, "Received PUT request");
if (gProvResource.handle != NULL && entityHandlerRequest->resource == gProvResource.handle)
{
}
else
{
- OC_LOG(ERROR, ES_RH_TAG, "Cannot process put");
+ OIC_LOG(ERROR, ES_RH_TAG, "Cannot process put");
ehRet = OC_EH_ERROR;
}
}
else if (OC_REST_POST == entityHandlerRequest->method)
{
// TODO: As of now, POST request will be not received.
- OC_LOG(INFO, ES_RH_TAG, "Received OC_REST_POST from client");
+ OIC_LOG(INFO, ES_RH_TAG, "Received OC_REST_POST from client");
//ehRet = ProcessPostRequest (entityHandlerRequest, payload, sizeof(payload) - 1);
}
// Send the response
if (OCDoResponse(&response) != OC_STACK_OK)
{
- OC_LOG(ERROR, ES_RH_TAG, "Error sending response");
+ OIC_LOG(ERROR, ES_RH_TAG, "Error sending response");
ehRet = OC_EH_ERROR;
}
}
void __wifi_connected_cb(wifi_error_e error_code, void *user_data)
{
- OC_LOG(INFO,LOG_TAG,"#### __connected ");
+ OIC_LOG(INFO,LOG_TAG,"#### __connected ");
wifi_ap_get_ip_address(connectedWifi, WIFI_ADDRESS_FAMILY_IPV4, &gIpAddress);
- OC_LOG_V(INFO,LOG_TAG,"#### __connected, Ipaddress=%s", gIpAddress);
+ OIC_LOG_V(INFO,LOG_TAG,"#### __connected, Ipaddress=%s", gIpAddress);
gNetworkEventCb(ES_OK);
}
bool __wifi_found_ap_cb(wifi_ap_h ap, void *user_data)
{
- OC_LOG(INFO,LOG_TAG,"#### __wifi_found_ap_cb received ");
+ OIC_LOG(INFO,LOG_TAG,"#### __wifi_found_ap_cb received ");
int error_code = 0;
char *ap_name = NULL;
error_code = wifi_ap_get_essid(ap, &ap_name);
if (error_code != WIFI_ERROR_NONE)
{
- OC_LOG(ERROR,LOG_TAG,"#### Fail to get AP name.");
+ OIC_LOG(ERROR,LOG_TAG,"#### Fail to get AP name.");
return false;
}
error_code = wifi_ap_get_connection_state(ap, &state);
if (error_code != WIFI_ERROR_NONE)
{
- OC_LOG(ERROR,LOG_TAG,"#### Fail to get state.");
+ OIC_LOG(ERROR,LOG_TAG,"#### Fail to get state.");
return false;
}
- OC_LOG_V(INFO,LOG_TAG,"#### AP name : %s, state : %s", ap_name, print_state(state));
+ OIC_LOG_V(INFO,LOG_TAG,"#### AP name : %s, state : %s", ap_name, print_state(state));
if (strcmp(ap_name, gSsid) == 0)
{
- OC_LOG(INFO,LOG_TAG,"#### network found");
+ OIC_LOG(INFO,LOG_TAG,"#### network found");
wifi_ap_set_passphrase(ap, gPass);
connectedWifi = ap;
error_code = wifi_connect(ap, __wifi_connected_cb, NULL);
- OC_LOG_V(INFO,LOG_TAG,"Code=%d", error_code);
+ OIC_LOG_V(INFO,LOG_TAG,"Code=%d", error_code);
}
- OC_LOG(INFO,LOG_TAG,"#### __wifi_found_ap_cb received ");
+ OIC_LOG(INFO,LOG_TAG,"#### __wifi_found_ap_cb received ");
return true;
}
void __scan_request_cb(wifi_error_e error_code, void *user_data)
{
- OC_LOG(INFO, LOG_TAG, "__scan_request_cb");
+ OIC_LOG(INFO, LOG_TAG, "__scan_request_cb");
int error_code1;
error_code1 = wifi_foreach_found_aps(__wifi_found_ap_cb, NULL);
if (error_code1 != WIFI_ERROR_NONE)
- OC_LOG(INFO,LOG_TAG,"#### Fail to scan");
+ OIC_LOG(INFO,LOG_TAG,"#### Fail to scan");
- OC_LOG(INFO, LOG_TAG,"#### __scan_request_cb exit ");
+ OIC_LOG(INFO, LOG_TAG,"#### __scan_request_cb exit ");
}
static void __wifi_activated_cb(wifi_error_e result, void *user_data)
{
- OC_LOG(INFO, LOG_TAG, "__wifi_activated_cb");
+ OIC_LOG(INFO, LOG_TAG, "__wifi_activated_cb");
if (result == WIFI_ERROR_NONE)
{
- OC_LOG(INFO,LOG_TAG,"#### Success to activate Wi-Fi device!");
+ OIC_LOG(INFO,LOG_TAG,"#### Success to activate Wi-Fi device!");
}
wifi_scan(__scan_request_cb, NULL);
{
int error_code;
error_code = wifi_initialize();
- OC_LOG_V(INFO,LOG_TAG,"#### WIFI INITIALIZED WITH STATUS :%d", error_code);
+ OIC_LOG_V(INFO,LOG_TAG,"#### WIFI INITIALIZED WITH STATUS :%d", error_code);
error_code = wifi_activate(__wifi_activated_cb, NULL);
- OC_LOG_V(INFO,LOG_TAG,"#### WIFI ACTIVATED WITH STATUS :%d", error_code);
+ OIC_LOG_V(INFO,LOG_TAG,"#### WIFI ACTIVATED WITH STATUS :%d", error_code);
bool wifi_activated = false;
wifi_is_activated(&wifi_activated);
if (wifi_activated)
{
- OC_LOG(INFO,LOG_TAG,"#### Success to get Wi-Fi device state.");
+ OIC_LOG(INFO,LOG_TAG,"#### Success to get Wi-Fi device state.");
int scan_result = wifi_scan(__scan_request_cb, NULL);
- OC_LOG_V(INFO,LOG_TAG,"#### Wifi scan result:%d", scan_result);
+ OIC_LOG_V(INFO,LOG_TAG,"#### Wifi scan result:%d", scan_result);
}
else
{
- OC_LOG(ERROR,LOG_TAG, "#### Fail to get Wi-Fi device state.");
+ OIC_LOG(ERROR,LOG_TAG, "#### Fail to get Wi-Fi device state.");
}
}
static void start()
{
- OC_LOG(INFO, LOG_TAG, "START");
+ OIC_LOG(INFO, LOG_TAG, "START");
ESActivateWifi();
}
void ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCallback cb)
{
- OC_LOG_V(INFO, LOG_TAG, "ConnectToWiFiNetwork %s %s",ssid,pass);
+ OIC_LOG_V(INFO, LOG_TAG, "ConnectToWiFiNetwork %s %s",ssid,pass);
gPass = pass;
gSsid = ssid;
gNetworkEventCb = cb;
RemoteEnrollee::shared_ptr EasySetup::findDeviceInProvisioningList (
const ProvConfig& provConfig, const WiFiOnboadingConnection& onboardingconn)
{
- OC_LOG(DEBUG,EASYSETUP_TAG,"Entered findDeviceInProvisioningList ()");
+ OIC_LOG(DEBUG,EASYSETUP_TAG,"Entered findDeviceInProvisioningList ()");
std::vector< std::shared_ptr< RemoteEnrollee > >::iterator it;
std::shared_ptr< RemoteEnrollee > remoteEnrollee = nullptr;
for(auto it : m_activeEnrolleeList)
{
- OC_LOG_V(DEBUG,EASYSETUP_TAG,"entered the iterator");
+ OIC_LOG_V(DEBUG,EASYSETUP_TAG,"entered the iterator");
ProvConfig activeEnrolleConfig = it->getProvConfig();
WiFiOnboadingConnection activeEnrolleConn = it->getOnboardConn();
}
}
- OC_LOG_V(DEBUG,EASYSETUP_TAG,"Return nullptr for findDeviceInProvisioningList call");
+ OIC_LOG_V(DEBUG,EASYSETUP_TAG,"Return nullptr for findDeviceInProvisioningList call");
return remoteEnrollee;
}
}
}
- OC_LOG_V(DEBUG,EASYSETUP_TAG,"Adding new device RemoteEnrollee list");
+ OIC_LOG_V(DEBUG,EASYSETUP_TAG,"Adding new device RemoteEnrollee list");
m_activeEnrolleeList.push_back(remoteEnrollee);
return true;
}
{
for (unsigned int i = 0; i < list.size(); i++)
{
- OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Device %d ID %s ", i + 1,
+ OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Device %d ID %s ", i + 1,
list[i]->getDeviceID().c_str());
- OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "From IP :%s", list[i]->getDevAddr().c_str());
+ OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "From IP :%s", list[i]->getDevAddr().c_str());
if (list[i]->getDevAddr() == host)
{
{
if (hasError)
{
- OC_LOG(ERROR, ENROLEE_SECURITY_TAG,"Error!!! in OwnershipTransfer");
+ OIC_LOG(ERROR, ENROLEE_SECURITY_TAG,"Error!!! in OwnershipTransfer");
std::shared_ptr< SecProvisioningResult > securityProvisioningStatus = nullptr;
std::string uuid;
}
else
{
- OC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "ownershipTransferCb : Received provisioning results: ");
+ OIC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "ownershipTransferCb : Received provisioning results: ");
for (unsigned int i = 0; i < result->size(); i++)
{
- OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Result is = %d for device",result->at(i).res);
+ OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Result is = %d for device",result->at(i).res);
std::string uuid;
convertUUIDToString(result->at(0).deviceId, uuid);
- OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "UUID : %s",uuid.c_str());
+ OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "UUID : %s",uuid.c_str());
std::shared_ptr< SecProvisioningResult > securityProvisioningStatus = nullptr;
securityProvisioningStatus = std::make_shared< SecProvisioningResult >(uuid,
ES_OK);
pOwnedDevList);
if (result != OC_STACK_OK)
{
- OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Owned Discovery failed.");
+ OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Owned Discovery failed.");
ownershipStatus = DEVICE_NOT_OWNED;
//Throw exception
throw ESPlatformException(result);
}
else if (pOwnedDevList.size())
{
- OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Found owned devices. Count =%d",
+ OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Found owned devices. Count =%d",
pOwnedDevList.size());
std::shared_ptr< OC::OCSecureResource > ownedDevice =
findEnrollee(
}
else
{
- OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "No owned devices found.");
+ OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "No owned devices found.");
ownershipStatus = DEVICE_NOT_OWNED;
}
result = OCSecure::discoverUnownedDevices(ES_SEC_DISCOVERY_TIMEOUT, pUnownedDevList);
if (result != OC_STACK_OK)
{
- OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "UnOwned Discovery failed.");
+ OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "UnOwned Discovery failed.");
ownershipStatus = DEVICE_NOT_OWNED;
//Throw exception
throw ESPlatformException(result);
}
else if (pUnownedDevList.size())
{
- OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Found Unowned devices. Count =%d",
+ OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Found Unowned devices. Count =%d",
pUnownedDevList.size());
m_unownedDevice =
CreateJustWorksOwnerTransferPayload;
OCSecure::setOwnerTransferCallbackData(OIC_JUST_WORKS, &justWorksCBData, NULL);
- OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Transfering ownership for : %s ",
+ OIC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Transfering ownership for : %s ",
m_unownedDevice->getDeviceID().c_str());
OC::ResultCallBack ownershipTransferCb = std::bind(
if (m_unownedDevice->doOwnershipTransfer(ownershipTransferCb) != OC_STACK_OK)
{
- OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "OwnershipTransferCallback is failed");
+ OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "OwnershipTransferCallback is failed");
ownershipStatus = DEVICE_NOT_OWNED;
//Throw exception
throw ESPlatformException(result);
}
else
{
- OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "No unSecure devices found.");
+ OIC_LOG(ERROR, ENROLEE_SECURITY_TAG, "No unSecure devices found.");
ownershipStatus = DEVICE_NOT_OWNED;
return ownershipStatus;
m_currentESState = CurrentESState::ES_UNKNOWN;
m_isSecured = connection.isSecured; //enrolleeNWProvInfo.needSecuredEasysetup;
- OC_LOG ( DEBUG, ES_REMOTE_ENROLLEE_TAG, "Inside RemoteEnrollee constr");
+ OIC_LOG ( DEBUG, ES_REMOTE_ENROLLEE_TAG, "Inside RemoteEnrollee constr");
}
#ifdef __WITH_DTLS__
void RemoteEnrollee::registerEasySetupStatusHandler(EasySetupStatusCB callback)
{
- OC_LOG ( DEBUG, ES_REMOTE_ENROLLEE_TAG, "Entered registerStatusHandler");
+ OIC_LOG ( DEBUG, ES_REMOTE_ENROLLEE_TAG, "Entered registerStatusHandler");
if(!callback)
{
throw ESInvalidParameterException("Callback is empty");
void RemoteEnrollee::easySetupSecurityStatusCallback(
std::shared_ptr< SecProvisioningResult > secProvisioningResult)
{
- OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG, "easySetupStatusCallback status is, UUID = %s, "
+ OIC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG, "easySetupStatusCallback status is, UUID = %s, "
"Status = %d", secProvisioningResult->getDeviceUUID().c_str(),
secProvisioningResult->getResult());
if(secProvisioningResult->getResult() == ES_OK)
{
- OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "Ownership and ACL are successful. "
+ OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "Ownership and ACL are successful. "
"Continue with Network information provisioning");
m_currentESState = CurrentESState::ES_OWNED;
- OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");
+ OIC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");
RemoteEnrolleeResource::ProvStatusCb provStatusCb = std::bind(
&RemoteEnrollee::provisioningStatusHandler, this, std::placeholders::_1);
}
else
{
- OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "Ownership and ACL are successful");
+ OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "Ownership and ACL are successful");
std::shared_ptr< EasySetupStatus > easySetupStatus = nullptr;
easySetupStatus = std::make_shared< EasySetupStatus >(DEVICE_NOT_PROVISIONED,
m_ProvConfig);
void RemoteEnrollee::provisioningStatusHandler(
std::shared_ptr< ProvisioningStatus > provStatus)
{
- OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Entering ProvisioningStatusHandler");
+ OIC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Entering ProvisioningStatusHandler");
- OC_LOG_V(DEBUG,ES_REMOTE_ENROLLEE_TAG,"ProvStatus = %d", provStatus->getESResult());
+ OIC_LOG_V(DEBUG,ES_REMOTE_ENROLLEE_TAG,"ProvStatus = %d", provStatus->getESResult());
std::shared_ptr< EasySetupStatus > easySetupStatus = nullptr;
void RemoteEnrollee::startProvisioning()
{
- OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Entering startProvisioning");
+ OIC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Entering startProvisioning");
if (m_remoteResource == nullptr)
{
throw ESBadRequestException ("Device not created");
if (result == ES_ERROR)
{
- OC_LOG(ERROR,ES_REMOTE_ENROLLEE_TAG,
+ OIC_LOG(ERROR,ES_REMOTE_ENROLLEE_TAG,
"Failed to create device using constructResourceObject");
throw ESBadRequestException ("Device not created");
}
EasySetupState easySetupState = m_enrolleeSecurity->performOwnershipTransfer();
if (easySetupState == DEVICE_NOT_OWNED)
{
- OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG,
+ OIC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG,
"performOwnershipTransfer returned : %d",
easySetupState);
return;
}
else if (easySetupState == DEVICE_OWNED)
{
- OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG,
+ OIC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG,
"performOwnershipTransfer returned : %d",
easySetupState);
- OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");
+ OIC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");
RemoteEnrolleeResource::ProvStatusCb provStatusCb = std::bind(
&RemoteEnrollee::provisioningStatusHandler,
}
catch (OCException & e)
{
- OC_LOG_V(ERROR, ES_REMOTE_ENROLLEE_TAG,
+ OIC_LOG_V(ERROR, ES_REMOTE_ENROLLEE_TAG,
"Exception for performOwnershipTransfer : %s", e.reason().c_str());
return ;
}
}
#else
- OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");
+ OIC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");
RemoteEnrolleeResource::ProvStatusCb provStatusCb = std::bind(
&RemoteEnrollee::provisioningStatusHandler, this, std::placeholders::_1);
void RemoteEnrolleeResource::checkProvInformationCb(const HeaderOptions& /*headerOptions*/,
const OCRepresentation& rep, const int eCode)
{
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "checkProvInformationCb : %s, eCode = %d",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "checkProvInformationCb : %s, eCode = %d",
rep.getUri().c_str(),
eCode);
if (eCode != 0)
{
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"checkProvInformationCb : Provisioning is failed ");
std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);
rep.getValue(OC_RSRVD_ES_TNN, tnn);
rep.getValue(OC_RSRVD_ES_CD, cd);
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "checkProvInformationCb : ps - %d", ps);
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "checkProvInformationCb : ps - %d", ps);
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"checkProvInformationCb : tnn - %s", tnn.c_str());
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"checkProvInformationCb : cd - %s", cd.c_str());
//Provisioning status check
{
if (tnn != std::string(m_ProvConfig.provData.WIFI.ssid))
{
- OC_LOG_V (ERROR, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (ERROR, ES_REMOTE_ENROLLEE_RES_TAG,
"checkProvInformationCb : Network SSID is not the same as the "
"SSID provisioned");
std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
if (cd != std::string(m_ProvConfig.provData.WIFI.pwd))
{
- OC_LOG_V (ERROR, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (ERROR, ES_REMOTE_ENROLLEE_RES_TAG,
"checkProvInformationCb : Network PWD is not the same as the "
"PWD provisioned");
std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
return;
}
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"checkProvInformationCb : Provisioning is success ");
std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
ProvisioningStatus >(ESResult::ES_OK, ESState::ES_PROVISIONING_SUCCESS);
}
else
{
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"checkProvInformationCb : Provisioning is failed ");
std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);
void RemoteEnrolleeResource::getProvStatusResponse(const HeaderOptions& /*headerOptions*/,
const OCRepresentation& rep, const int eCode)
{
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : %s, eCode = %d",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : %s, eCode = %d",
rep.getUri().c_str(),
eCode);
if (eCode != 0)
{
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"getProvStatusResponse : Provisioning is failed ");
std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);
rep.getValue(OC_RSRVD_ES_TNN, tnn);
rep.getValue(OC_RSRVD_ES_CD, cd);
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : ps - %d",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : ps - %d",
ps);
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : tnn - %s",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : tnn - %s",
tnn.c_str());
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : cd - %s",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : cd - %s",
cd.c_str());
if (ps == ES_PS_NEED_PROVISIONING) //Indicates the need for provisioning
provisioningRepresentation.setValue(OC_RSRVD_ES_CD,
std::string(m_ProvConfig.provData.WIFI.pwd));
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : ssid - %s",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : ssid - %s",
m_ProvConfig.provData.WIFI.ssid);
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : pwd - %s",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : pwd - %s",
m_ProvConfig.provData.WIFI.pwd);
m_ocResource->put(provisioningRepresentation, QueryParamsMap(),
}
else if (ps == ES_PS_PROVISIONING_COMPLETED) //Indicates that provisioning is completed
{
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"getProvStatusResponse : Provisioning is successful");
std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
ProvisioningStatus >(ESResult::ES_OK, ESState::ES_PROVISIONED_ALREADY);
void RemoteEnrolleeResource::onDeviceDiscovered(std::shared_ptr<OC::OCResource> resource)
{
- OC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "onDeviceDiscovered");
+ OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "onDeviceDiscovered");
std::string resourceURI;
std::string hostAddress;
{
// Get the resource URI
resourceURI = resource->uri();
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"URI of the resource: %s", resourceURI.c_str());
// Get the resource host address
hostAddress = resource->host();
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"Host address of the resource: %s", hostAddress.c_str());
std::size_t foundIP =
m_ocResource = resource;
m_discoveryResponse = true;
- OC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"Found the device with the resource");
return;
}
else
{
- OC_LOG (ERROR, ES_REMOTE_ENROLLEE_RES_TAG, "NOT the intended resource.");
+ OIC_LOG (ERROR, ES_REMOTE_ENROLLEE_RES_TAG, "NOT the intended resource.");
}
}
else
{
- OC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Resource is invalid");
+ OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Resource is invalid");
}
}
catch(std::exception& e)
{
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"Exception in foundResource: %s", e.what());
}
}
std::vector< std::string > resTypes =
{ ES_PROV_RES_TYPE};
- OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Before OCPlatform::constructResourceObject");
+ OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Before OCPlatform::constructResourceObject");
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_host = %s",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_host = %s",
m_wifiOnboardingconn.ipAddress);
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "ES_PROV_RES_URI = %s", ES_PROV_RES_URI);
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_connectivityType = %d",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "ES_PROV_RES_URI = %s", ES_PROV_RES_URI);
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_connectivityType = %d",
m_ProvConfig.connType);
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "resTypes = %s",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "resTypes = %s",
resTypes.at(0).c_str());
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "interface = %s", interface.at(0).c_str());
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "interface = %s", interface.at(0).c_str());
std::string host;
if(m_wifiOnboardingconn.isSecured)
host.append(":55555");
}
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "HOST = %s", host.c_str());
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "HOST = %s", host.c_str());
m_ocResource = OC::OCPlatform::constructResourceObject(host,
ES_PROV_RES_URI,
true,
resTypes,
interface);
- OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
"created OCResource : %s", m_ocResource->uri().c_str());
return ES_OK;
}
catch (OCException & e)
{
- OC_LOG_V(ERROR, ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG_V(ERROR, ES_REMOTE_ENROLLEE_RES_TAG,
"Exception for constructResourceObject : %s", e.reason().c_str());
+ return ES_ERROR;
}
-
#else
std::string host("");
std::string query("");
query.append("?rt=");
query.append(ES_PROV_RES_TYPE);
- OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Before OCPlatform::constructResourceObject");
+ OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Before OCPlatform::constructResourceObject");
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "host = %s",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "host = %s",
host.c_str());
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "query = %s", query.c_str());
- OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_connectivityType = %d",
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "query = %s", query.c_str());
+ OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_connectivityType = %d",
m_ProvConfig.connType);
m_discoveryResponse = false;
if (result != OCStackResult::OC_STACK_OK)
{
- OC_LOG(ERROR,ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG(ERROR,ES_REMOTE_ENROLLEE_RES_TAG,
"Failed to create device using constructResourceObject");
return ES_ERROR;
}
ESResult foundResponse = ESDiscoveryTimeout (DISCOVERY_TIMEOUT);
- if (!m_discoveryResponse)
+ if (foundResponse ==ES_ERROR || !m_discoveryResponse)
{
- OC_LOG(ERROR,ES_REMOTE_ENROLLEE_RES_TAG,
+ OIC_LOG(ERROR,ES_REMOTE_ENROLLEE_RES_TAG,
"Failed to create device using constructResourceObject");
return ES_ERROR;
}
{
if(g_OnBoardingSucceeded)
{
- OC_LOG_V(ERROR, TAG, "Failure in Provisioning. \
+ OIC_LOG_V(ERROR, TAG, "Failure in Provisioning. \
Current Enrollee State: %d",enrolleeState);
g_OnBoardingSucceeded = false;
}
else if(g_ProvisioningSucceeded)
{
- OC_LOG_V(ERROR, TAG, "Failure in connect to target network. \
+ OIC_LOG_V(ERROR, TAG, "Failure in connect to target network. \
Current Enrollee State: %d",enrolleeState);
g_ProvisioningSucceeded = false;
}
extern char *__brkval;
//address of tmp gives us the current stack boundry
int tmp;
- OC_LOG_V(INFO, TAG, "Stack: %u Heap: %u", (unsigned int)&tmp, (unsigned int)__brkval);
- OC_LOG_V(INFO, TAG, "Unallocated Memory between heap and stack: %u",
+ OIC_LOG_V(INFO, TAG, "Stack: %u Heap: %u", (unsigned int)&tmp, (unsigned int)__brkval);
+ OIC_LOG_V(INFO, TAG, "Unallocated Memory between heap and stack: %u",
((unsigned int)&tmp - (unsigned int)__brkval));
#endif
}
void StartEasySetup()
{
- OC_LOG(DEBUG, TAG, "OCServer is starting...");
+ OIC_LOG(DEBUG, TAG, "OCServer is starting...");
//InitEasySetup with sercurity mode disabled for arduino
if(InitEasySetup(CT_ADAPTER_IP, ssid, passwd, false, EventCallbackInApp) == ES_ERROR)
{
- OC_LOG(ERROR, TAG, "OnBoarding Failed");
+ OIC_LOG(ERROR, TAG, "OnBoarding Failed");
return;
}
g_isInitialized = true;
- OC_LOG_V(ERROR, TAG, "OnBoarding succeded. Successfully connected to ssid : %s",ssid);
+ OIC_LOG_V(ERROR, TAG, "OnBoarding succeded. Successfully connected to ssid : %s",ssid);
}
void StartProvisioning()
{
- OC_LOG(DEBUG, TAG, "StartProvisioning is invoked...");
+ OIC_LOG(DEBUG, TAG, "StartProvisioning is invoked...");
// Initialize the OC Stack in Server mode
if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "OCStack init error!!");
+ OIC_LOG(ERROR, TAG, "OCStack init error!!");
return;
}
if (InitProvisioning() == ES_ERROR)
{
- OC_LOG(ERROR, TAG, "Init Provisioning Failed!!");
+ OIC_LOG(ERROR, TAG, "Init Provisioning Failed!!");
return;
}
}
void StopEasySetup()
{
- OC_LOG(DEBUG, TAG, "Stopping EasySetup is invoked...");
+ OIC_LOG(DEBUG, TAG, "Stopping EasySetup is invoked...");
g_isInitialized = false;
if (TerminateEasySetup() == ES_ERROR)
{
- OC_LOG(ERROR, TAG, "TerminateEasySetup Failed!!");
+ OIC_LOG(ERROR, TAG, "TerminateEasySetup Failed!!");
return;
}
//stop OC Stack
if (OCStop() != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "OCStack stop failed!!");
+ OIC_LOG(ERROR, TAG, "OCStack stop failed!!");
return;
}
- OC_LOG(DEBUG, TAG, "Stopping EasySetup done");
+ OIC_LOG(DEBUG, TAG, "Stopping EasySetup done");
}
{
// Add your initialization code here
// Note : This will initialize Serial port on Arduino at 115200 bauds
- OC_LOG_INIT();
+ OIC_LOG_INIT();
Serial.println("#########################");
Serial.println("EasySetup Enrollee SAMPLE");
// Give CPU cycles to OCStack to perform send/recv and other OCStack stuff
if (OCProcess() != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "OCStack process error");
+ OIC_LOG(ERROR, TAG, "OCStack process error");
return;
}
}
{
string logmessage = "callback!!! in app";
- OC_LOG(INFO,LOG_TAG,"callback!!! in app");
+ OIC_LOG(INFO,LOG_TAG,"callback!!! in app");
if (esResult == ES_OK)
{
if (!g_OnBoardingSucceeded)
{
- OC_LOG(INFO,LOG_TAG,"Device is successfully OnBoarded");
+ OIC_LOG(INFO,LOG_TAG,"Device is successfully OnBoarded");
logmessage += "Device is successfully OnBoarded";
g_OnBoardingSucceeded = true;
}
else if (g_OnBoardingSucceeded & enrolleeState == ES_ON_BOARDED_STATE)
{
- OC_LOG(INFO,LOG_TAG,"Device is successfully OnBoared with SoftAP");
+ OIC_LOG(INFO,LOG_TAG,"Device is successfully OnBoared with SoftAP");
logmessage += "Device is successfully OnBoared with SoftAP";
g_ProvisioningSucceeded = true;
}
else if (enrolleeState == ES_PROVISIONED_STATE)
{
- OC_LOG(INFO,LOG_TAG,"Device is provisioned");
+ OIC_LOG(INFO,LOG_TAG,"Device is provisioned");
logmessage += "Device is provisioned";
g_ProvisioningSucceeded = true;
}
{
if (g_OnBoardingSucceeded)
{
- OC_LOG_V(ERROR,LOG_TAG,
+ OIC_LOG_V(ERROR,LOG_TAG,
"Failure in Provisioning. \
Current Enrollee State: %d",
enrolleeState);
}
else if (g_ProvisioningSucceeded)
{
- OC_LOG_V(ERROR,LOG_TAG,
+ OIC_LOG_V(ERROR,LOG_TAG,
"Failure in connect to target network. \
Current Enrollee State: %d",
enrolleeState);
copy_files();
if (InitEasySetup(CT_ADAPTER_IP, ssid, passwd, EventCallbackInApp) == ES_ERROR)
{
- OC_LOG(ERROR,LOG_TAG,"OnBoarding Failed");
+ OIC_LOG(ERROR,LOG_TAG,"OnBoarding Failed");
logmessage = logmessage + "OnBoarding Failed. Connect to " + ssid + " pasword= " + passwd;
ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage);
return;
}
g_isInitialized = true;
- OC_LOG_V(ERROR,LOG_TAG, "OnBoarding succeeded. Successfully connected to ssid : %s",
+ OIC_LOG_V(ERROR,LOG_TAG, "OnBoarding succeeded. Successfully connected to ssid : %s",
ssid);
logmessage = logmessage + "OnBoarding succeeded. Successfully connected to ssid:" + ssid;
ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage);
void StartProvisioning(void *data, Evas_Object *obj, void *event_info)
{
- OC_LOG(INFO,LOG_TAG,"StartProvisioning");
+ OIC_LOG(INFO,LOG_TAG,"StartProvisioning");
string logmessage = "StartProvisioning\n";
if (InitProvisioning() == ES_ERROR)
{
- OC_LOG(ERROR,LOG_TAG,"Init Provisioning Failed");
+ OIC_LOG(ERROR,LOG_TAG,"Init Provisioning Failed");
logmessage += "Init Provisioning Failed\n";
return;
}
if (pthread_create(&thread_handle, NULL, listeningFunc, NULL))
{
- OC_LOG(ERROR,LOG_TAG,"Thread creation failed");
+ OIC_LOG(ERROR,LOG_TAG,"Thread creation failed");
}
if (result != OC_STACK_OK)
{
- OC_LOG(ERROR,LOG_TAG,"OCStack stop error");
+ OIC_LOG(ERROR,LOG_TAG,"OCStack stop error");
}
// To minimize CPU utilization we may wish to do this with sleep
void EventCallbackInApp(ESResult esResult, EnrolleeState enrolleeState)
{
string logmessage = "callback!!! in app";
- OC_LOG(INFO,LOG_TAG,"callback!!! in app");
+ OIC_LOG(INFO,LOG_TAG,"callback!!! in app");
if (esResult == ES_OK)
{
if (!g_OnBoardingSucceeded)
{
- OC_LOG(INFO,LOG_TAG,"Device is successfully OnBoarded");
+ OIC_LOG(INFO,LOG_TAG,"Device is successfully OnBoarded");
logmessage += "Device is successfully OnBoarded";
g_OnBoardingSucceeded = true;
}
else if (g_OnBoardingSucceeded & enrolleeState == ES_ON_BOARDED_STATE)
{
- OC_LOG(INFO,LOG_TAG,"Device is successfully OnBoared with SoftAP");
+ OIC_LOG(INFO,LOG_TAG,"Device is successfully OnBoared with SoftAP");
logmessage += "Device is successfully OnBoared with SoftAP";
g_ProvisioningSucceeded = true;
}
else if (enrolleeState == ES_PROVISIONED_STATE)
{
- OC_LOG(INFO,LOG_TAG,"Device is provisioned");
+ OIC_LOG(INFO,LOG_TAG,"Device is provisioned");
logmessage += "Device is provisioned";
g_ProvisioningSucceeded = true;
}
{
if (g_OnBoardingSucceeded)
{
- OC_LOG_V(ERROR,LOG_TAG,
+ OIC_LOG_V(ERROR,LOG_TAG,
"Failure in Provisioning.Current Enrollee State: %d", enrolleeState);
logmessage += "Failure in Provisioning\n";
g_OnBoardingSucceeded = false;
}
else if (g_ProvisioningSucceeded)
{
- OC_LOG_V(ERROR,LOG_TAG,
+ OIC_LOG_V(ERROR,LOG_TAG,
"Failure in connect to target network.Current Enrollee State: %d", enrolleeState);
logmessage += "Failure in connect to target network\n";
g_ProvisioningSucceeded = false;
string logmessage = "Init Easysetup\n";
if (InitEasySetup(CT_ADAPTER_IP, ssid, passwd, EventCallbackInApp) == ES_ERROR)
{
- OC_LOG(ERROR,LOG_TAG,"OnBoarding Failed");
+ OIC_LOG(ERROR,LOG_TAG,"OnBoarding Failed");
logmessage = logmessage + "OnBoarding Failed. Connect to " + ssid + " pasword= " + passwd;
ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage);
return;
}
g_isInitialized = true;
- OC_LOG_V(ERROR,LOG_TAGLOG_TAG, "OnBoarding succeeded. Successfully connected to ssid : %s",
+ OIC_LOG_V(ERROR,LOG_TAGLOG_TAG, "OnBoarding succeeded. Successfully connected to ssid : %s",
ssid);
logmessage = logmessage + "OnBoarding succeeded. Successfully connected to ssid:" + ssid;
ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage);
*/
void StartProvisioning(void *data, Evas_Object *obj, void *event_info)
{
- OC_LOG(INFO,LOG_TAG"StartProvisioning");
+ OIC_LOG(INFO,LOG_TAG"StartProvisioning");
string logmessage = "StartProvisioning\n";
if (InitProvisioning() == ES_ERROR)
{
- OC_LOG(ERROR,LOG_TAG,"Init Provisioning Failed");
+ OIC_LOG(ERROR,LOG_TAG,"Init Provisioning Failed");
logmessage += "Init Provisioning Failed\n";
return;
}
pthread_t thread_handle;
if (pthread_create(&thread_handle, NULL, listeningFunc, NULL))
{
- OC_LOG(ERROR,LOG_TAG,"Thread creation failed");
+ OIC_LOG(ERROR,LOG_TAG,"Thread creation failed");
}
ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage);
}
result = OCProcess();
if (result != OC_STACK_OK)
{
- OC_LOG(ERROR,LOG_TAG,"OCStack stop error");
+ OIC_LOG(ERROR,LOG_TAG,"OCStack stop error");
}
// To minimize CPU utilization we may wish to do this with sleep