* @param[in] remote_app_info Capability Manager Application Info handle
* @param[in] user_data The user data to be passed to the callback function
* @see capmgr_application_info_foreach_applications()
+ * @see capmgr_application_info_clone()
*/
typedef int (*capmgr_application_info_foreach_app_cb)(
const capmgr_application_info_h remote_app_info, void* user_data);
* @retval #CAPMGR_ERROR_NONE Successful
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
+ * @see capmgr_application_info_destroy()
*/
int capmgr_application_info_clone(
const capmgr_application_info_h remote_app_info,
int capmgr_application_info_get_version(
capmgr_application_info_h remote_app_info, char** version);
+/**
+ * @brief Gets the remote device handle from the given remote application info context.
+ * @since_tizen 5.0
+ * @remarks You must release @a device using capmgr_device_destroy().
+ * @param[in] remote_app_info The application information installed at specific remote device
+ * @param[out] device The remote device handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #CAPMGR_ERROR_NONE Successful
+ * @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int capmgr_application_info_get_device(
+ capmgr_application_info_h remote_app_info, capmgr_device_h* device);
+
+/**
+ * @brief Destroys the remote application information handle and releases all its resources.
+ * @since_tizen 5.0
+ * @param[in] remote_app_info The remote application information handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #CAPMGR_ERROR_NONE Successful
+ * @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see capmgr_application_info_clone()
+ */
+int capmgr_application_info_destroy(capmgr_application_info_h remote_app_info);
+
#ifdef __cplusplus
}
#endif
std::string pkgid;
std::string label;
std::string version;
+ capmgr_device_h device;
};
API int capmgr_device_foreach_devices(capmgr_device_foreach_cb cb,
clone->label = remote_app_info->label;
clone->version = remote_app_info->version;
+ int ret = capmgr_device_clone(remote_app_info->device, &(clone->device));
+ if (ret != CAPMGR_ERROR_NONE) {
+ LOG(ERROR) << "Failed to clone capmgr device";
+ delete clone;
+ return ret;
+ }
+
*remote_app_info_clone = clone;
return CAPMGR_ERROR_NONE;
}
+API int capmgr_application_info_destroy(
+ capmgr_application_info_h remote_app_info) {
+ if (!remote_app_info)
+ return CAPMGR_ERROR_INVALID_PARAMETER;
+
+ capmgr_device_destroy(remote_app_info->device);
+ delete remote_app_info;
+
+ return CAPMGR_ERROR_NONE;
+}
+
API int capmgr_application_info_get_appid(
capmgr_application_info_h remote_app_info, char** appid) {
if (!remote_app_info || !appid || remote_app_info->appid.empty())
return CAPMGR_ERROR_NONE;
}
+API int capmgr_application_info_get_device(
+ capmgr_application_info_h remote_app_info,
+ capmgr_device_h* device) {
+ if (!remote_app_info || !device)
+ return CAPMGR_ERROR_INVALID_PARAMETER;
+
+ int ret = capmgr_device_clone(remote_app_info->device, device);
+ if (ret != CAPMGR_ERROR_NONE)
+ return ret;
+
+ return CAPMGR_ERROR_NONE;
+}
+
API int capmgr_application_info_foreach_applications(
const capmgr_device_h device,
capmgr_application_info_foreach_app_cb cb,
info.pkgid = stmt->GetColumnString(idx++);
info.label = stmt->GetColumnString(idx++);
info.version = stmt->GetColumnString(idx++);
+ info.device = device;
if (cb(&info, user_data))
break;
}
char* pkgid = nullptr;
char* label = nullptr;
char* ver = nullptr;
+ capmgr_device_h device = nullptr;
+ char* device_id = nullptr;
int ret = capmgr_application_info_get_appid(remote_app_info, &appid);
if (ret != CAPMGR_ERROR_NONE)
if (ret != CAPMGR_ERROR_NONE)
std::cout << "Failed to get pkgid" << std::endl;
+ ret = capmgr_application_info_get_device(remote_app_info, &device);
+ if (ret != CAPMGR_ERROR_NONE)
+ std::cout << "Failed to get device" << std::endl;
+
std::cout << "==============================================" << std::endl;
+
+ ret = capmgr_device_get_device_id(device, &device_id);
+ if (ret != CAPMGR_ERROR_NONE)
+ std::cout << "Failed to get device id" << std::endl;
+
try {
std::cout << "APPID: " << std::string(appid) << std::endl
<< "PKGID: " << std::string(pkgid) << std::endl
<< "Label: " << std::string(label) << std::endl
- << "Version: " << std::string(ver) << std::endl;
+ << "Version: " << std::string(ver) << std::endl
+ << "Device ID: " << std::string(device_id) << std::endl;
} catch (...) {
std::cout << "Exception occured" << std::endl;
}
free(pkgid);
free(label);
free(ver);
+ capmgr_device_destroy(device);
return 0;
}