Commit 449aceed authored by lankamadan's avatar lankamadan Committed by Madan Lanka

Easysetup - Change OC_LOG to OIC_LOG & warning fixes

- OC_LOG is being depricated, so moved to OIC_LOG
- Fixed some warnings in mediator and enrollee for linux platform

Change-Id: Ie856dc343569e553e0d680a8ccbcdc30cc2d7210
Signed-off-by: default avatarlankamadan <lanka.madan@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/5071Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
parent 0e776270
......@@ -39,13 +39,13 @@ static void ESActivateWifi()
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;
......
......@@ -76,14 +76,14 @@ static bool ValidateParam(OCConnectivityType networkType, const char *ssid, cons
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);
}
......@@ -91,20 +91,20 @@ void OnboardingCallback(ESResult esResult)
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);
}
......@@ -112,7 +112,7 @@ void ProvisioningCallback(ESResult esResult)
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)
{
......@@ -120,7 +120,7 @@ void OnboardingCallbackTargetNet(ESResult esResult)
}
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.
......@@ -132,10 +132,10 @@ ESResult InitEasySetup(OCConnectivityType networkType, const char *ssid, const c
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;
}
......@@ -149,17 +149,17 @@ ESResult InitEasySetup(OCConnectivityType networkType, const char *ssid, const c
// 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;
}
......@@ -170,7 +170,7 @@ ESResult TerminateEasySetup()
//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;
}
......@@ -178,45 +178,45 @@ ESResult TerminateEasySetup()
#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;
......
......@@ -62,7 +62,7 @@ bool ESBleOnboarding()
*/
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())
{
......@@ -80,14 +80,14 @@ bool ESOnboard(const char * ssid, const char* passwd, NetworkEventCallback cb)
}
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;
}
}
......
......@@ -111,7 +111,7 @@ OCStackResult CreateProvisioningResource(bool isSecured)
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;
}
......@@ -120,7 +120,7 @@ OCStackResult DeleteProvisioningResource()
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;
......@@ -151,13 +151,13 @@ OCStackResult CreateNetworkResource()
}
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;
}
......@@ -167,7 +167,7 @@ OCStackResult DeleteNetworkResource()
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));
}
......@@ -181,19 +181,19 @@ OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest,
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;
}
......@@ -206,18 +206,18 @@ OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest,
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;
}
......@@ -228,7 +228,7 @@ OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest,
// 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");
}
......@@ -242,25 +242,25 @@ OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest,
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;
}
......@@ -271,24 +271,24 @@ OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest,
}
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;
......@@ -307,13 +307,13 @@ OCRepPayload* constructResponse(OCEntityHandlerRequest *ehRequest)
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);
......@@ -338,18 +338,18 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag,
{
(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)
{
......@@ -357,14 +357,14 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag,
}
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);
}
......@@ -386,7 +386,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag,
// 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;
}
}
......
......@@ -52,16 +52,16 @@ print_state(wifi_connection_state_e state)
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;
......@@ -70,47 +70,47 @@ bool __wifi_found_ap_cb(wifi_ap_h ap, void *user_data)
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);
......@@ -119,34 +119,34 @@ static void ESActivateWifi()
{
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;
......
......@@ -49,14 +49,14 @@ namespace OIC
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();
......@@ -70,7 +70,7 @@ namespace OIC
}
}
OC_LOG_V(DEBUG,EASYSETUP_TAG,"Return nullptr for findDeviceInProvisioningList call");
OIC_LOG_V(DEBUG,EASYSETUP_TAG,"Return nullptr for findDeviceInProvisioningList call");
return remoteEnrollee;
}
......@@ -95,7 +95,7 @@ namespace OIC
}
}
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;
}
......
......@@ -80,9 +80,9 @@ namespace OIC
{
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)
{
......@@ -115,7 +115,7 @@ namespace OIC
{
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;
......@@ -128,14 +128,14 @@ namespace OIC
}
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);
......@@ -165,7 +165,7 @@ namespace OIC
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);
......@@ -173,7 +173,7 @@ namespace OIC
}