// This is done automatically during the OCInit process (via the call to OCInitCoAP),
// so ensure that this call is done after that.
const char* OCGetServerInstanceIDString(void);
+
+/**
+ * Map OCQualityOfService to CAMessageType
+ *
+ * @param OCQualityOfService - Input qos.
+ *
+ * Returns CA message type for a given qos.
+ */
+CAMessageType_t qualityOfServiceToMessageType(OCQualityOfService qos);
+
#ifdef WITH_PRESENCE
//TODO: should the following function be public?
OCStackResult OCChangeResourceProperty(OCResourceProperty * inputProperty,
responseEndpoint.addressInfo = serverRequest->addressInfo;
responseEndpoint.connectivityType = serverRequest->connectivityType;
responseEndpoint.isSecured = serverRequest->secured;
-
// Copy the info
switch (ehResponse->ehResult)
{
responseInfo.result = CA_BAD_REQ;
break;
}
-
- switch (serverRequest->qos)
- {
- case OC_LOW_QOS:
- responseInfo.info.type = CA_MSG_NONCONFIRM;
- break;
- case OC_MEDIUM_QOS:
- responseInfo.info.type = CA_MSG_NONCONFIRM;
- break;
- case OC_HIGH_QOS:
- responseInfo.info.type = CA_MSG_CONFIRM;
- break;
- case OC_NA_QOS:
- responseInfo.info.type = CA_MSG_NONCONFIRM;
- break;
- default:
- responseInfo.info.type = CA_MSG_NONCONFIRM;
- break;
- }
-
- responseInfo.info.token = (CAToken_t)OCCalloc(1, CA_MAX_TOKEN_LEN+1);
+ responseInfo.info.type = qualityOfServiceToMessageType(serverRequest->qos);
+ responseInfo.info.token = (CAToken_t) OCCalloc(1, CA_MAX_TOKEN_LEN + 1);
if (!responseInfo.info.token)
{
OC_LOG(FATAL, TAG, "Response Info Token is NULL");