INC_DIRS += -I$(CONNECTIVITY_DIR)/api
# TODO-CA Remove -fstack-protector-all before merging to master
-CC_FLAGS.debug := -O0 -g3 -Wall -fstack-protector-all -c -fmessage-length=0 -pedantic -fpic -DTB_LOG
+# TODO-CA Remove CA_INT flag after CA merging is finalized
+CC_FLAGS.debug := -O0 -g3 -Wall -fstack-protector-all -c -fmessage-length=0 -pedantic -fpic -DTB_LOG -DCA_INT
# TODO-CA Remove -fstack-protector-all before merging to master
-CC_FLAGS.release := -Os -Wall -fstack-protector-all -c -fmessage-length=0 -fpic
+CC_FLAGS.release := -Os -Wall -fstack-protector-all -c -fmessage-length=0 -fpic -DCA_INT
CFLAGS += $(CC_FLAGS.$(BUILD)) $(INC_DIRS) $(CFLAGS_PLATFORM) $(INC_DIR_PLATFORM)
LDLIBS += -lcoap
OC_COAP_ID = (1 << 1)
} OCTransportProtocolID;
+#ifdef CA_INT
+/**
+ * Adaptor types
+ */
+typedef enum {
+ OC_ETHERNET = (1 << 0),
+ OC_WIFI = (1 << 1),
+ OC_EDR = (1 << 2),
+ OC_LE = (1 << 3)
+} OCConnectivityType;
+#endif
+
/**
* Declares Stack Results & Errors
*/
typedef struct {
// Address of remote server
OCDevAddr * addr;
+ #ifdef CA_INT
+ // Indicates adaptor type on which the response was received
+ OCConnectivityType connType;
+ #endif
// the is the result of our stack, OCStackResult should contain coap/other error codes;
OCStackResult result;
// If associated with observe, this will represent the sequence of notifications from server.
OC_STACK_KEEP_TRANSACTION
} OCStackApplicationResult;
-#ifdef CA_INT
-typedef enum {
- OC_ETHERNET = (1 << 0),
- OC_WIFI = (1 << 1),
- OC_EDR = (1 << 2),
- OC_LE = (1 << 3)
-} OCConnectivityType;
-#endif
-
//-----------------------------------------------------------------------------
// Callback function definitions
//-----------------------------------------------------------------------------
OCDevAddrToPort((OCDevAddr *) clientResponse->addr, &remotePortNu);
#ifdef CA_INT
+ std::string connectionType = getConnectivityType (clientResponse->connType);
+ OC_LOG_V(INFO, TAG, "Discovered on %s", connectionType.c_str());
+#endif
OC_LOG_V(INFO, TAG,
"Device =============> Discovered %s @ %d.%d.%d.%d:%d",
clientResponse->resJSONPayload, remoteIpAddr[0], remoteIpAddr[1],
remoteIpAddr[2], remoteIpAddr[3], remotePortNu);
-#else
- OC_LOG_V(INFO, TAG,
- "Device =============> Discovered %s @ %d.%d.%d.%d:%d",
- clientResponse->resJSONPayload, remoteIpAddr[0], remoteIpAddr[1],
- remoteIpAddr[2], remoteIpAddr[3], remotePortNu);
-#endif
parseClientResponse(clientResponse);
return ss.str();
}
+std::string getConnectivityType (OCConnectivityType connType)
+{
+ switch (connType)
+ {
+ case OC_ETHERNET:
+ return "Ethernet";
+
+ case OC_WIFI:
+ return "WiFi";
+
+ case OC_LE:
+ return "BLE";
+
+ case OC_EDR:
+ return "BT";
+
+ default:
+ return "Incorrect connectivity";
+ }
+}
+
std::string getQueryStrForGetPut(OCClientResponse * clientResponse){
return "/a/light";
//----------------------------------------------------------------------------
// Function prototype
//----------------------------------------------------------------------------
+#ifdef CA_INT
+std::string getConnectivityType (OCConnectivityType connType);
+#endif
/* call getResult in common.cpp to get the result in string format. */
const char *getResult(OCStackResult result);
static OCDevAddr address;
memcpy((void*)&address.addr, &(sa), sizeof(sa));
response.addr = &address;
+ #ifdef CA_INT
+ response.connType = endPoint->connectivityType;
+ #endif
response.result = CAToOCStackResult(responseInfo->result);
response.resJSONPayload = (unsigned char*)responseInfo->info.payload;
response.numRcvdVendorSpecificHeaderOptions = 0;