<arg type="x" name="resource" direction="in"/>
<arg type="av" name="notify_msg" direction="in"/>
<arg type="ai" name="observers" direction="in"/>
+ <arg type="i" name="qos" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="sendResponse">
GDBusMethodInvocation *invocation,
gint64 resource,
GVariant *notify_msg,
- GVariant *observers)
+ GVariant *observers,
+ gint qos)
{
int ret;
return TRUE;
}
- ret = icd_ioty_notify(ICD_INT64_TO_POINTER(resource), notify_msg, observers);
+ ret = icd_ioty_notify(ICD_INT64_TO_POINTER(resource), notify_msg, observers, qos);
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_notify() Fail(%d)", ret);
return IOTCON_ERROR_NONE;
}
-int icd_ioty_notify(OCResourceHandle handle, GVariant *msg, GVariant *observers)
+static OCQualityOfService _icd_ioty_convert_qos(gint qos)
+{
+ switch (qos) {
+ case IOTCON_QOS_HIGH:
+ return OC_HIGH_QOS;
+ case IOTCON_QOS_LOW:
+ return OC_LOW_QOS;
+ default:
+ ERR("Invalid value(%d)", qos);
+ return OC_NA_QOS;
+ }
+}
+
+
+int icd_ioty_notify(OCResourceHandle handle, GVariant *msg, GVariant *observers, gint qos)
{
int i, obs_length, msg_length;
GVariant *repr_gvar;
GVariantIter obs_iter, msg_iter;
OCStackResult ret;
- OCRepPayload *payload;
+ OCRepPayload *payload = NULL;
+ OCQualityOfService oc_qos;
g_variant_iter_init(&obs_iter, observers);
obs_length = g_variant_iter_n_children(&obs_iter);
payload = icd_payload_representation_from_gvariant(repr_gvar);
}
+ oc_qos = _icd_ioty_convert_qos(qos);
+
icd_ioty_csdk_lock();
/* TODO : QoS is come from lib. */
if (msg_length)
- ret = OCNotifyListOfObservers(handle, obs_ids, obs_length, payload, OC_LOW_QOS);
+ ret = OCNotifyListOfObservers(handle, obs_ids, obs_length, payload, oc_qos);
else
- ret = OCNotifyAllObservers(handle, OC_LOW_QOS);
+ ret = OCNotifyAllObservers(handle, oc_qos);
icd_ioty_csdk_unlock();
icd_ioty_csdk_lock();
/* TODO : QoS is come from lib. And user can set QoS to client structure. */
result = OCDoResource(NULL, rest_type, uri, &dev_addr, payload, oic_conn_type,
- OC_LOW_QOS, &cbdata, oic_options_ptr, options_size);
+ OC_HIGH_QOS, &cbdata, oic_options_ptr, options_size);
icd_ioty_csdk_unlock();
free(uri);
icd_ioty_csdk_lock();
/* TODO : QoS is come from lib. And user can set QoS to client structure. */
result = OCDoResource(&handle, method, uri_path, dev_addr, NULL, oic_conn_type,
- OC_LOW_QOS, cbdata, oic_options_ptr, options_size);
+ OC_HIGH_QOS, cbdata, oic_options_ptr, options_size);
icd_ioty_csdk_unlock();
if (OC_STACK_OK != result) {
icd_ioty_csdk_lock();
result = OCDoResource(NULL, OC_REST_GET, encap_info->uri_path, &encap_info->dev_addr,
- NULL, encap_info->oic_conn_type, OC_LOW_QOS, &cbdata, NULL, 0);
+ NULL, encap_info->oic_conn_type, OC_HIGH_QOS, &cbdata, NULL, 0);
icd_ioty_csdk_unlock();
if (OC_STACK_OK != result)
int icd_ioty_unbind_resource(OCResourceHandle parent, OCResourceHandle child);
-int icd_ioty_notify(OCResourceHandle handle, GVariant *msg, GVariant *observers);
+int icd_ioty_notify(OCResourceHandle handle, GVariant *msg, GVariant *observers, gint qos);
int icd_ioty_send_response(GVariant *resp);
return;
}
- ret = iotcon_resource_notify(_door_handle, resp_repr, _observers);
+ ret = iotcon_resource_notify(_door_handle, resp_repr, _observers, IOTCON_QOS_HIGH);
if (IOTCON_ERROR_NONE != ret) {
iotcon_representation_destroy(resp_repr);
return;
resource.handle = lite_resource->handle;
resource.sub_id = lite_resource->sub_id;
- ret = iotcon_resource_notify(&resource, NULL, NULL);
+ ret = iotcon_resource_notify(&resource, NULL, NULL, IOTCON_QOS_HIGH);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_resource_notify() Fail(%d)", ret);
return ret;
}
API int iotcon_resource_notify(iotcon_resource_h resource,
- iotcon_representation_h repr, iotcon_observers_h observers)
+ iotcon_representation_h repr, iotcon_observers_h observers, iotcon_qos_e qos)
{
int ret;
GError *error = NULL;
else
obs = icl_dbus_observers_to_gvariant(resource->observers);
- ic_dbus_call_notify_sync(icl_dbus_get_object(), resource->handle, repr_gvar, obs,
+ ic_dbus_call_notify_sync(icl_dbus_get_object(), resource->handle, repr_gvar, obs, qos,
&ret, NULL, &error);
if (error) {
ERR("ic_dbus_call_notify_sync() Fail(%s)", error->message);
IOTCON_REMOTE_RESOURCE_LOST_SIGNAL, /**< Indicates remote resource is lost */
} iotcon_remote_resource_state_e;
+/**
+ * @brief Enumeration for quality of service.
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+ IOTCON_QOS_LOW,
+ IOTCON_QOS_HIGH,
+} iotcon_qos_e;
+
+
/**
* @}
*/
return;
}
...
- ret = iotcon_resource_notify(resource, repr, _observers);
+ ret = iotcon_resource_notify(resource, repr, _observers, IOTCON_QOS_HIGH);
if (IOTCON_ERROR_NONE != ret) {
iotcon_state_destroy(state);
iotcon_representation_destroy(repr);
* @param[in] resource The handle of the resource
* @param[in] repr The handle of the representation
* @param[in] observers The handle of the observers.
+ * @param[in] qos The quality of service for message transfer.
*
* @return 0 on success, otherwise a negative error value.
* @retval #IOTCON_ERROR_NONE Successful
* @see iotcon_observers_remove()
*/
int iotcon_resource_notify(iotcon_resource_h resource, iotcon_representation_h repr,
- iotcon_observers_h observers);
+ iotcon_observers_h observers, iotcon_qos_e qos);
/**
* @brief Gets the number of children resources of the resource
}
/* notify */
- ret = iotcon_resource_notify(door->handle, resp_repr, door->observers);
+ ret = iotcon_resource_notify(door->handle, resp_repr, door->observers, IOTCON_QOS_HIGH);
if (IOTCON_ERROR_NONE != ret)
ERR("iotcon_resource_notify() Fail(%d)", ret);
return G_SOURCE_REMOVE;
}
- ret = iotcon_resource_notify(door->handle, repr, door->observers);
+ ret = iotcon_resource_notify(door->handle, repr, door->observers, IOTCON_QOS_HIGH);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_resource_notify() Fail(%d)", ret);
iotcon_representation_destroy(repr);