break;
}
}
-
+#ifdef CA_INT
+ return OC_STACK_KEEP_TRANSACTION;
+#else
return (UNICAST_DISCOVERY) ? OC_STACK_DELETE_TRANSACTION : OC_STACK_KEEP_TRANSACTION ;
+#endif
}
}
#ifdef CA_INT
- ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ETHERNET | OC_WIFI | OC_LE),
+ ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ETHERNET | OC_WIFI),
OC_LOW_QOS, &cbData, NULL, 0);
#else
ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_LOW_QOS, &cbData, NULL, 0);
cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL;
#ifdef CA_INT
- ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ETHERNET | OC_WIFI | OC_LE),
+ ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ETHERNET | OC_WIFI),
OC_LOW_QOS, &cbData, NULL, 0);
#else
ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_LOW_QOS, &cbData, NULL, 0);
cbData.cd = NULL;
#ifdef CA_INT
// TODO-CA: The adapter type is set to all but should be configurable - add as API param
- ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ETHERNET | OC_WIFI | OC_LE),
+ ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ETHERNET | OC_WIFI),
OC_LOW_QOS, &cbData, NULL, 0);
#else
ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_LOW_QOS, &cbData, NULL, 0);
cbData.cd = NULL;
#ifdef CA_INT
// TODO-CA: The adapter type is set to all but should be configurable - add as API param
- ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ETHERNET | OC_WIFI | OC_LE),
+ ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ETHERNET | OC_WIFI),
OC_LOW_QOS,
&cbData, NULL, 0);
#else
cbData.cd = NULL;
#ifdef CA_INT
// TODO-CA: The adapter type is set to all but should be configurable - add as API param
- ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ETHERNET | OC_WIFI | OC_LE),
+ ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, (OC_ETHERNET | OC_WIFI),
OC_LOW_QOS, &cbData, NULL, 0);
#else
ret = OCDoResource(&handle, OC_REST_GET, szQueryUri, 0, 0, OC_LOW_QOS, &cbData, NULL, 0);
{
OC_LOG_V(INFO, TAG, "IP Address = %s", ipAddr);
}
+
+ OCSeedRandom();
#ifdef CA_INT
CAInitialize();
//It is ok to select network to CA_WIFI for now
- CAResult_t caResult = CASelectNetwork(CA_WIFI);
+ CAResult_t caResult = CASelectNetwork(CA_WIFI|CA_ETHERNET);
if(caResult == CA_STATUS_OK)
{
OC_LOG(INFO, TAG, PCF("CASelectNetwork to WIFI"));
CAToken_t caToken = NULL;
CAInfo_t requestData;
CARequestInfo_t requestInfo;
+ CAGroupEndpoint_t grpEnd;
+
// To track if memory is allocated for additional header options
uint8_t hdrOptionMemAlloc = 0;
#endif // CA_INT
#ifdef CA_INT
memset(&requestData, 0, sizeof(CAInfo_t));
memset(&requestInfo, 0, sizeof(CARequestInfo_t));
+ memset(&grpEnd, 0, sizeof(CAGroupEndpoint_t));
switch (method)
{
case OC_REST_GET:
goto exit;
}
+ //High QoS is not supported
+ if(qos == OC_HIGH_QOS)
+ {
+ result = OC_STACK_INVALID_PARAM;
+ goto exit;
+ }
// TODO-CA: Handle multi-cast scenario
// Create remote end point
- caResult = CACreateRemoteEndpoint(newUri, CA_WIFI, &endpoint);
+ caResult = CACreateRemoteEndpoint(newUri, conType, &endpoint);
// TODO-CA: Connectivity type should be passed to API
- endpoint->connectivityType = CA_WIFI;
+ endpoint->connectivityType = conType;
+
if (caResult != CA_STATUS_OK)
{
OC_LOG(ERROR, TAG, PCF("CACreateRemoteEndpoint error"));
requestInfo.info = requestData;
// send request
- caResult = CASendRequest(endpoint, &requestInfo);
+ //TODO-CA Change This logic. Currently hardcoded to WIFI & ETHERNET
+ //Need to support other adapter types.
+ if(conType == (CA_WIFI | CA_ETHERNET))
+ {
+ //TODO-CA remove hardcoded resource uri. Instead, extract it from newUri
+ grpEnd.connectivityType = conType;
+ grpEnd.resourceUri = "/oc/core";
+
+ caResult = CASendRequestToAll(&grpEnd, &requestInfo);
+ }
+ else
+ {
+ caResult = CASendRequest(endpoint, &requestInfo);
+ }
if (caResult != CA_STATUS_OK)
{
OC_LOG(ERROR, TAG, PCF("CASendRequest"));