//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include "iotivity_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
#include <ocstack.h>
#include <iostream>
#include <sstream>
+#include <getopt.h>
+#include "ocpayload.h"
+#include "payload_logging.h"
#include "logger.h"
-const char *getResult(OCStackResult result);
-std::string getIPAddrTBServer(OCClientResponse * clientResponse);
-std::string getPortTBServer(OCClientResponse * clientResponse);
-std::string getQueryStrForGetPut(unsigned const char * responsePayload);
+#include "common.h"
+#include "oic_string.h"
-#define TAG PCF("occlient")
+std::string getQueryStrForGetPut();
+
+#define TAG ("occlient")
#define DEFAULT_CONTEXT_VALUE 0x99
#ifndef MAX_LENGTH_IPv4_ADDR
#define MAX_LENGTH_IPv4_ADDR 16
#endif
-typedef enum {
+typedef enum
+{
TEST_INVALID = 0,
TEST_GET_DEFAULT,
TEST_GET_BATCH,
TEST_UNKNOWN_RESOURCE_GET_DEFAULT,
TEST_UNKNOWN_RESOURCE_GET_BATCH,
TEST_UNKNOWN_RESOURCE_GET_LINK_LIST,
+ TEST_GET_EMPTY,
+ TEST_GET_NULL,
MAX_TESTS
} CLIENT_TEST;
-unsigned static int TEST = TEST_INVALID;
+/**
+ * List of connectivity types that can be initiated from the client
+ * Required for user input validation
+ */
+typedef enum {
+ CT_ADAPTER_DEFAULT = 0,
+ CT_IP,
+ MAX_CT
+} CLIENT_ConnectivityType_TYPE;
+
+unsigned static int TestType = TEST_INVALID;
+unsigned static int ConnectivityType = 0;
typedef struct
{
- unsigned char text[30];
+ char text[30];
CLIENT_TEST test;
} testToTextMap;
testToTextMap queryInterface[] = {
{"invalid", TEST_INVALID},
- {"?if=oc.mi.def", TEST_GET_DEFAULT},
- {"?if=oc.mi.b", TEST_GET_BATCH},
- {"?if=oc.mi.ll", TEST_GET_LINK_LIST},
- {"?if=oc.mi.def", TEST_UNKNOWN_RESOURCE_GET_DEFAULT},
- {"?if=oc.mi.b", TEST_UNKNOWN_RESOURCE_GET_BATCH},
- {"?if=oc.mi.ll", TEST_UNKNOWN_RESOURCE_GET_LINK_LIST},
- {"?if=oc.mi.def", TEST_PUT_DEFAULT},
- {"?if=oc.mi.b", TEST_PUT_BATCH},
- {"?if=oc.mi.ll", TEST_PUT_LINK_LIST},
+ {"?if=oic.if.baseline", TEST_GET_DEFAULT},
+ {"?if=oic.if.b", TEST_GET_BATCH},
+ {"?if=oic.if.ll", TEST_GET_LINK_LIST},
+ {"?if=oic.if.baseline", TEST_UNKNOWN_RESOURCE_GET_DEFAULT},
+ {"?if=oic.if.b", TEST_UNKNOWN_RESOURCE_GET_BATCH},
+ {"?if=oic.if.ll", TEST_UNKNOWN_RESOURCE_GET_LINK_LIST},
+ {"?if=oic.if.baseline", TEST_PUT_DEFAULT},
+ {"?if=oic.if.b", TEST_PUT_BATCH},
+ {"?if=oic.if.ll", TEST_PUT_LINK_LIST},
+ {"", TEST_GET_EMPTY},
+ {NULL, TEST_GET_NULL},
};
-static std::string putPayload = "{\"state\":\"off\",\"power\":\"0\"}";
-//The following variable determines the interface (wifi, ethernet etc.)
-//to be used for sending unicast messages. Default set to WIFI.
-static OCConnectivityType OC_CONNTYPE = OC_WIFI;
-static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
+//The following variable determines the interface protocol (IP, etc)
+//to be used for sending unicast messages. Default set to IP.
+static OCConnectivityType ConnType = CT_ADAPTER_IP;
+static const char * RESOURCE_DISCOVERY_QUERY = "/oic/res";
// The handle for the observe registration
OCDoHandle gObserveDoHandle;
int gQuitFlag = 0;
/* SIGINT handler: set gQuitFlag to 1 for graceful termination */
-void handleSigInt(int signum) {
- if (signum == SIGINT) {
+void handleSigInt(int signum)
+{
+ if (signum == SIGINT)
+ {
gQuitFlag = 1;
}
}
int InitGetRequest(OCClientResponse * clientResponse);
int InitDiscovery();
+OCPayload* putPayload()
+{
+ OCRepPayload* payload = OCRepPayloadCreate();
+
+ if(!payload)
+ {
+ std::cout << "Failed to create put payload object"<<std::endl;
+ std::exit(1);
+ }
+
+ OCRepPayloadSetPropInt(payload, "power", 15);
+ OCRepPayloadSetPropBool(payload, "state", true);
+
+ return (OCPayload*) payload;
+}
+
void PrintUsage()
{
- OC_LOG(INFO, TAG, "Usage : occlientcoll -t <Test Case> -c <CA connectivity Type>");
- OC_LOG(INFO, TAG, "-c <0|1> : Send messages over Ethernet or WIFI");
- OC_LOG(INFO, TAG, "Test Case 1 : Discover Resources && Initiate GET Request on an"\
+ OIC_LOG(INFO, TAG, "Usage : occlientcoll -t <Test Case> -c <CA connectivity Type>");
+ OIC_LOG(INFO, TAG, "-c 0 : Default auto-selection");
+ OIC_LOG(INFO, TAG, "-c 1 : IP Connectivity Type");
+ OIC_LOG(INFO, TAG, "Test Case 1 : Discover Resources && Initiate GET Request on an "\
"available resource using default interface.");
- OC_LOG(INFO, TAG, "Test Case 2 : Discover Resources && Initiate GET Request on an"\
+ OIC_LOG(INFO, TAG, "Test Case 2 : Discover Resources && Initiate GET Request on an "\
"available resource using batch interface.");
- OC_LOG(INFO, TAG, "Test Case 3 : Discover Resources && Initiate GET Request on an"\
+ OIC_LOG(INFO, TAG, "Test Case 3 : Discover Resources && Initiate GET Request on an "\
"available resource using link list interface.");
- OC_LOG(INFO, TAG, "Test Case 4 : Discover Resources && Initiate GET & PUT Request on an"\
+ OIC_LOG(INFO, TAG, "Test Case 4 : Discover Resources && Initiate GET & PUT Request on an "\
"available resource using default interface.");
- OC_LOG(INFO, TAG, "Test Case 5 : Discover Resources && Initiate GET & PUT Request on an"\
+ OIC_LOG(INFO, TAG, "Test Case 5 : Discover Resources && Initiate GET & PUT Request on an "\
"available resource using batch interface.");
- OC_LOG(INFO, TAG, "Test Case 6 : Discover Resources && Initiate GET & PUT Request on an"\
+ OIC_LOG(INFO, TAG, "Test Case 6 : Discover Resources && Initiate GET & PUT Request on an "\
"available resource using link list interface.");
- OC_LOG(INFO, TAG, "Test Case 7 : Discover Resources && Initiate GET Request on an"\
+ OIC_LOG(INFO, TAG, "Test Case 7 : Discover Resources && Initiate GET Request on an "\
"unavailable resource using default interface.");
- OC_LOG(INFO, TAG, "Test Case 8 : Discover Resources && Initiate GET Request on an"\
+ OIC_LOG(INFO, TAG, "Test Case 8 : Discover Resources && Initiate GET Request on an "\
"unavailable resource using batch interface.");
- OC_LOG(INFO, TAG, "Test Case 9 : Discover Resources && Initiate GET Request on an"\
+ OIC_LOG(INFO, TAG, "Test Case 9 : Discover Resources && Initiate GET Request on an "\
"unavailable resource using link list interface.");
+ OIC_LOG(INFO, TAG, "Test Case 10 : Discover Resources && Initiate GET Request on an "\
+ "empty resource.");
+ OIC_LOG(INFO, TAG, "Test Case 11 : Discover Resources && Initiate GET Request on an "\
+ "NULL resource.");
+
}
-OCStackApplicationResult putReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse) {
+OCStackApplicationResult putReqCB(void* ctx, OCDoHandle /*handle*/,
+ OCClientResponse * clientResponse)
+{
if(clientResponse == NULL)
{
- OC_LOG(INFO, TAG, "The clientResponse is NULL");
+ OIC_LOG(INFO, TAG, "The clientResponse is NULL");
return OC_STACK_DELETE_TRANSACTION;
}
- if(ctx == (void*)DEFAULT_CONTEXT_VALUE) {
- OC_LOG_V(INFO, TAG, "Callback Context for PUT query recvd successfully");
- OC_LOG_V(INFO, TAG, "JSON = %s =============> Discovered", clientResponse->resJSONPayload);
+ if(ctx == (void*)DEFAULT_CONTEXT_VALUE)
+ {
+ OIC_LOG_V(INFO, TAG, "Callback Context for PUT query recvd successfully");
+ OIC_LOG_PAYLOAD(INFO, clientResponse->payload);
}
return OC_STACK_KEEP_TRANSACTION;
}
-OCStackApplicationResult getReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse) {
- OC_LOG_V(INFO, TAG, "StackResult: %s",
+OCStackApplicationResult getReqCB(void* ctx, OCDoHandle /*handle*/,
+ OCClientResponse * clientResponse)
+{
+ OIC_LOG_V(INFO, TAG, "StackResult: %s",
getResult(clientResponse->result));
- if(ctx == (void*)DEFAULT_CONTEXT_VALUE) {
- OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber);
- if(clientResponse->sequenceNumber == 0) {
- OC_LOG_V(INFO, TAG, "Callback Context for GET query recvd successfully");
- OC_LOG_V(INFO, TAG, "Fnd' Rsrc': %s", clientResponse->resJSONPayload);
+ if(ctx == (void*)DEFAULT_CONTEXT_VALUE)
+ {
+ OIC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber);
+ if(clientResponse->sequenceNumber == 0)
+ {
+ OIC_LOG_V(INFO, TAG, "Callback Context for GET query recvd successfully");
+ OIC_LOG_PAYLOAD(INFO, clientResponse->payload);
}
- else {
- OC_LOG_V(INFO, TAG, "Callback Context for Get recvd successfully %d", gNumObserveNotifies);
- OC_LOG_V(INFO, TAG, "Fnd' Rsrc': %s", clientResponse->resJSONPayload);
+ else
+ {
+ OIC_LOG_V(INFO, TAG, "Callback Context for Get recvd successfully %d",
+ gNumObserveNotifies);
+ OIC_LOG_PAYLOAD(INFO, clientResponse->payload);;
gNumObserveNotifies++;
if (gNumObserveNotifies == 3)
{
- if (OCCancel (gObserveDoHandle, OC_LOW_QOS, NULL, 0) != OC_STACK_OK){
- OC_LOG(ERROR, TAG, "Observe cancel error");
+ if (OCCancel (gObserveDoHandle, OC_LOW_QOS, NULL, 0) != OC_STACK_OK)
+ {
+ OIC_LOG(ERROR, TAG, "Observe cancel error");
}
}
}
}
- if(TEST == TEST_PUT_DEFAULT || TEST == TEST_PUT_BATCH || TEST == TEST_PUT_LINK_LIST)
+ if(TestType == TEST_PUT_DEFAULT || TestType == TEST_PUT_BATCH || TestType == TEST_PUT_LINK_LIST)
{
InitPutRequest(clientResponse);
}
return OC_STACK_KEEP_TRANSACTION;
}
-
// This is a function called back when a device is discovered
-OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle,
- OCClientResponse * clientResponse) {
- uint8_t remoteIpAddr[4];
- uint16_t remotePortNu;
-
- OC_LOG(INFO, TAG,
+OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle /*handle*/,
+ OCClientResponse * clientResponse)
+{
+ OIC_LOG(INFO, TAG,
"Entering discoveryReqCB (Application Layer CB)");
- OC_LOG_V(INFO, TAG, "StackResult: %s",
+ OIC_LOG_V(INFO, TAG, "StackResult: %s",
getResult(clientResponse->result));
- if (ctx == (void*) DEFAULT_CONTEXT_VALUE) {
- OC_LOG_V(INFO, TAG, "Callback Context recvd successfully");
+ if (ctx == (void*) DEFAULT_CONTEXT_VALUE)
+ {
+ OIC_LOG_V(INFO, TAG, "Callback Context recvd successfully");
}
- OCDevAddrToIPv4Addr((OCDevAddr *) clientResponse->addr, remoteIpAddr,
- remoteIpAddr + 1, remoteIpAddr + 2, remoteIpAddr + 3);
- OCDevAddrToPort((OCDevAddr *) clientResponse->addr, &remotePortNu);
+ OIC_LOG_V(INFO, TAG,
+ "Device =============> Discovered @ %s:%d",
+ clientResponse->devAddr.addr,
+ clientResponse->devAddr.port);
+ OIC_LOG_PAYLOAD(INFO, clientResponse->payload);
- OC_LOG_V(INFO, TAG,
- "Device =============> Discovered %s @ %d.%d.%d.%d:%d",
- clientResponse->resJSONPayload, remoteIpAddr[0], remoteIpAddr[1],
- remoteIpAddr[2], remoteIpAddr[3], remotePortNu);
+ ConnType = clientResponse->connType;
- if(TEST == TEST_UNKNOWN_RESOURCE_GET_DEFAULT || TEST == TEST_UNKNOWN_RESOURCE_GET_BATCH ||\
- TEST == TEST_UNKNOWN_RESOURCE_GET_LINK_LIST)
+ if(TestType == TEST_UNKNOWN_RESOURCE_GET_DEFAULT || TestType == TEST_UNKNOWN_RESOURCE_GET_BATCH ||\
+ TestType == TEST_UNKNOWN_RESOURCE_GET_LINK_LIST)
{
InitGetRequestToUnavailableResource(clientResponse);
}
{
OCStackResult ret;
OCCallbackData cbData;
- OCDoHandle handle;
std::ostringstream getQuery;
- getQuery << "coap://" << getIPAddrTBServer(clientResponse) << ":" << getPortTBServer(clientResponse) << "/SomeUnknownResource";
+ getQuery << "/SomeUnknownResource";
cbData.cb = getReqCB;
cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL;
- ret = OCDoResource(&handle, OC_REST_GET, getQuery.str().c_str(), 0, 0, OC_CONNTYPE, OC_LOW_QOS,
- &cbData, NULL, 0);
+ ret = OCDoRequest(NULL, OC_REST_GET, getQuery.str().c_str(),
+ &clientResponse->devAddr, 0, ConnType, OC_LOW_QOS,
+ &cbData, NULL, 0);
if (ret != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "OCStack resource error");
+ OIC_LOG(ERROR, TAG, "OCStack resource error");
}
return ret;
}
OCCallbackData cbData;
OCDoHandle handle;
std::ostringstream obsReg;
- obsReg << "coap://" << getIPAddrTBServer(clientResponse) << ":" << getPortTBServer(clientResponse) << getQueryStrForGetPut(clientResponse->resJSONPayload);
+ obsReg << getQueryStrForGetPut();
cbData.cb = getReqCB;
cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL;
- OC_LOG_V(INFO, TAG, "OBSERVE payload from client = %s ", putPayload.c_str());
-
- ret = OCDoResource(&handle, OC_REST_OBSERVE, obsReg.str().c_str(), 0, 0, OC_CONNTYPE,
- OC_LOW_QOS, &cbData, NULL, 0);
+ OIC_LOG_V(INFO, TAG, "OBSERVE payload from client =");
+ OCPayload* payload = putPayload();
+ OIC_LOG_PAYLOAD(INFO, payload);
+ OCPayloadDestroy(payload);
+
+ ret = OCDoRequest(&handle, OC_REST_OBSERVE, obsReg.str().c_str(),
+ &clientResponse->devAddr, 0, ConnType,
+ OC_LOW_QOS, &cbData, NULL, 0);
if (ret != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "OCStack resource error");
+ OIC_LOG(ERROR, TAG, "OCStack resource error");
}
else
{
{
OCStackResult ret;
OCCallbackData cbData;
- OCDoHandle handle;
//* Make a PUT query*/
std::ostringstream getQuery;
- getQuery << "coap://" << getIPAddrTBServer(clientResponse) << ":" << getPortTBServer(clientResponse) <<
- "/a/room" << queryInterface[TEST].text;
+ getQuery << "coap://" << clientResponse->devAddr.addr << ":" <<
+ clientResponse->devAddr.port <<
+ "/a/room" << queryInterface[TestType].text;
cbData.cb = putReqCB;
cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL;
- OC_LOG_V(INFO, TAG, "PUT payload from client = %s ", putPayload.c_str());
+ OIC_LOG_V(INFO, TAG, "PUT payload from client = ");
+ OCPayload* payload = putPayload();
+ OIC_LOG_PAYLOAD(INFO, payload);
+
+ ret = OCDoRequest(NULL, OC_REST_PUT, getQuery.str().c_str(),
+ &clientResponse->devAddr, payload, ConnType,
+ OC_LOW_QOS, &cbData, NULL, 0);
+
+ OCPayloadDestroy(payload);
- ret = OCDoResource(&handle, OC_REST_PUT, getQuery.str().c_str(), 0, putPayload.c_str(),
- OC_CONNTYPE, OC_LOW_QOS, &cbData, NULL, 0);
if (ret != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "OCStack resource error");
+ OIC_LOG(ERROR, TAG, "OCStack resource error");
}
return ret;
}
{
OCStackResult ret;
OCCallbackData cbData;
- OCDoHandle handle;
-
- uint8_t remoteIpAddr[4];
- uint16_t remotePortNu;
-
- OCDevAddrToIPv4Addr((OCDevAddr *) clientResponse->addr, remoteIpAddr,
- remoteIpAddr + 1, remoteIpAddr + 2, remoteIpAddr + 3);
- OCDevAddrToPort((OCDevAddr *) clientResponse->addr, &remotePortNu);
//* Make a GET query*/
std::ostringstream getQuery;
- getQuery << "coap://" << getIPAddrTBServer(clientResponse) << ":" << getPortTBServer(clientResponse) <<
- "/a/room" << queryInterface[TEST].text;
+ getQuery << "/a/room" << queryInterface[TestType].text;
std::cout << "Get Query: " << getQuery.str() << std::endl;
cbData.cb = getReqCB;
cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL;
- ret = OCDoResource(&handle, OC_REST_GET, getQuery.str().c_str(), 0, 0, OC_CONNTYPE, OC_LOW_QOS,
- &cbData, NULL, 0);
+ ret = OCDoRequest(NULL, OC_REST_GET, getQuery.str().c_str(),
+ &clientResponse->devAddr, 0, ConnType, OC_LOW_QOS,
+ &cbData, NULL, 0);
if (ret != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "OCStack resource error");
+ OIC_LOG(ERROR, TAG, "OCStack resource error");
}
return ret;
}
{
OCStackResult ret;
OCCallbackData cbData;
- OCDoHandle handle;
/* Start a discovery query*/
- char szQueryUri[64] = { 0 };
+ char szQueryUri[MAX_QUERY_LENGTH] = { 0 };
- strcpy(szQueryUri, MULTICAST_RESOURCE_DISCOVERY_QUERY);
+ OICStrcpy(szQueryUri, sizeof(szQueryUri), RESOURCE_DISCOVERY_QUERY);
cbData.cb = discoveryReqCB;
cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL;
- ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_ALL,
- OC_LOW_QOS,
- &cbData, NULL, 0);
+ ret = OCDoRequest(NULL, OC_REST_DISCOVER, szQueryUri, NULL, 0, ConnType,
+ OC_LOW_QOS,
+ &cbData, NULL, 0);
if (ret != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "OCStack resource error");
+ OIC_LOG(ERROR, TAG, "OCStack resource error");
}
return ret;
}
-int main(int argc, char* argv[]) {
+int main(int argc, char* argv[])
+{
int opt;
while ((opt = getopt(argc, argv, "t:c:")) != -1)
{
- switch(opt)
+ switch (opt)
{
- case 't':
- TEST = atoi(optarg);
- break;
- case 'c':
- OC_CONNTYPE = OCConnectivityType(atoi(optarg));
- break;
- default:
- PrintUsage();
- return -1;
+ case 't':
+ TestType = atoi(optarg);
+ break;
+ case 'c':
+ ConnectivityType = atoi(optarg);
+ break;
+ default:
+ PrintUsage();
+ return -1;
}
}
- if(TEST <= TEST_INVALID || TEST >= MAX_TESTS){
+ if ((TestType <= TEST_INVALID || TestType >= MAX_TESTS) ||
+ ConnectivityType >= MAX_CT)
+ {
PrintUsage();
return -1;
}
-
/* Initialize OCStack*/
- if (OCInit(NULL, 0, OC_CLIENT) != OC_STACK_OK) {
- OC_LOG(ERROR, TAG, "OCStack init error");
+ if (OCInit(NULL, 0, OC_CLIENT) != OC_STACK_OK)
+ {
+ OIC_LOG(ERROR, TAG, "OCStack init error");
return 0;
}
+ if(ConnectivityType == CT_ADAPTER_DEFAULT || ConnectivityType == CT_IP)
+ {
+ ConnType = CT_ADAPTER_IP;
+ }
+ else
+ {
+ OIC_LOG(INFO, TAG, "Default Connectivity type selected...");
+ ConnType = CT_ADAPTER_IP;
+ }
+
InitDiscovery();
// Break from loop with Ctrl+C
- OC_LOG(INFO, TAG, "Entering occlient main loop...");
+ OIC_LOG(INFO, TAG, "Entering occlient main loop...");
signal(SIGINT, handleSigInt);
- while (!gQuitFlag) {
+ while (!gQuitFlag)
+ {
- if (OCProcess() != OC_STACK_OK) {
- OC_LOG(ERROR, TAG, "OCStack process error");
+ if (OCProcess() != OC_STACK_OK)
+ {
+ OIC_LOG(ERROR, TAG, "OCStack process error");
return 0;
}
sleep(2);
- }
- OC_LOG(INFO, TAG, "Exiting occlient main loop...");
+ } OIC_LOG(INFO, TAG, "Exiting occlient main loop...");
- if (OCStop() != OC_STACK_OK) {
- OC_LOG(ERROR, TAG, "OCStack stop error");
+ if (OCStop() != OC_STACK_OK)
+ {
+ OIC_LOG(ERROR, TAG, "OCStack stop error");
}
return 0;
}
-std::string getIPAddrTBServer(OCClientResponse * clientResponse) {
- if(!clientResponse) return "";
- if(!clientResponse->addr) return "";
- uint8_t a, b, c, d = 0;
- if(0 != OCDevAddrToIPv4Addr(clientResponse->addr, &a, &b, &c, &d) ) return "";
-
- char ipaddr[16] = {'\0'};
- snprintf(ipaddr, sizeof(ipaddr), "%d.%d.%d.%d", a,b,c,d); // ostringstream not working correctly here, hence snprintf
- //printf("IP address string of the TB server = %s\n", *out_ipaddr);
- return std::string (ipaddr);
-}
-
-
-std::string getPortTBServer(OCClientResponse * clientResponse){
- if(!clientResponse) return "";
- if(!clientResponse->addr) return "";
- uint16_t p = 0;
- if(0 != OCDevAddrToPort(clientResponse->addr, &p) ) return "";
- std::ostringstream ss;
- ss << p;
- return ss.str();
-}
-
-std::string getQueryStrForGetPut(unsigned const char * responsePayload){
-
- std::string jsonPayload(reinterpret_cast<char*>(const_cast<unsigned char*>(responsePayload)));
-
+std::string getQueryStrForGetPut()
+{
return "/a/room";
}