{
OIC_LOG(DEBUG, ANALYZER_TAG, "Payload Format = [CA_FORMAT_APPLICATION_CBOR]");
}
+ else if (CA_FORMAT_APPLICATION_VND_OCF_CBOR == info->payloadFormat)
+ {
+ OIC_LOG(DEBUG, ANALYZER_TAG, "Payload Format = [CA_FORMAT_APPLICATION_VND_OCF_CBOR]");
+ }
else
{
OIC_LOG_V(DEBUG, ANALYZER_TAG, "Payload Format = [%d]", info->payloadFormat);
######################################################################
# Build flags
######################################################################
+with_upstream_libcoap = samples_env.get('WITH_UPSTREAM_LIBCOAP')
+if with_upstream_libcoap == '1':
+ # For bring up purposes only, we manually copy the forked version to where
+ # the unforked version is downloaded.
+ samples_env.AppendUnique(CPPPATH=['#extlibs/libcoap/libcoap/include'])
+else:
+ # For bring up purposes only, the forked version will live here.
+ samples_env.AppendUnique(CPPPATH=['#resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
+
samples_env.PrependUnique(CPPPATH=[
'../../../../logger/include',
'../../../../include',
#include <sstream>
#include <getopt.h>
#include "ocstack.h"
+#include <coap/pdu.h>
#include "logger.h"
#include "occlient.h"
#include "ocpayload.h"
{
OIC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result));
- if (OC_STACK_NOT_ACCEPTABLE == clientResponse->result)
- {
- // Re-initiate discovery with OIC format. This is applicable for the case that
- // a OCF 1.x client speaks to a OIC 1.1 server.
- InitDiscovery(OC_LOW_QOS, 0);
- return OC_STACK_KEEP_TRANSACTION;
- }
-
std::string connectionType = getConnectivityType (clientResponse->connType);
OIC_LOG_V(INFO, TAG, "Discovered on %s", connectionType.c_str());
OIC_LOG_V(INFO, TAG,
memset(options, 0, sizeof(OCHeaderOption) * MAX_HEADER_OPTIONS);
size_t numOptions = 0;
- uint16_t format = COAP_MEDIATYPE_APPLICATION_VND_OCF_CBOR;
+ uint8_t format = COAP_MEDIATYPE_APPLICATION_CBOR;
uint16_t optionID = CA_OPTION_ACCEPT;
OCSetHeaderOption(options, &numOptions, optionID, &format, sizeof(format));
- uint16_t version = 2048;
- optionID = CA_OPTION_ACCEPT_VERSION;
- numOptions = 1;
- OCSetHeaderOption(options, &numOptions, optionID, &version, sizeof(version));
-
ret = OCDoRequest(NULL, OC_REST_DISCOVER, szQueryUri, NULL, 0, CT_DEFAULT,
(qos == OC_HIGH_QOS) ? OC_HIGH_QOS : OC_LOW_QOS,
&cbData, options, 2);
}
else
{
- InitDiscovery(OC_LOW_QOS, 1);
+ InitDiscovery(OC_LOW_QOS, 0);
}
// Break from loop with Ctrl+C
}
#endif
- uint16_t acceptVersion = 0;
- CAPayloadFormat_t acceptFormat = CA_FORMAT_APPLICATION_CBOR;
+ uint16_t acceptVersion = OC_SPEC_VERSION_VALUE;
+ CAPayloadFormat_t acceptFormat = CA_FORMAT_APPLICATION_VND_OCF_CBOR;
// Check settings of version option and content format.
if (requestInfo->info.numOptions > 0 && requestInfo->info.options)
{
}
requestInfo->info.acceptFormat = acceptFormat;
- if (CA_FORMAT_APPLICATION_VND_OCF_CBOR == acceptFormat)
+ if (CA_FORMAT_APPLICATION_CBOR == acceptFormat && acceptVersion)
{
- if (!acceptVersion)
- {
- requestInfo->info.acceptVersion = OC_SPEC_VERSION_VALUE;
- }
- else
- {
- requestInfo->info.acceptVersion = acceptVersion;
- }
+ acceptVersion = 0;
}
+ requestInfo->info.acceptVersion = acceptVersion;
CAResult_t result = CASendRequest(object, requestInfo);
if (CA_STATUS_OK != result)
{
serverRequest.acceptVersion = requestInfo->info.acceptVersion;
}
+
if (requestInfo->info.type == CA_MSG_CONFIRM)
{
serverRequest.qos = OC_HIGH_QOS;
if (payload)
{
- uint16_t payloadVersion = 0;
- CAPayloadFormat_t payloadFormat = CA_FORMAT_APPLICATION_CBOR;
+ uint16_t payloadVersion = OC_SPEC_VERSION_VALUE;
+ CAPayloadFormat_t payloadFormat = CA_FORMAT_APPLICATION_VND_OCF_CBOR;
// Check version option settings
if (numOptions > 0 && options)
{
}
requestInfo.info.payloadFormat = payloadFormat;
- if (CA_FORMAT_APPLICATION_VND_OCF_CBOR == payloadFormat)
+ if (CA_FORMAT_APPLICATION_CBOR == payloadFormat && payloadVersion)
{
- if (!payloadVersion)
- {
- requestInfo.info.payloadVersion = OC_SPEC_VERSION_VALUE;
- }
- else
- {
- requestInfo.info.payloadVersion = payloadVersion;
- }
+ payloadVersion = 0;
}
+ requestInfo.info.payloadVersion = payloadVersion;
+
if ((result =
OCConvertPayload(payload, CAToOCPayloadFormat(requestInfo.info.payloadFormat),
&requestInfo.info.payload, &requestInfo.info.payloadSize))