Commit 47b903ef authored by lankamadan's avatar lankamadan Committed by Madan Lanka

Fixed EasySetup Arduino Mega build error

- Arduino PCF logging is being handled inside logger, so removed PCF for

Change-Id: Ic9455db2480612bfb838f60818950cfd17585dfc
Signed-off-by: default avatarlankamadan <lanka.madan@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2577Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
parent b8db5606
......@@ -64,7 +64,7 @@ if build_sample == 'ON':
if target_os == 'darwin':
target_path = 'linux'
env.SConscript('./samples/' + target_path + '/SConscript')
#env.SConscript('./samples/' + target_path + '/SConscript')
elif target_os in ['android']:
env.SConscript('./samples/' + target_os + '/SConscript')
......
......@@ -41,10 +41,12 @@ if target_os not in ['arduino','darwin']:
# Build notification manager project
SConscript('notification-manager/SConscript')
if target_os in ['arduino','android', 'linux']:
SConscript('easy-setup/SConscript')
# Build resource-encapsulation project
if target_os not in ['tizen']:
SConscript('resource-encapsulation/SConscript')
if target_os in ['arduino','android', 'linux']:
SConscript('easy-setup/SConscript')
......@@ -42,9 +42,9 @@
#include "easysetup.h"
const char *getResult(OCStackResult result);
#define TAG "TS"
PROGMEM const char TAG[] = "ThinServer";
const char *getResult(OCStackResult result);
char ssid[] = "EasySetup123";
char passwd[] = "EasySetup123";
......@@ -78,7 +78,7 @@ void setup()
// Add your initialization code here
// Note : This will initialize Serial port on Arduino at 115200 bauds
OC_LOG_INIT();
OC_LOG(DEBUG, TAG, PCF("OCServer is starting..."));
OC_LOG(DEBUG, TAG, "OCServer is starting...");
if(InitEasySetup(ES_WIFI, ssid, passwd, EventCallbackInApp) == ES_ERROR)
{
......@@ -106,7 +106,7 @@ void loop()
// Give CPU cycles to OCStack to perform send/recv and other OCStack stuff
if (OCProcess() != OC_STACK_OK)
{
OC_LOG(ERROR, TAG, PCF("OCStack process error"));
OC_LOG(ERROR, TAG, "OCStack process error");
return;
}
}
......@@ -20,7 +20,7 @@
#include "networkHandler.h"
#define TAG PCF("ES_NH")
#define TAG "ES_NH"
int findNetwork(const char *ssid);
int ConnectToNetwork(const char *ssid, const char *pass);
......@@ -43,7 +43,7 @@ ESResult ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCa
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD)
{
OC_LOG(ERROR, TAG, PCF("WiFi shield not present"));
OC_LOG(ERROR, TAG, "WiFi shield not present");
return ES_ERROR;
}
......@@ -53,11 +53,11 @@ ESResult ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCa
if (strncmp(fwVersion, ARDUINO_WIFI_SHIELD_UDP_FW_VER, sizeof(ARDUINO_WIFI_SHIELD_UDP_FW_VER))
!= 0)
{
OC_LOG(DEBUG, TAG, PCF("!!!!! Upgrade WiFi Shield Firmware version !!!!!!"));
OC_LOG(DEBUG, TAG, "!!!!! Upgrade WiFi Shield Firmware version !!!!!!");
//return ES_ERROR;
}
OC_LOG_V(INFO, TAG, PCF("Finding SSID: %s"), ssid);
OC_LOG_V(INFO, TAG, "Finding SSID: %s", ssid);
while (findNetwork(ssid) == 0) // found
{
......@@ -126,17 +126,17 @@ int ConnectToNetwork(const char *ssid, const char *pass)
// attempt to connect to Wifi network:
while (status != WL_CONNECTED)
{
OC_LOG_V(INFO, TAG, PCF("Attempting to connect to SSID: %s"), ssid);
OC_LOG_V(INFO, TAG, "Attempting to connect to SSID: %s", ssid);
status = WiFi.begin((char *) ssid, (char *) pass);
// wait 10 seconds for connection:
delay(10000);
}
OC_LOG(DEBUG, TAG, PCF("Connected to wifi"));
OC_LOG(DEBUG, TAG, "Connected to wifi");
myIP = WiFi.localIP();
OC_LOG_V(INFO, TAG, PCF("IP Address: %d.%d.%d.%d"), myIP[0], myIP[1], myIP[2], myIP[3]);
OC_LOG_V(INFO, TAG, "IP Address: %d.%d.%d.%d", myIP[0], myIP[1], myIP[2], myIP[3]);
char buf[50];
sprintf(buf, "IP Address: %d.%d.%d.%d", myIP[0], myIP[1], myIP[2], myIP[3]);
......
......@@ -21,13 +21,9 @@
// Do not remove the include below
#include "Arduino.h"
#include "logger.h"
#include "ocstack.h"
#include <string.h>
#include "common.h"
#include "ocstack.h"
#include "networkHandler.h"
#include "resourceHandler.h"
typedef void (*EventCallback)(ESResult);
......
......@@ -19,9 +19,11 @@
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include "easysetup.h"
#include "ocstack.h"
#define TAG PCF("ES")
#include "logger.h"
#include "resourceHandler.h"
#define TAG "ES"
int g_eventflag = 0;
int g_cnt = 0;
......@@ -57,7 +59,7 @@ void EventCallbackInProvisioning(ESResult event)
if(TerminateEasySetup() != OC_STACK_OK)
{
OC_LOG(ERROR, TAG, PCF("Terminating stack failed"));
OC_LOG(ERROR, TAG, "Terminating stack failed");
return;
}
......@@ -102,11 +104,11 @@ ESResult FindNetworkForOnboarding(NetworkType networkType,
if(ConnectToWiFiNetwork(ssid, passwd, EventCallbackInOnboarding) != ES_NETWORKCONNECTED)
{
OC_LOG(ERROR, TAG, PCF("ConnectToWiFiNetwork Failed"));
OC_LOG(ERROR, TAG, "ConnectToWiFiNetwork Failed");
return ES_ERROR;
}
else{
OC_LOG(INFO, TAG, PCF("ConnectToWiFiNetwork Success"));
OC_LOG(INFO, TAG, "ConnectToWiFiNetwork Success");
return ES_OK;
}
}
......@@ -118,19 +120,19 @@ ESResult InitEasySetup(NetworkType networkType, const char *ssid, const char *pa
{
if(FindNetworkForOnboarding(networkType, ssid, passwd, cb) != ES_OK)
{
OC_LOG(ERROR, TAG, PCF("OnBoarding Failed"));
OC_LOG(ERROR, TAG, "OnBoarding Failed");
return ES_ERROR;
}
// Initialize the OC Stack in Server mode
if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
{
OC_LOG(ERROR, TAG, PCF("OCStack init error"));
OC_LOG(ERROR, TAG, "OCStack init error");
return ES_ERROR;
}
else
{
OC_LOG(DEBUG, TAG, PCF("OCStack init success"));
OC_LOG(DEBUG, TAG, "OCStack init success");
return ES_OK;
}
}
......@@ -139,12 +141,12 @@ ESResult TerminateEasySetup()
{
if(OCStop() != OC_STACK_OK)
{
OC_LOG(ERROR, TAG, PCF("OCStack stop failed"));
OC_LOG(ERROR, TAG, "OCStack stop failed");
return ES_ERROR;
}
else
{
OC_LOG(ERROR, TAG, PCF("OCStack stop success"));
OC_LOG(ERROR, TAG, "OCStack stop success");
return ES_OK;
}
}
......
......@@ -21,7 +21,7 @@
#include "resourceHandler.h"
#include "ocpayload.h"
#define TAG PCF("ES_RH")
#define TAG "ES_RH"
ProvResource g_prov;
NetResource g_net;
......@@ -67,7 +67,7 @@ OCStackResult CreateProvisioningResource()
OCStackResult res = OCCreateResource(&g_prov.handle, "oic.prov", OC_RSRVD_INTERFACE_DEFAULT,
OC_RSRVD_ES_URI_PROV, OCEntityHandlerCb,NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
OC_LOG_V(INFO, TAG, PCF("Created Prov resource with result: %s"), getResult(res));
OC_LOG_V(INFO, TAG, "Created Prov resource with result: %s", getResult(res));
return res;
}
......@@ -92,8 +92,8 @@ OCStackResult CreateNetworkResource()
netInfo.ipaddr[3]);
sprintf(g_net.cnn, "%s", netInfo.ssid);
OC_LOG_V(INFO, TAG, PCF("SSID: %s"), g_net.cnn);
OC_LOG_V(INFO, TAG, PCF("IP Address: %s"), g_net.ipaddr);
OC_LOG_V(INFO, TAG, "SSID: %s", g_net.cnn);
OC_LOG_V(INFO, TAG, "IP Address: %s", g_net.ipaddr);
OCStackResult res = OCCreateResource(&g_net.handle, "oic.net", OC_RSRVD_INTERFACE_DEFAULT,
OC_RSRVD_ES_URI_NET, OCEntityHandlerCb,NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
......@@ -108,19 +108,19 @@ OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest,
OCEntityHandlerResult ehResult = OC_EH_ERROR;
if(!ehRequest)
{
OC_LOG(ERROR, TAG, PCF("Request is Null"));
OC_LOG(ERROR, TAG, "Request is Null");
return ehResult;
}
if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
{
OC_LOG(ERROR, TAG, PCF("Incoming payload not a representation"));
OC_LOG(ERROR, TAG, "Incoming payload not a representation");
return ehResult;
}
OCRepPayload *getResp = constructResponse(ehRequest);
if(!getResp)
{
OC_LOG(ERROR, TAG, PCF("constructResponse failed"));
OC_LOG(ERROR, TAG, "constructResponse failed");
return OC_EH_ERROR;
}
......@@ -137,14 +137,14 @@ OCEntityHandlerResult ProcessPutRequest (OCEntityHandlerRequest *ehRequest,
OCEntityHandlerResult ehResult=OC_EH_ERROR;
if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
{
OC_LOG(ERROR, TAG, PCF("Incoming payload not a representation"));
OC_LOG(ERROR, TAG, "Incoming payload not a representation");
return ehResult;
}
OCRepPayload* input = (OCRepPayload*)(ehRequest->payload);
if(!input)
{
OC_LOG_V(ERROR, TAG, PCF("Failed to parse"));
OC_LOG(ERROR, TAG, "Failed to parse");
return ehResult;
}
......@@ -165,7 +165,7 @@ OCEntityHandlerResult ProcessPutRequest (OCEntityHandlerRequest *ehRequest,
OCRepPayload *getResp = constructResponse(ehRequest);
if(!getResp)
{
OC_LOG(ERROR, TAG, PCF("constructResponse failed"));
OC_LOG(ERROR, TAG, "constructResponse failed");
return OC_EH_ERROR;
}
......@@ -184,19 +184,19 @@ OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest,
OCEntityHandlerResult ehResult = OC_EH_ERROR;
if(!ehRequest)
{
OC_LOG(ERROR, TAG, PCF("Request is Null"));
OC_LOG(ERROR, TAG, "Request is Null");
return ehResult;
}
if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
{
OC_LOG(ERROR, TAG, PCF("Incoming payload not a representation"));
OC_LOG(ERROR, TAG, "Incoming payload not a representation");
return ehResult;
}
OCRepPayload* input = (OCRepPayload*)(ehRequest->payload);
if(!input)
{
OC_LOG_V(ERROR, TAG, PCF("Failed to parse") );
OC_LOG(ERROR, TAG, "Failed to parse");
return ehResult;
}
char* tr;
......@@ -217,7 +217,7 @@ OCRepPayload* constructResponse(OCEntityHandlerRequest *ehRequest)
OCRepPayload* payload = OCRepPayloadCreate();
if(!payload)
{
OC_LOG(ERROR, TAG, PCF("Failed to allocate Payload"));
OC_LOG(ERROR, TAG, "Failed to allocate Payload");
return NULL;
}
......@@ -252,12 +252,12 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag,
{
if (OC_REST_GET == entityHandlerRequest->method)
{
OC_LOG_V(INFO, TAG, PCF("Received GET request"));
OC_LOG(INFO, TAG, "Received GET request");
ehRet = ProcessGetRequest(entityHandlerRequest, &payload);
}
else if (OC_REST_PUT == entityHandlerRequest->method)
{
OC_LOG_V(INFO, TAG, PCF("Received PUT request"));
OC_LOG(INFO, TAG, "Received PUT request");
if (g_prov.handle != NULL && entityHandlerRequest->resource == g_prov.handle)
{
......@@ -293,7 +293,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag,
// Send the response
if (OCDoResponse(&response) != OC_STACK_OK)
{
OC_LOG(ERROR, TAG, PCF("Error sending response"));
OC_LOG(ERROR, TAG, "Error sending response");
ehRet = OC_EH_ERROR;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment