Commit 4b91703e authored by Jihun Ha's avatar Jihun Ha Committed by Uze Choi

Remove redundant files in Enrollee folder

1. Reuse common files for all platforms like Linux, Android, Tizen
    - easysetup.c, resourcehandler.c
2. Remove deprecated files related to onboarding
    - onboarding.h/cpp, softap.h/cpp, networkhandler.h/cpp,
      softapnative.h/c

Please note that network handling codes might be re-used for
platform-specific sample application.

Change-Id: I92961e7218f09e9d0778a47d57973b3a6941a004
Signed-off-by: default avatarJihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8525Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
parent 3bbe07cb
......@@ -113,11 +113,12 @@ es_enrollee_src = None
if target_os == 'linux':
es_enrollee_common_src = [enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/softapnative.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/networkhandler.c']
#enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c'
#enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
#enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/softapnative.c',
#enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/networkhandler.c'
]
enrollee_env.AppendUnique(es_enrollee_src = es_enrollee_common_src)
......@@ -126,11 +127,12 @@ if target_os == 'linux':
if target_os == 'tizen':
es_enrollee_common_src = [enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/softapnative.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/networkhandler.c']
#enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c'
#enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
#enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/softapnative.c',
#enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/networkhandler.c'
]
enrollee_env.AppendUnique(es_enrollee_src = es_enrollee_common_src)
enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK', enrollee_env.get('es_enrollee_src'))
......@@ -145,10 +147,11 @@ if target_os == 'arduino':
# enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/resourcehandler.cpp',
# enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp'])
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp'])
#enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.c',
#enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c'
#enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp'
])
enrollee_env.InstallTarget(es_sdk_static, 'libESEnrolleeSDK')
......
//******************************************************************
//
// Copyright 2015 Samsung Electronics All Rights Reserved.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
/**
* @file
*
* This file contains the implementation for EasySetup Enrollee device
*/
#include "easysetup.h"
#include "softap.h"
#include "onboarding.h"
#include "logger.h"
#include "resourcehandler.h"
/**
* @var ES_ENROLLEE_TAG
* @brief Logging tag for module name.
*/
#define ES_ENROLLEE_TAG "ES"
//-----------------------------------------------------------------------------
// Private variables
//-----------------------------------------------------------------------------
/**
* @var gTargetSsid
* @brief Target SSID of the Soft Access point to which the device has to connect
*/
static char gTargetSsid[MAXSSIDLEN];
/**
* @var gTargetPass
* @brief Password of the target access point to which the device has to connect
*/
static char gTargetPass[MAXNETCREDLEN];
/**
* @var gEnrolleeStatusCb
* @brief Fucntion pointer holding the callback for intimation of EasySetup Enrollee status callback
*/
static ESEnrolleeEventCallback gEnrolleeStatusCb = NULL;
/**
* @var gIsSecured
* @brief Variable to check if secure mode is enabled or not.
*/
static bool gIsSecured = false;
//-----------------------------------------------------------------------------
// Private internal function prototypes
//-----------------------------------------------------------------------------
void ESOnboardingCallback(ESResult esResult);
void ESProvisioningCallback(ESResult esResult);
void ESOnboardingCallbackTargetNet(ESResult esResult);
static bool ESEnrolleeValidateParam(OCConnectivityType networkType, const char *ssid,
const char *passwd, ESEnrolleeEventCallback cb);
void ESOnboardingCallback(ESResult esResult)
{
OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESOnboardingCallback with result = %d", esResult);
if(esResult == ES_OK)
{
gEnrolleeStatusCb(esResult, ES_ON_BOARDED_STATE);
}
else
{
OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG,
"Onboarding is failed callback result is = %d", esResult);
gEnrolleeStatusCb(esResult, ES_INIT_STATE);
}
}
void ESProvisioningCallback(ESResult esResult)
{
OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESProvisioningCallback with result = %d", esResult);
if (esResult == ES_RECVTRIGGEROFPROVRES)
{
GetTargetNetworkInfoFromProvResource(gTargetSsid, gTargetPass);
gEnrolleeStatusCb(ES_OK, ES_PROVISIONED_STATE);
OIC_LOG(DEBUG, ES_ENROLLEE_TAG, "Connecting with target network");
// Connecting/onboarding to target network
ConnectToWiFiNetwork(gTargetSsid, gTargetPass, ESOnboardingCallbackTargetNet);
}
else
{
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 ESOnboardingCallbackTargetNet(ESResult esResult)
{
OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESOnboardingCallback on target network with result = %d",
esResult);
if(esResult == ES_OK)
{
gEnrolleeStatusCb(esResult, ES_ON_BOARDED_TARGET_NETWORK_STATE);
}
else
{
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.
gEnrolleeStatusCb(esResult, ES_PROVISIONED_STATE);
}
}
ESResult ESInitEnrollee(OCConnectivityType networkType, const char *ssid, const char *passwd,
bool isSecured,
ESEnrolleeEventCallback cb)
{
OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitEnrollee IN");
if(!ESEnrolleeValidateParam(networkType,ssid,passwd,cb))
{
OIC_LOG(ERROR, ES_ENROLLEE_TAG,
"ESInitEnrollee::Stopping Easy setup due to invalid parameters");
return ES_ERROR;
}
//Init callback
gEnrolleeStatusCb = cb;
gIsSecured = isSecured;
// TODO : This onboarding state has to be set by lower layer, as they better
// knows when actually on-boarding started.
cb(ES_ERROR,ES_ON_BOARDING_STATE);
OIC_LOG(INFO, ES_ENROLLEE_TAG, "received callback");
OIC_LOG(INFO, ES_ENROLLEE_TAG, "onboarding now..");
if(!ESOnboard(ssid, passwd, ESOnboardingCallback))
{
OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESInitEnrollee::On-boarding failed");
cb(ES_ERROR, ES_INIT_STATE);
return ES_ERROR;
}
OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitEnrollee OUT");
return ES_OK;
}
ESResult ESTerminateEnrollee()
{
UnRegisterResourceEventCallBack();
//Delete Prov resource
if (DeleteProvisioningResource() != OC_STACK_OK)
{
OIC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!");
return ES_ERROR;
}
OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESTerminateEnrollee success");
return ES_OK;
}
ESResult ESInitProvisioning()
{
OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitProvisioning <<IN>>");
if (CreateProvisioningResource(gIsSecured) != OC_STACK_OK)
{
OIC_LOG(ERROR, ES_ENROLLEE_TAG, "CreateProvisioningResource error");
return ES_ERROR;
}
RegisterResourceEventCallBack(ESProvisioningCallback);
OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitProvisioning <<OUT>>");
return ES_RESOURCECREATED;
}
static bool ESEnrolleeValidateParam(OCConnectivityType /*networkType*/, const char *ssid,
const char *passwd, ESEnrolleeEventCallback cb)
{
if (!ssid || !passwd || !cb)
{
OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESEnrolleeValidateParam - Invalid parameters");
return false;
}
return true;
}
//******************************************************************
//
// Copyright 2015 Samsung Electronics All Rights Reserved.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
/**
* @file
*
* This file has methods for on-boarding the Enrollee device.
* This will contain template methods that will have core business logic & negotiation algorithm
* on various on-boarding methods.
*/
#include "easysetup.h"
#include "softap.h"
#include "onboarding.h"
#include "logger.h"
#include "resourcehandler.h"
/**
* @var ES_ENROLLEE_TAG
* @brief Logging tag for module name.
*/
#define ES_ENROLLEE_TAG "ES_SOFTAP"
/**
* It will return true on-boarding type is soft AP
*/
bool ESSoftapOnboarding()
{
// TODO: To be changed based on user config. Current version, hardcoded to SoftAp onboarding
return true;
}
/**
* It will return true on-boarding type is BLE
*/
bool ESBleOnboarding()
{
//BLE onboarding is not supported with current version.
return false;
}
/**
* It will do onboarding based on the user's configuration.
*/
bool ESOnboard(const char * ssid, const char* passwd, ESEnrolleeNetworkEventCallback cb)
{
OIC_LOG(DEBUG, ES_ENROLLEE_TAG, "ESOnboard IN");
if (ESSoftapOnboarding())
{
OIC_LOG(DEBUG, ES_ENROLLEE_TAG, "Connecting to Mediator SoftAp");
ConnectToWiFiNetwork(ssid, passwd, cb);
return true;
}
else if (ESBleOnboarding())
{
OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESOnboard::Ble onboarding is not supported");
// TODO:
return false;
}
else
{
// TODO:
OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESOnboard::Invalid onboarding option");
return false;
}
}
//******************************************************************
//
// Copyright 2015 Samsung Electronics All Rights Reserved.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include "resourcehandler.h"
#include <stdio.h>
#include "ocpayload.h"
#include "oic_string.h"
/**
* @var ES_RH_TAG
* @brief Logging tag for module name.
*/
#define ES_RH_TAG "ES_RH"
//-----------------------------------------------------------------------------
// Private variables
//-----------------------------------------------------------------------------
/**
* @var gProvResource
* @brief Structure for holding the Provisioning status and target information required to
* connect to the target network
*/
static ProvResource gProvResource;
/**
* @var gNetResource
* @brief Structure forr holding the Provisioning status of network information
*/
static NetResource gNetResource;
//-----------------------------------------------------------------------------
// Private internal function prototypes
//-----------------------------------------------------------------------------
OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, OCEntityHandlerRequest *ehRequest,
void *callback);
const char *getResult(OCStackResult result);
OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload);
OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload);
OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload);
OCRepPayload* constructResponse(OCEntityHandlerRequest *ehRequest);
ESEnrolleeResourceEventCallback gNetworkInfoProvEventCb = NULL;
void RegisterResourceEventCallBack(ESEnrolleeResourceEventCallback cb)
{
gNetworkInfoProvEventCb = cb;
}
void UnRegisterResourceEventCallBack()
{
if (gNetworkInfoProvEventCb)
{
gNetworkInfoProvEventCb = NULL;
}
}
void GetTargetNetworkInfoFromProvResource(char *name, char *pass)
{
if (name != NULL && pass != NULL)
{
OICStrcpy(name, MAXSSIDLEN, gProvResource.tnn);
OICStrcpy(pass, MAXNETCREDLEN, gProvResource.cd);
}
}
OCStackResult CreateProvisioningResource(bool isSecured)
{
gProvResource.ps = ES_PS_NEED_PROVISIONING;
gProvResource.tr = ES_PS_TRIGGER_INIT_VALUE;
gProvResource.tnt = CT_ADAPTER_IP;
OICStrcpy(gProvResource.tnn, sizeof(gProvResource.tnn), "Unknown");
OICStrcpy(gProvResource.cd, sizeof(gProvResource.cd), "Unknown");
OCStackResult res = OC_STACK_ERROR;
if (isSecured)
{
res = OCCreateResource(&gProvResource.handle, OC_RSRVD_ES_PROV_RES_TYPE,
OC_RSRVD_INTERFACE_DEFAULT,
OC_RSRVD_ES_URI_PROV, OCEntityHandlerCb,
NULL, OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE);
}
else
{
res = OCCreateResource(&gProvResource.handle, OC_RSRVD_ES_PROV_RES_TYPE,
OC_RSRVD_INTERFACE_DEFAULT,
OC_RSRVD_ES_URI_PROV, OCEntityHandlerCb,
NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
}
OIC_LOG_V(INFO, ES_RH_TAG, "Created Prov resource with result: %s", getResult(res));
return res;
}
OCStackResult DeleteProvisioningResource()
{
OCStackResult res = OCDeleteResource(gProvResource.handle);
if (res != OC_STACK_OK)
{
OIC_LOG_V(INFO, ES_RH_TAG, "Deleting Prov resource error with result: %s", getResult(res));
}
return res;
}
OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload **payload)
{
OCEntityHandlerResult ehResult = OC_EH_ERROR;
if (!ehRequest)
{
OIC_LOG(ERROR, ES_RH_TAG, "Request is Null");
return ehResult;
}
if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
{
OIC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation");
return ehResult;
}
OCRepPayload *getResp = constructResponse(ehRequest);
if (!getResp)
{
OIC_LOG(ERROR, ES_RH_TAG, "constructResponse failed");
return OC_EH_ERROR;
}
*payload = getResp;
ehResult = OC_EH_OK;
return ehResult;
}
OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload)
{
OIC_LOG(INFO, ES_RH_TAG, "ProcessPostRequest enter");
OCEntityHandlerResult ehResult = OC_EH_ERROR;
if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
{
OIC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation");
return ehResult;
}
OCRepPayload* input = (OCRepPayload*) (ehRequest->payload);
if (!input)
{
OIC_LOG(ERROR, ES_RH_TAG, "Failed to parse");
return ehResult;
}
char* tnn;
if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_TNN, &tnn))
{
OICStrcpy(gProvResource.tnn, sizeof(gProvResource.tnn), tnn);
OIC_LOG_V(INFO, ES_RH_TAG, "gProvResource.tnn %s", gProvResource.tnn);
gProvResource.ps = ES_PS_PROVISIONING_COMPLETED;
}
char* cd;
if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_CD, &cd))
{
OICStrcpy(gProvResource.cd, sizeof(gProvResource.cd), cd);
OIC_LOG_V(INFO, ES_RH_TAG, "gProvResource.cd %s", gProvResource.cd);
}
OIC_LOG_V(INFO, ES_RH_TAG, "gProvResource.ps %lld", gProvResource.ps);
int64_t tr;
if (OCRepPayloadGetPropInt(input, OC_RSRVD_ES_TR, &tr))
{
// Triggering
gProvResource.tr = tr;
}
//ES_PS_PROVISIONING_COMPLETED state indicates that already provisioning is completed.
// A new request for provisioning means overriding existing network provisioning information.
if (gProvResource.ps == ES_PS_PROVISIONING_COMPLETED && tr == ES_PS_TRIGGER_CONNECTION)
{
OIC_LOG(DEBUG, ES_RH_TAG, "Provisioning already completed."
"Tiggering the network connection");
if (gNetworkInfoProvEventCb)
{
gNetworkInfoProvEventCb(ES_RECVTRIGGEROFPROVRES);
ehResult = OC_EH_OK;
}
else
{
gProvResource.tr = ES_PS_TRIGGER_INIT_VALUE;
OIC_LOG(ERROR, ES_RH_TAG, "gNetworkInfoProvEventCb is NULL."
"Network handler not registered. Failed to connect to the network");
ehResult = OC_EH_ERROR;
}
return ehResult;
}
else if (gProvResource.ps == ES_PS_PROVISIONING_COMPLETED)
{
OIC_LOG(DEBUG, ES_RH_TAG, "Provisioning already completed. "
"This a request to override the existing the network provisioning information");
}
else
{
OIC_LOG(DEBUG, ES_RH_TAG, "Provisioning the network information to the Enrollee.");
}
OCRepPayload *getResp = constructResponse(ehRequest);
if (!getResp)
{
OIC_LOG(ERROR, ES_RH_TAG, "constructResponse failed");
return OC_EH_ERROR;
}
*payload = getResp;
ehResult = OC_EH_OK;
return ehResult;
}
OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest * /*ehRequest*/,
OCRepPayload** /*payload*/)
{
OCEntityHandlerResult ehResult = OC_EH_ERROR;
return ehResult;
}
OCRepPayload* constructResponse(OCEntityHandlerRequest *ehRequest)
{
OCRepPayload* payload = OCRepPayloadCreate();
if (!payload)
{
OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
return NULL;
}
if (ehRequest->resource == gProvResource.handle)
{
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);
}
else if (ehRequest->requestHandle == gNetResource.handle)
{
OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_NET);
OCRepPayloadSetPropInt(payload, "ant", gNetResource.ant[0]);
}
return payload;
}
/**
* This is the entity handler for the registered resource.
* This is invoked by OCStack whenever it recevies a request for this resource.