From: Sandipan Patra Date: Mon, 4 Apr 2016 12:19:10 +0000 (+0530) Subject: [Enrollee] API name modification as per IoTivity coding standard X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45fff8884a8249cbb818bb736af705aa14df095c;p=contrib%2Fiotivity.git [Enrollee] API name modification as per IoTivity coding standard Change-Id: I6c4f7ed6f07eb67ed989a81e5edf59ece29426b7 Signed-off-by: Sandipan Patra Reviewed-on: https://gerrit.iotivity.org/gerrit/7579 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- diff --git a/service/easy-setup/enrollee/arduino/easysetup.cpp b/service/easy-setup/enrollee/arduino/easysetup.cpp index f06b683..b3f0aff 100644 --- a/service/easy-setup/enrollee/arduino/easysetup.cpp +++ b/service/easy-setup/enrollee/arduino/easysetup.cpp @@ -56,7 +56,7 @@ static char gTargetPass[MAXNETCREDLEN]; * @var gEnrolleeStatusCb * @brief Fucntion pointer holding the callback for intimation of EasySetup Enrollee status callback */ -static EventCallback gEnrolleeStatusCb = NULL; +static ESEnrolleeEventCallback gEnrolleeStatusCb = NULL; /** * @var gIsSecured @@ -67,16 +67,16 @@ static bool gIsSecured = false; //----------------------------------------------------------------------------- // Private internal function prototypes //----------------------------------------------------------------------------- -void OnboardingCallback(ESResult esResult); -void ProvisioningCallback(ESResult esResult); -void OnboardingCallbackTargetNet(ESResult esResult); -static bool ValidateParam(OCConnectivityType networkType, const char *ssid, const char *passwd, - EventCallback cb); +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 OnboardingCallback(ESResult esResult) +void ESOnboardingCallback(ESResult esResult) { - OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "OnboardingCallback with result = %d", esResult); + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESOnboardingCallback with result = %d", esResult); if(esResult == ES_OK) { gEnrolleeStatusCb(esResult, ES_ON_BOARDED_STATE); @@ -89,9 +89,9 @@ void OnboardingCallback(ESResult esResult) } } -void ProvisioningCallback(ESResult esResult) +void ESProvisioningCallback(ESResult esResult) { - OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ProvisioningCallback with result = %d", esResult); + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESProvisioningCallback with result = %d", esResult); if (esResult == ES_RECVTRIGGEROFPROVRES) { @@ -100,7 +100,7 @@ void ProvisioningCallback(ESResult esResult) OIC_LOG(DEBUG, ES_ENROLLEE_TAG, "Connecting with target network"); // Connecting/onboarding to target network - ConnectToWiFiNetwork(gTargetSsid, gTargetPass, OnboardingCallbackTargetNet); + ConnectToWiFiNetwork(gTargetSsid, gTargetPass, ESOnboardingCallbackTargetNet); } else { @@ -110,9 +110,9 @@ void ProvisioningCallback(ESResult esResult) } } -void OnboardingCallbackTargetNet(ESResult esResult) +void ESOnboardingCallbackTargetNet(ESResult esResult) { - OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "OnboardingCallback on target network with result = %d", + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESOnboardingCallback on target network with result = %d", esResult); if(esResult == ES_OK) { @@ -128,15 +128,15 @@ void OnboardingCallbackTargetNet(ESResult esResult) } } -ESResult InitEasySetup(OCConnectivityType networkType, const char *ssid, const char *passwd, +ESResult ESInitEnrollee(OCConnectivityType networkType, const char *ssid, const char *passwd, bool isSecured, - EventCallback cb) + ESEnrolleeEventCallback cb) { - OIC_LOG(INFO, ES_ENROLLEE_TAG, "InitEasySetup IN"); - if(!ValidateParam(networkType,ssid,passwd,cb)) + OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitEnrollee IN"); + if(!ESEnrolleeValidateParam(networkType,ssid,passwd,cb)) { OIC_LOG(ERROR, ES_ENROLLEE_TAG, - "InitEasySetup::Stopping Easy setup due to invalid parameters"); + "ESInitEnrollee::Stopping Easy setup due to invalid parameters"); return ES_ERROR; } @@ -152,18 +152,18 @@ ESResult InitEasySetup(OCConnectivityType networkType, const char *ssid, const c OIC_LOG(INFO, ES_ENROLLEE_TAG, "received callback"); OIC_LOG(INFO, ES_ENROLLEE_TAG, "onboarding now.."); - if(!ESOnboard(ssid, passwd, OnboardingCallback)) + if(!ESOnboard(ssid, passwd, ESOnboardingCallback)) { - OIC_LOG(ERROR, ES_ENROLLEE_TAG, "InitEasySetup::On-boarding failed"); + 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, "InitEasySetup OUT"); + OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitEnrollee OUT"); return ES_OK; } -ESResult TerminateEasySetup() +ESResult ESTerminateEnrollee() { UnRegisterResourceEventCallBack(); @@ -174,13 +174,13 @@ ESResult TerminateEasySetup() return ES_ERROR; } - OIC_LOG(ERROR, ES_ENROLLEE_TAG, "TerminateEasySetup success"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESTerminateEnrollee success"); return ES_OK; } -ESResult InitProvisioning() +ESResult ESInitProvisioning() { - OIC_LOG(INFO, ES_ENROLLEE_TAG, "InitProvisioning <>"); + OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitProvisioning <>"); if (CreateProvisioningResource(gIsSecured) != OC_STACK_OK) { @@ -188,18 +188,18 @@ ESResult InitProvisioning() return ES_ERROR; } - RegisterResourceEventCallBack(ProvisioningCallback); + RegisterResourceEventCallBack(ESProvisioningCallback); - OIC_LOG(INFO, ES_ENROLLEE_TAG, "InitProvisioning OUT"); + OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitProvisioning <>"); return ES_RESOURCECREATED; } -static bool ValidateParam(OCConnectivityType /*networkType*/, const char *ssid, const char *passwd, - EventCallback cb) +static bool ESEnrolleeValidateParam(OCConnectivityType /*networkType*/, const char *ssid, + const char *passwd, ESEnrolleeEventCallback cb) { if (!ssid || !passwd || !cb) { - OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ValidateParam - Invalid parameters"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESEnrolleeValidateParam - Invalid parameters"); return false; } return true; diff --git a/service/easy-setup/enrollee/arduino/onboarding.cpp b/service/easy-setup/enrollee/arduino/onboarding.cpp index c54c360..aaf1509 100644 --- a/service/easy-setup/enrollee/arduino/onboarding.cpp +++ b/service/easy-setup/enrollee/arduino/onboarding.cpp @@ -60,7 +60,7 @@ bool ESBleOnboarding() /** * It will do onboarding based on the user's configuration. */ -bool ESOnboard(const char * ssid, const char* passwd, NetworkEventCallback cb) +bool ESOnboard(const char * ssid, const char* passwd, ESEnrolleeNetworkEventCallback cb) { OIC_LOG(DEBUG, ES_ENROLLEE_TAG, "ESOnboard IN"); diff --git a/service/easy-setup/enrollee/arduino/resourcehandler.cpp b/service/easy-setup/enrollee/arduino/resourcehandler.cpp index 2181ec0..6168606 100644 --- a/service/easy-setup/enrollee/arduino/resourcehandler.cpp +++ b/service/easy-setup/enrollee/arduino/resourcehandler.cpp @@ -58,9 +58,9 @@ OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest, OCRep OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload); OCRepPayload* constructResponse(OCEntityHandlerRequest *ehRequest); -ResourceEventCallback gNetworkInfoProvEventCb = NULL; +ESEnrolleeResourceEventCallback gNetworkInfoProvEventCb = NULL; -void RegisterResourceEventCallBack(ResourceEventCallback cb) +void RegisterResourceEventCallBack(ESEnrolleeResourceEventCallback cb) { gNetworkInfoProvEventCb = cb; } diff --git a/service/easy-setup/enrollee/arduino/softap.cpp b/service/easy-setup/enrollee/arduino/softap.cpp index 8784350..4199e9a 100644 --- a/service/easy-setup/enrollee/arduino/softap.cpp +++ b/service/easy-setup/enrollee/arduino/softap.cpp @@ -20,7 +20,7 @@ void ESCreateSoftapCallback(int result, const char *ip, const char* mac_addr, const char* device_name ); -NetworkEventCallback gCallback; +ESEnrolleeNetworkEventCallback gCallback; /** * It will return Device which is creating Soft AP. @@ -76,7 +76,7 @@ void ESCreateSoftapCallback(int result, const char *ip, const char* mac_addr, /** * This API will create the softap at enrollee */ -void ESCreateSoftap(const char * ssid, const char* passwd, NetworkEventCallback cb) +void ESCreateSoftap(const char * ssid, const char* passwd, ESEnrolleeNetworkEventCallback cb) { gCallback = cb; diff --git a/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp b/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp index 7cf1ca0..fae1fd5 100644 --- a/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp +++ b/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp @@ -50,7 +50,8 @@ static IPAddress enrolleeIP; /** * @var g_retryCounter - * @brief Retry counter for cancelling network retry. Currently network retry is limited to 5 attempts + * @brief Retry counter for cancelling network retry. Currently network retry is + * limited to 5 attempts */ static uint16_t g_retryCounter = 0; @@ -68,7 +69,8 @@ void printEncryptionType(int thisType); // this server will NOT be listening on 224.0.1.187 multicast address. static const char ARDUINO_WIFI_SHIELD_UDP_FW_VER[] = "1.1.0"; -ESResult ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCallback cb) +ESResult ConnectToWiFiNetwork(const char *ssid, const char *pass, + ESEnrolleeNetworkEventCallback cb) { char *fwVersion; int status = WL_IDLE_STATUS; diff --git a/service/easy-setup/enrollee/arduino/wifi/networkhandler.h b/service/easy-setup/enrollee/arduino/wifi/networkhandler.h index df67b8f..f1503e1 100644 --- a/service/easy-setup/enrollee/arduino/wifi/networkhandler.h +++ b/service/easy-setup/enrollee/arduino/wifi/networkhandler.h @@ -49,7 +49,7 @@ * * @param esResult ESResult provides the current state of the network connection status */ -typedef void (*NetworkEventCallback)(ESResult esResult); +typedef void (*ESEnrolleeNetworkEventCallback)(ESResult esResult); typedef struct { @@ -61,7 +61,8 @@ typedef struct byte mac[6]; } NetworkInfo; -ESResult ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCallback); +ESResult ConnectToWiFiNetwork(const char *ssid, const char *pass, + ESEnrolleeNetworkEventCallback); ESResult getCurrentNetworkInfo(OCConnectivityType targetType, NetworkInfo *info); #endif diff --git a/service/easy-setup/enrollee/inc/easysetup.h b/service/easy-setup/enrollee/inc/easysetup.h index d3d20db..00102a9 100755 --- a/service/easy-setup/enrollee/inc/easysetup.h +++ b/service/easy-setup/enrollee/inc/easysetup.h @@ -35,33 +35,34 @@ extern "C" { #endif // __cplusplus /* - * Callback function for updating the Enrollee OnBoarding and Provisioning status result to the application + * Callback function for updating the Enrollee OnBoarding and Provisioning status result + * to the application * * @param esResult ESResult provides the current state of the Enrollee Device */ -typedef void (*EventCallback)(ESResult esResult, EnrolleeState enrolleeState); +typedef void (*ESEnrolleeEventCallback)(ESResult esResult, ESEnrolleeState enrolleeState); /** * This function Initializes the EasySetup. This API must be called prior to invoking any other API * * @param networkType NetworkType on which OnBoarding has to be performed. * @param ssid SSID of the target SoftAP network to which the Enrollee is connecting. - * @param passwd Password of the target SoftAP network to which the Enrollee is connecting + * @param passwd Password of the target SoftAP network to which the Enrollee is + * connecting * @param isSecured True if the Enrollee is operating in secured mode. - * @param eventCallback EventCallback for for updating the Enrollee OnBoarding status result to - * the application + * @param eventCallback ESEnrolleeEventCallback for for updating the Enrollee OnBoarding status + * result to the application * @return ::ES_OK on success, some other value upon failure. */ -ESResult InitEasySetup(OCConnectivityType networkType, const char *ssid, const char *passwd, - bool isSecured, - EventCallback eventCallback); +ESResult ESInitEnrollee(OCConnectivityType networkType, const char *ssid, const char *passwd, + bool isSecured, ESEnrolleeEventCallback eventCallback); /** * This function performs initialization of Provisioning and Network resources needed for EasySetup * process. * @return ::ES_OK on success, some other value upon failure. */ -ESResult InitProvisioning(); +ESResult ESInitProvisioning(); /** * This function performs termination of Provisioning and Network resources. @@ -69,7 +70,7 @@ ESResult InitProvisioning(); * * @return ::ES_OK on success, some other value upon failure. */ -ESResult TerminateEasySetup(); +ESResult ESTerminateEnrollee(); #ifdef __cplusplus } diff --git a/service/easy-setup/enrollee/linux/wifi/networkhandler.c b/service/easy-setup/enrollee/linux/wifi/networkhandler.c index 7c5a2bb..24b7dea 100644 --- a/service/easy-setup/enrollee/linux/wifi/networkhandler.c +++ b/service/easy-setup/enrollee/linux/wifi/networkhandler.c @@ -31,7 +31,7 @@ const char *gSsid = "DLNA_LISMORE1"; const char *gPass = "dlna@010203"; char *gIpAddress; -NetworkEventCallback gNetworkEventCb; +ESEnrolleeNetworkEventCallback gNetworkEventCb; /* * All the functions defined in this file are stub functions to be implemented by the end user of @@ -48,7 +48,8 @@ static void start() ESActivateWifi(); } -void ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCallback cb) +void ConnectToWiFiNetwork(const char *ssid, const char *pass, + ESEnrolleeNetworkEventCallback cb) { OIC_LOG_V(INFO, LOG_TAG, "ConnectToWiFiNetwork %s %s",ssid,pass); gPass = pass; diff --git a/service/easy-setup/enrollee/linux/wifi/networkhandler.h b/service/easy-setup/enrollee/linux/wifi/networkhandler.h index 43c68cd..b70be01 100644 --- a/service/easy-setup/enrollee/linux/wifi/networkhandler.h +++ b/service/easy-setup/enrollee/linux/wifi/networkhandler.h @@ -43,7 +43,7 @@ * * @param esResult ESResult provides the current state of the network connection status */ -typedef void (*NetworkEventCallback)(ESResult esResult); +typedef void (*ESEnrolleeNetworkEventCallback)(ESResult esResult); typedef struct { @@ -56,7 +56,8 @@ typedef struct //byte mac[6]; } NetworkInfo; -void ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCallback); +void ConnectToWiFiNetwork(const char *ssid, const char *pass, + ESEnrolleeNetworkEventCallback); ESResult getCurrentNetworkInfo(OCConnectivityType targetType, NetworkInfo *info); #endif diff --git a/service/easy-setup/enrollee/src/easysetup.c b/service/easy-setup/enrollee/src/easysetup.c index dcb35a8..cb6d260 100644 --- a/service/easy-setup/enrollee/src/easysetup.c +++ b/service/easy-setup/enrollee/src/easysetup.c @@ -57,7 +57,7 @@ static char gTargetPass[MAXNETCREDLEN]; * @var gEnrolleeStatusCb * @brief Fucntion pointer holding the callback for intimation of EasySetup Enrollee status callback */ -static EventCallback gEnrolleeStatusCb = NULL; +static ESEnrolleeEventCallback gEnrolleeStatusCb = NULL; /** * @var gIsSecured @@ -65,9 +65,9 @@ static EventCallback gEnrolleeStatusCb = NULL; */ static bool gIsSecured = false; -void OnboardingCallback(ESResult esResult) +void ESOnboardingCallback(ESResult esResult) { - OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "OnboardingCallback with result = %d", esResult); + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESOnboardingCallback with result = %d", esResult); if(esResult == ES_OK) { gEnrolleeStatusCb(esResult, ES_ON_BOARDED_STATE); @@ -80,9 +80,9 @@ void OnboardingCallback(ESResult esResult) } } -void ProvisioningCallback(ESResult esResult) +void ESProvisioningCallback(ESResult esResult) { - OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ProvisioningCallback with result = %d", esResult); + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESProvisioningCallback with result = %d", esResult); if (esResult == ES_RECVTRIGGEROFPROVRES) { @@ -91,7 +91,7 @@ void ProvisioningCallback(ESResult esResult) OIC_LOG(DEBUG, ES_ENROLLEE_TAG, "Connecting with target network"); // Connecting/onboarding to target network - ConnectToWiFiNetwork(gTargetSsid, gTargetPass, OnboardingCallbackTargetNet); + ConnectToWiFiNetwork(gTargetSsid, gTargetPass, ESOnboardingCallbackTargetNet); } else { @@ -101,9 +101,9 @@ void ProvisioningCallback(ESResult esResult) } } -void OnboardingCallbackTargetNet(ESResult esResult) +void ESOnboardingCallbackTargetNet(ESResult esResult) { - OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "OnboardingCallback on target network with result = %d", + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESOnboardingCallback on target network with result = %d", esResult); if(esResult == ES_OK) { @@ -119,15 +119,15 @@ void OnboardingCallbackTargetNet(ESResult esResult) } } -ESResult InitEasySetup(OCConnectivityType networkType, const char *ssid, const char *passwd, +ESResult ESInitEnrollee(OCConnectivityType networkType, const char *ssid, const char *passwd, bool isSecured, - EventCallback cb) + ESEnrolleeEventCallback cb) { - OIC_LOG(INFO, ES_ENROLLEE_TAG, "InitEasySetup IN"); - if(!ValidateParam(networkType,ssid,passwd,cb)) + OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitEnrollee IN"); + if(!ESEnrolleeValidateParam(networkType,ssid,passwd,cb)) { OIC_LOG(ERROR, ES_ENROLLEE_TAG, - "InitEasySetup::Stopping Easy setup due to invalid parameters"); + "ESInitEnrollee::Stopping Easy setup due to invalid parameters"); return ES_ERROR; } @@ -143,18 +143,18 @@ ESResult InitEasySetup(OCConnectivityType networkType, const char *ssid, const c OIC_LOG(INFO, ES_ENROLLEE_TAG, "received callback"); OIC_LOG(INFO, ES_ENROLLEE_TAG, "onboarding now.."); - if(!ESOnboard(ssid, passwd, OnboardingCallback)) + if(!ESOnboard(ssid, passwd, ESOnboardingCallback)) { - OIC_LOG(ERROR, ES_ENROLLEE_TAG, "InitEasySetup::On-boarding failed"); + 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, "InitEasySetup OUT"); + OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitEnrollee OUT"); return ES_OK; } -ESResult TerminateEasySetup() +ESResult ESTerminateEnrollee() { UnRegisterResourceEventCallBack(); @@ -165,13 +165,13 @@ ESResult TerminateEasySetup() return ES_ERROR; } - OIC_LOG(ERROR, ES_ENROLLEE_TAG, "TerminateEasySetup success"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESTerminateEnrollee success"); return ES_OK; } -ESResult InitProvisioning() +ESResult ESInitProvisioning() { - OIC_LOG(INFO, ES_ENROLLEE_TAG, "InitProvisioning <>"); + OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitProvisioning <>"); if (CreateProvisioningResource(gIsSecured) != OC_STACK_OK) { @@ -179,18 +179,18 @@ ESResult InitProvisioning() return ES_ERROR; } - RegisterResourceEventCallBack(ProvisioningCallback); + RegisterResourceEventCallBack(ESProvisioningCallback); - OIC_LOG(INFO, ES_ENROLLEE_TAG, "InitProvisioning OUT"); + OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitProvisioning <>"); return ES_RESOURCECREATED; } -static bool ValidateParam(OCConnectivityType networkType, const char *ssid, const char *passwd, - EventCallback cb) +static bool ESEnrolleeValidateParam(OCConnectivityType networkType, const char *ssid, + const char *passwd, ESEnrolleeEventCallback cb) { if (!ssid || !passwd || !cb) { - OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ValidateParam - Invalid parameters"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ESEnrolleeValidateParam - Invalid parameters"); return false; } return true; diff --git a/service/easy-setup/enrollee/src/easysetupcallbacks.h b/service/easy-setup/enrollee/src/easysetupcallbacks.h index bf552f0..f21c1e1 100644 --- a/service/easy-setup/enrollee/src/easysetupcallbacks.h +++ b/service/easy-setup/enrollee/src/easysetupcallbacks.h @@ -38,26 +38,26 @@ extern "C" { // Private internal callback function prototypes for Easy setup [Enrollee] //----------------------------------------------------------------------------- - /* + /* * Callback for on boarding */ -void OnboardingCallback(ESResult esResult); +void ESOnboardingCallback(ESResult esResult); - /* + /* * Callback for provisioning */ -void ProvisioningCallback(ESResult SSSS); +void ESProvisioningCallback(ESResult SSSS); - /* + /* * Callback for on boarding target Network */ -void OnboardingCallbackTargetNet(ESResult esResult); +void ESOnboardingCallbackTargetNet(ESResult esResult); - /* - * Function for validating the parameter for InitEasySetup API + /* + * Function for validating the parameter for ESInitEnrollee API */ -static bool ValidateParam(OCConnectivityType networkType, const char *ssid, const char *passwd, - EventCallback cb); +static bool ESEnrolleeValidateParam(OCConnectivityType networkType, const char *ssid, + const char *passwd, ESEnrolleeEventCallback cb); #ifdef __cplusplus } diff --git a/service/easy-setup/enrollee/src/onboarding.c b/service/easy-setup/enrollee/src/onboarding.c index 42551d7..da9acaa 100644 --- a/service/easy-setup/enrollee/src/onboarding.c +++ b/service/easy-setup/enrollee/src/onboarding.c @@ -60,7 +60,7 @@ bool ESBleOnboarding() /** * It will do onboarding based on the user's configuration. */ -bool ESOnboard(const char * ssid, const char* passwd, NetworkEventCallback cb) +bool ESOnboard(const char * ssid, const char* passwd, ESEnrolleeNetworkEventCallback cb) { OIC_LOG(DEBUG, ES_ENROLLEE_TAG, "ESOnboard IN"); diff --git a/service/easy-setup/enrollee/src/onboarding.h b/service/easy-setup/enrollee/src/onboarding.h index ce3bc87..dc0ecd6 100644 --- a/service/easy-setup/enrollee/src/onboarding.h +++ b/service/easy-setup/enrollee/src/onboarding.h @@ -32,18 +32,21 @@ extern "C" { * @file * * This file contains APIs to on-board ( connect ) Enrollee device into Ad-hoc network - * @Note : Some of the APIs of this file need to be modified by the OEM according to the device configuration + * @Note : Some of the APIs of this file need to be modified by the OEM according to the + * device configuration */ /** * This function on-board Enrollee device onto ad-hoc network. - * @param ssid SSID of the target SoftAP network to which the Enrollee is connecting. - * @param passwd Password of the target SoftAP network to which the Enrollee is connecting. - * @param NetworkEventCallback Callback function for result update + * @param ssid SSID of the target SoftAP network to which the Enrollee + * is connecting. + * @param passwd Password of the target SoftAP network to which the + * Enrollee is connecting. + * @param ESEnrolleeNetworkEventCallback Callback function for result update * @return ::True, if on-boarding is successful. */ -bool ESOnboard(const char * ssid, const char* passwd, NetworkEventCallback cb); +bool ESOnboard(const char * ssid, const char* passwd, ESEnrolleeNetworkEventCallback cb); /** * This function verify if the on-boarding is through SoftAP. diff --git a/service/easy-setup/enrollee/src/resourcehandler.c b/service/easy-setup/enrollee/src/resourcehandler.c index 0956410..833e31e 100644 --- a/service/easy-setup/enrollee/src/resourcehandler.c +++ b/service/easy-setup/enrollee/src/resourcehandler.c @@ -58,9 +58,9 @@ OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest, OCRep OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload); OCRepPayload* constructResponse(OCEntityHandlerRequest *ehRequest); -ResourceEventCallback gNetworkInfoProvEventCb = NULL; +ESEnrolleeResourceEventCallback gNetworkInfoProvEventCb = NULL; -void RegisterResourceEventCallBack(ResourceEventCallback cb) +void RegisterResourceEventCallBack(ESEnrolleeResourceEventCallback cb) { gNetworkInfoProvEventCb = cb; } diff --git a/service/easy-setup/enrollee/src/resourcehandler.h b/service/easy-setup/enrollee/src/resourcehandler.h index 5afa812..ad470dc 100644 --- a/service/easy-setup/enrollee/src/resourcehandler.h +++ b/service/easy-setup/enrollee/src/resourcehandler.h @@ -34,7 +34,7 @@ extern "C" { #endif -typedef void (*ResourceEventCallback)(ESResult); +typedef void (*ESEnrolleeResourceEventCallback)(ESResult); /* Structure to represent a Light resource */ typedef struct PROVRESOURCE @@ -61,7 +61,7 @@ OCStackResult CreateProvisioningResource(bool isSecured); OCStackResult DeleteProvisioningResource(); void GetTargetNetworkInfoFromProvResource(char *, char *); -void RegisterResourceEventCallBack(ResourceEventCallback); +void RegisterResourceEventCallBack(ESEnrolleeResourceEventCallback); void UnRegisterResourceEventCallBack(void); #ifdef __cplusplus diff --git a/service/easy-setup/enrollee/src/softap.c b/service/easy-setup/enrollee/src/softap.c index 8784350..4199e9a 100644 --- a/service/easy-setup/enrollee/src/softap.c +++ b/service/easy-setup/enrollee/src/softap.c @@ -20,7 +20,7 @@ void ESCreateSoftapCallback(int result, const char *ip, const char* mac_addr, const char* device_name ); -NetworkEventCallback gCallback; +ESEnrolleeNetworkEventCallback gCallback; /** * It will return Device which is creating Soft AP. @@ -76,7 +76,7 @@ void ESCreateSoftapCallback(int result, const char *ip, const char* mac_addr, /** * This API will create the softap at enrollee */ -void ESCreateSoftap(const char * ssid, const char* passwd, NetworkEventCallback cb) +void ESCreateSoftap(const char * ssid, const char* passwd, ESEnrolleeNetworkEventCallback cb) { gCallback = cb; diff --git a/service/easy-setup/enrollee/src/softap.h b/service/easy-setup/enrollee/src/softap.h index f0bc68f..df532de 100644 --- a/service/easy-setup/enrollee/src/softap.h +++ b/service/easy-setup/enrollee/src/softap.h @@ -33,7 +33,8 @@ extern "C" { * @file * * This file contains platform agnostic API for creation of Soft AP - * @Note : Some of the APIs of this file need to be modified by the OEM according to the device configuration + * @Note : Some of the APIs of this file need to be modified by the OEM according to the device + * configuration */ /** @@ -64,12 +65,14 @@ DeviceRole ESSoftapHost(); /** * This function Initializes the EasySetup. This API must be called prior to invoking any other API * - * @param ssid SSID of the target SoftAP network to which the Enrollee is connecting. - * @param passwd Password of the target SoftAP network to which the Enrollee is connecting - * @param NetworkEventCallback Callback function for result update + * @param ssid SSID of the target SoftAP network to which the Enrollee is + * connecting. + * @param passwd Password of the target SoftAP network to which the Enrollee is + * connecting + * @param ESEnrolleeNetworkEventCallback Callback function for result update * @return ::void. */ -void ESCreateSoftap(const char * ssid, const char* passwd, NetworkEventCallback cb); +void ESCreateSoftap(const char * ssid, const char* passwd, ESEnrolleeNetworkEventCallback cb); #ifdef __cplusplus diff --git a/service/easy-setup/enrollee/tizen/wifi/networkhandler.c b/service/easy-setup/enrollee/tizen/wifi/networkhandler.c index 3bafded..ef83e92 100644 --- a/service/easy-setup/enrollee/tizen/wifi/networkhandler.c +++ b/service/easy-setup/enrollee/tizen/wifi/networkhandler.c @@ -33,7 +33,7 @@ const char *gSsid = "DLNA_LISMORE1"; const char *gPass = "dlna@010203"; char *gIpAddress = NULL; wifi_ap_h connectedWifi; -NetworkEventCallback gNetworkEventCb; +ESEnrolleeNetworkEventCallback gNetworkEventCb; static void ESActivateWifi(); static const char* @@ -152,7 +152,8 @@ static void start() ESActivateWifi(); } -void ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCallback cb) +void ConnectToWiFiNetwork(const char *ssid, const char *pass, + ESEnrolleeNetworkEventCallback cb) { OIC_LOG_V(INFO, LOG_TAG, "ConnectToWiFiNetwork %s %s",ssid,pass); gPass = pass; diff --git a/service/easy-setup/enrollee/tizen/wifi/networkhandler.h b/service/easy-setup/enrollee/tizen/wifi/networkhandler.h index 43c68cd..410b665 100644 --- a/service/easy-setup/enrollee/tizen/wifi/networkhandler.h +++ b/service/easy-setup/enrollee/tizen/wifi/networkhandler.h @@ -43,7 +43,7 @@ * * @param esResult ESResult provides the current state of the network connection status */ -typedef void (*NetworkEventCallback)(ESResult esResult); +typedef void (*ESEnrolleeNetworkEventCallback)(ESResult esResult); typedef struct { @@ -56,7 +56,8 @@ typedef struct //byte mac[6]; } NetworkInfo; -void ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCallback); +void ConnectToWiFiNetwork(const char *ssid, const char *pass, + ESEnrolleeNetworkEventCallback); ESResult getCurrentNetworkInfo(OCConnectivityType targetType, NetworkInfo *info); #endif diff --git a/service/easy-setup/enrollee/tizen/wifi/softapnative.h b/service/easy-setup/enrollee/tizen/wifi/softapnative.h index a72410e..10774ed 100644 --- a/service/easy-setup/enrollee/tizen/wifi/softapnative.h +++ b/service/easy-setup/enrollee/tizen/wifi/softapnative.h @@ -44,10 +44,13 @@ typedef void (*SoftAPCallbackNative)(int result, const char *ip, const char* mac * This API creats the Soft AP using the platform specific native system calls. * @Note This API to be implemented by the OEM if Enrollee device SoC supports SoftAP * - * @param networkType NetworkType on which OnBoarding has to be performed. - * @param ssid SSID of the target SoftAP network to which the Enrollee is connecting. - * @param passwd Password of the target SoftAP network to which the Enrollee is connecting - * @param SoftAPCallbackNative EventCallback for for updating the Enrollee OnBoarding status result to the application + * @param networkType NetworkType on which OnBoarding has to be performed. + * @param ssid SSID of the target SoftAP network to which the Enrollee is + * connecting. + * @param passwd Password of the target SoftAP network to which the Enrollee is + * connecting + * @param SoftAPCallbackNative EventCallback for for updating the Enrollee OnBoarding status + * result to the application */ void ESCreateSoftapNative(const char * ssid, const char* passwd, SoftAPCallbackNative cb); diff --git a/service/easy-setup/enrollee/unittests/enrolleetests.cpp b/service/easy-setup/enrollee/unittests/enrolleetests.cpp index 5e9c42e..9732b20 100644 --- a/service/easy-setup/enrollee/unittests/enrolleetests.cpp +++ b/service/easy-setup/enrollee/unittests/enrolleetests.cpp @@ -71,7 +71,7 @@ char passwd[] = "EasySetup123"; // Callback functions //----------------------------------------------------------------------------- extern "C" void EventCallbackInApplication(ESResult esResult, - EnrolleeState enrolleeState) + ESEnrolleeState enrolleeState) { OIC_LOG(INFO, TAG, "Entering EventCallbackInApplication"); @@ -108,7 +108,7 @@ void InitESEnrollee() { OIC_LOG(INFO, TAG, "Entering InitESEnrollee"); - EXPECT_EQ(ES_OK, InitEasySetup(CT_ADAPTER_IP, + EXPECT_EQ(ES_OK, ESInitEnrollee(CT_ADAPTER_IP, "EasySetup123", "EasySetup123", 0, @@ -122,22 +122,22 @@ void InitESEnrollee() TEST(ESEnrolleeInit, ESEnrolleeInitNullSSID) { - EXPECT_EQ(ES_ERROR, InitEasySetup(CT_ADAPTER_IP, 0, passwd, 0, EventCallbackInApplication)); + EXPECT_EQ(ES_ERROR, ESInitEnrollee(CT_ADAPTER_IP, 0, passwd, 0, EventCallbackInApplication)); } TEST(ESEnrolleeInit, ESEnrolleeInitNullPassword) { - EXPECT_EQ(ES_ERROR, InitEasySetup(CT_ADAPTER_IP, ssid, 0, 0, EventCallbackInApplication)); + EXPECT_EQ(ES_ERROR, ESInitEnrollee(CT_ADAPTER_IP, ssid, 0, 0, EventCallbackInApplication)); } TEST(ESEnrolleeInit, ESEnrolleeInitNullCb) { - EXPECT_EQ(ES_ERROR, InitEasySetup(CT_ADAPTER_IP, ssid, passwd, 0, 0)); + EXPECT_EQ(ES_ERROR, ESInitEnrollee(CT_ADAPTER_IP, ssid, passwd, 0, 0)); } -TEST(ESEnrolleeInit, ESEnrolleeInitEasySetupSuccess) +TEST(ESEnrolleeInit, ESEnrolleeESInitEnrolleeSuccess) { - EXPECT_EQ(ES_OK, InitEasySetup(CT_ADAPTER_IP, + EXPECT_EQ(ES_OK, ESInitEnrollee(CT_ADAPTER_IP, ssid, passwd, 0, @@ -178,15 +178,15 @@ TEST(ESOCInit, ESOCInitInvalidMode) EXPECT_EQ(OC_STACK_ERROR, OCStop()); } -TEST(ESProvisioning, ESInitProvisioning) +TEST(ESProvisioning, ESInitProvisioningResource) { - EXPECT_EQ(ES_RESOURCECREATED, InitProvisioning()); + EXPECT_EQ(ES_RESOURCECREATED, ESInitProvisioning()); } TEST(ESProvisioning, ESInitProvisioningWithOCStackClientMode) { EXPECT_EQ(OC_STACK_OK, OCInit(NULL, 0, OC_CLIENT)); - EXPECT_EQ(ES_ERROR, InitProvisioning()); + EXPECT_EQ(ES_ERROR, ESInitProvisioning()); EXPECT_EQ(OC_STACK_OK, OCStop()); } @@ -221,7 +221,7 @@ TEST(ESProvisioningResource, ESDeleteProvisioningResourceWithoutCreating) TEST(ESOnboarding, ESOnboardingSoftAp) { - EXPECT_EQ(1, ESOnboard(ssid, passwd, OnboardingCallback)); + EXPECT_EQ(1, ESOnboard(ssid, passwd, ESOnboardingCallback)); } TEST(ESOnboarding, ESOnboardingSoftApEnrollee) @@ -251,53 +251,53 @@ TEST(ESOnboarding, ESOnboardingSoftApHost) TEST(ESStop, ESTerminateEasysetupWithoutESInit) { - EXPECT_EQ(ES_ERROR, TerminateEasySetup()); + EXPECT_EQ(ES_ERROR, ESTerminateEnrollee()); } TEST(ESStop, ESTerminateEasysetupWithoutOCStack) { - EXPECT_EQ(ES_OK, InitEasySetup(CT_ADAPTER_IP, + EXPECT_EQ(ES_OK, ESInitEnrollee(CT_ADAPTER_IP, ssid, passwd, 0, EventCallbackInApplication)); - EXPECT_EQ(ES_ERROR, TerminateEasySetup()); + EXPECT_EQ(ES_ERROR, ESTerminateEnrollee()); } TEST(ESStop, ESTerminateEasysetupWithOutCreateProvisioningResource) { - EXPECT_EQ(ES_OK, InitEasySetup(CT_ADAPTER_IP, + EXPECT_EQ(ES_OK, ESInitEnrollee(CT_ADAPTER_IP, ssid, passwd, 0, EventCallbackInApplication)); EXPECT_EQ(OC_STACK_OK, OCInit(0, 0, OC_SERVER)); - EXPECT_EQ(ES_ERROR, TerminateEasySetup()); + EXPECT_EQ(ES_ERROR, ESTerminateEnrollee()); EXPECT_EQ(OC_STACK_OK, OCStop()); } TEST(ESStop, ESTerminateEasysetupWithoutProviosioningResource) { - EXPECT_EQ(ES_OK, InitEasySetup(CT_ADAPTER_IP, + EXPECT_EQ(ES_OK, ESInitEnrollee(CT_ADAPTER_IP, ssid, passwd, 0, EventCallbackInApplication)); EXPECT_EQ(OC_STACK_OK, OCInit(NULL, 0, OC_SERVER)); - EXPECT_EQ(ES_ERROR, TerminateEasySetup()); + EXPECT_EQ(ES_ERROR, ESTerminateEnrollee()); EXPECT_EQ(OC_STACK_OK, OCStop()); } TEST(ESStop, ESTerminateEasysetupSuccess) { - EXPECT_EQ(ES_OK, InitEasySetup(CT_ADAPTER_IP, + EXPECT_EQ(ES_OK, ESInitEnrollee(CT_ADAPTER_IP, ssid, passwd, 0, EventCallbackInApplication)); EXPECT_EQ(OC_STACK_OK, OCInit(NULL, 0, OC_SERVER)); - EXPECT_EQ(ES_RESOURCECREATED, InitProvisioning()); - EXPECT_EQ(ES_OK, TerminateEasySetup()); + EXPECT_EQ(ES_RESOURCECREATED, ESInitProvisioning()); + EXPECT_EQ(ES_OK, ESTerminateEnrollee()); EXPECT_EQ(OC_STACK_OK, OCStop()); } diff --git a/service/easy-setup/inc/escommon.h b/service/easy-setup/inc/escommon.h index d1eee47..17ec815 100755 --- a/service/easy-setup/inc/escommon.h +++ b/service/easy-setup/inc/escommon.h @@ -144,7 +144,7 @@ typedef enum * Enrollee moves to this state after connecting to target network */ ES_ON_BOARDED_TARGET_NETWORK_STATE, -}EnrolleeState; +}ESEnrolleeState; /** * Provisioning Device Status diff --git a/service/easy-setup/sampleapp/enrollee/arduino/enrolleewifi.cpp b/service/easy-setup/sampleapp/enrollee/arduino/enrolleewifi.cpp index 843a55b..d867f51 100644 --- a/service/easy-setup/sampleapp/enrollee/arduino/enrolleewifi.cpp +++ b/service/easy-setup/sampleapp/enrollee/arduino/enrolleewifi.cpp @@ -117,7 +117,7 @@ void PrintMenu() Serial.println("============"); } -void EventCallbackInApp(ESResult esResult, EnrolleeState enrolleeState) +void EventCallbackInApp(ESResult esResult, ESEnrolleeState enrolleeState) { Serial.println("callback!!! in app"); @@ -173,8 +173,8 @@ void StartEasySetup() { 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) + //ESInitEnrollee with sercurity mode disabled for arduino + if(ESInitEnrollee(CT_ADAPTER_IP, ssid, passwd, false, EventCallbackInApp) == ES_ERROR) { OIC_LOG(ERROR, TAG, "OnBoarding Failed"); return; @@ -185,9 +185,9 @@ void StartEasySetup() OIC_LOG_V(ERROR, TAG, "OnBoarding succeded. Successfully connected to ssid : %s",ssid); } -void StartProvisioning() +void ESInitResources() { - OIC_LOG(DEBUG, TAG, "StartProvisioning is invoked..."); + OIC_LOG(DEBUG, TAG, "ESInitResources is invoked..."); // Initialize the OC Stack in Server mode if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK) @@ -196,7 +196,7 @@ void StartProvisioning() return; } - if (InitProvisioning() == ES_ERROR) + if (ESInitProvisioning() == ES_ERROR) { OIC_LOG(ERROR, TAG, "Init Provisioning Failed!!"); return; @@ -209,9 +209,9 @@ void StopEasySetup() g_isInitialized = false; - if (TerminateEasySetup() == ES_ERROR) + if (ESTerminateEnrollee() == ES_ERROR) { - OIC_LOG(ERROR, TAG, "TerminateEasySetup Failed!!"); + OIC_LOG(ERROR, TAG, "ESTerminateEnrollee Failed!!"); return; } @@ -267,7 +267,7 @@ void loop() break; case 'P': // start provisioning - StartProvisioning(); + ESInitResources(); break; case 'T': // stop easy setup @@ -288,7 +288,7 @@ void loop() if (WiFi.status() == WL_CONNECTED) is_connected = true; else if (is_connected) - TerminateEasySetup(); + ESTerminateEnrollee(); // Give CPU cycles to OCStack to perform send/recv and other OCStack stuff if (OCProcess() != OC_STACK_OK) diff --git a/service/easy-setup/sampleapp/enrollee/linux/enrolleewifi.c b/service/easy-setup/sampleapp/enrollee/linux/enrolleewifi.c index 9016ab1..e645bc4 100644 --- a/service/easy-setup/sampleapp/enrollee/linux/enrolleewifi.c +++ b/service/easy-setup/sampleapp/enrollee/linux/enrolleewifi.c @@ -69,7 +69,7 @@ void PrintMenu() printf("============\n"); } -void EventCallbackInApp(ESResult esResult, EnrolleeState enrolleeState) +void EventCallbackInApp(ESResult esResult, ESEnrolleeState enrolleeState) { printf("Easy setup event callback\n"); @@ -121,14 +121,14 @@ void StartEasySetup() { printf("StartEasySetup and onboarding started..\n"); - if(InitEasySetup(CT_ADAPTER_IP, ssid, passwd, gIsSecured, EventCallbackInApp) == ES_ERROR) + if(ESInitEnrollee(CT_ADAPTER_IP, ssid, passwd, gIsSecured, EventCallbackInApp) == ES_ERROR) { printf("StartEasySetup and onboarding Fail!!\n"); return; } } -void StartOICStackAndStartResources() +void ESInitResources() { printf("Starting Enrollee Provisioning\n"); @@ -139,7 +139,7 @@ void StartOICStackAndStartResources() return; } - if (InitProvisioning() == ES_ERROR) + if (ESInitProvisioning() == ES_ERROR) { printf("Init Provisioning Failed!!\n"); return; @@ -151,16 +151,16 @@ void StartOICStackAndStartResources() printf("Thread creation failed\n"); } - printf("InitProvisioning Success\n"); + printf("ESInitProvisioning Success\n"); } void StopEasySetup() { printf("StopEasySetup IN\n"); - if (TerminateEasySetup() == ES_ERROR) + if (ESTerminateEnrollee() == ES_ERROR) { - printf("TerminateEasySetup Failed!!\n"); + printf("ESTerminateEnrollee Failed!!\n"); return; } @@ -212,7 +212,7 @@ int main() case 'P': // start provisioning case 'p': - StartOICStackAndStartResources(); + ESInitResources(); break; case 'T': // stop easy setup diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp index 5783b4d..79943b1 100755 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp @@ -71,7 +71,7 @@ void PrintMenu() cout<<"============"<