COMP_ERROR_ALREADY_IN_PROGRESS = TIZEN_ERROR_COMP | 0x05, /**< Operation now in progress */
COMP_ERROR_ALREADY_INITIALIZED = TIZEN_ERROR_COMP | 0x06, /**< Already initilized */
COMP_ERROR_NO_DATA = TIZEN_ERROR_COMP | 0x07, /**< No Data */
+ COMP_ERROR_NOT_STARTED = TIZEN_ERROR_COMP | 0x08, /**< Not Started */
COMP_ERROR_UNKNOWN = -999,
} comp_error_e;
} companion_device_type_e;
/**
+ * @brief Device Status.
+ *
+ * @since_tizen 5.0
+ */
+typedef enum {
+ COMPANION_DEVICE_ADDED = 0, /**< Device Added */
+ COMPANION_DEVICE_REMOVED = 1, /**< Device Removed */
+} companion_device_status_e;
+
+/**
* @brief Called after companion_device_find().
* @details This function can receive a device found.
*
typedef void (*companion_device_send_data_finish_cb)(int result, char *resp_data,
void *user_data);
+/**
+ * @brief Callback function pointer to be regsitered after enabling device
+ * monitor
+ *
+ * @since_tizen 5.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @remarks The @a uuid, @arg should not be released.
+ * @remarks The @a uuid, @arg can be used only in the callback. To use outside, make a copy.
+ * @remarks The @a group_name, @arg should not be released.
+ * @remarks The @a group_name, @arg can be used only in the callback. To use outside, make a copy.
+ *
+ * @param[out] uuid Device ID
+ * @param[out] group_name Group name
+ * @param[out] status Device Status
+ * @param[out] user_data User data pointer
+ *
+ * @pre The callback must be registered with companion_request_result_callback()
+ *
+ * @see companion_device_monitor_start()
+ */
+typedef void (*companion_device_monitor_result_cb)(char *uuid, char *group_name,
+ companion_device_status_e status, void *user_data);
/**
* @brief Finds candidate devices to include my groups in the network.
int companion_device_information_get_model_name(companion_device_h device,
char **model_name);
+int companion_device_monitor_start(companion_h handle,
+ companion_device_monitor_result_cb cb, void *user_data);
+
+int companion_device_monitor_stop(companion_h handle);
+
/**
* @}
*/
return ret;
}
+
+EXPORT_API int companion_device_monitor_start(companion_h handle,
+ companion_device_monitor_result_cb cb, void *user_data)
+{
+ int ret = COMP_ERROR_NONE;
+ GError *error = NULL;
+
+ CHECK_FEATURE_SUPPORTED(COMPANION_FEATURE);
+
+ comp_manager_s *_handle = handle;
+ companion_check_null_ret_error("handle", handle,
+ COMP_ERROR_INVALID_PARAMETER);
+
+ group_call_start_invited_device_monitor_sync(_handle->group_proxy, 1, &ret,
+ NULL, &error);
+ if (ret != COMP_ERROR_NONE) {
+ _ERR("Failed to start monitor");
+ return ret;
+ }
+
+ _handle->monitor_result_cb.cb = cb;
+ _handle->monitor_result_cb.user_data = user_data;
+
+ return ret;
+}
+
+EXPORT_API int companion_device_monitor_stop(companion_h handle)
+{
+ int ret = COMP_ERROR_NONE;
+ GError *error = NULL;
+
+ CHECK_FEATURE_SUPPORTED(COMPANION_FEATURE);
+
+ comp_manager_s *_handle = handle;
+ companion_check_null_ret_error("handle", handle,
+ COMP_ERROR_INVALID_PARAMETER);
+
+ if (_handle->monitor_result_cb.cb == NULL) {
+ _ERR("Monitor is not started");
+ return COMP_ERROR_NOT_STARTED;
+ }
+
+ group_call_start_invited_device_monitor_sync(_handle->group_proxy, 0, &ret,
+ NULL, &error);
+ if (ret != COMP_ERROR_NONE) {
+ _ERR("Failed to stop monitor");
+ return ret;
+ }
+
+ _handle->monitor_result_cb.cb = NULL;
+ _handle->monitor_result_cb.user_data = NULL;
+
+ return ret;
+}
<arg type="s" name="group_name" direction="in" />
<arg type="i" name="result" direction="out" />
</method>
+ <method name="StartInvitedDeviceMonitor">
+ <arg type="i" name="start" direction="in" />
+ <arg type="i" name="result" direction="out" />
+ </method>
<!-- Signal (D-Bus) definitions -->
<signal name="GroupFound">
<arg type="a{sv}" name="group_info" direction="out" />
<arg type="(iay)" name="arg" direction="out" />
<arg type="i" name="result" direction="out" />
</signal>
+ <signal name="DeviceMonitorResult">
+ <arg type="s" name="uuid" direct="out" />
+ <arg type="s" name="group_name" direct="out" />
+ <arg type="s" name="status" direct="out" />
+ </signal>
</interface>
</node>
} request_result_cb_t;
/**
+ * @brief Sending device monitor result callback structure
+ * @since_tizen 5.0
+ */
+typedef struct _monitor_result_cb_t {
+ companion_device_monitor_result_cb cb; /**< User callback to be called */
+ void *user_data; /**< User data pointer */
+} monitor_result_cb_t;
+
+/**
* @brief The companion-manager context
* @since_tizen 5.0
*/
device_eject_result_cb_t device_eject_result_cb; /**< When it called after ejecting the device done or timeout */
send_data_finish_cb_t send_data_finish_cb; /**< When it called after sending the device done or timeout */
request_result_cb_t request_result_cb; /**< When it called after sending private commands or timeout */
+ monitor_result_cb_t monitor_result_cb; /**< It is called after device status is changed */
} comp_manager_s;
/**