-// Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by a apache 2.0 license that can be
-// found in the LICENSE file.
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef __TIZEN_APPFW_CAPABILITY_MANAGER_H__
#define __TIZEN_APPFW_CAPABILITY_MANAGER_H__
*/
/**
- * @brief Enumerations for Capability Manager Errors.
- * @since_tizen 5.0
+ * @brief Enumeration for Capability Manager Errors.
+ * @since_tizen 5.5
*/
typedef enum {
- /**< Successful */
- CAPMGR_ERROR_NONE = TIZEN_ERROR_NONE,
- /**< Invalid parameter */
- CAPMGR_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,
- /**< Out of memory */
- CAPMGR_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,
- /**< Internal I/O error */
- CAPMGR_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR,
+ CAPMGR_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ CAPMGR_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ CAPMGR_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ CAPMGR_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Internal I/O error */
+ CAPMGR_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
} capmgr_error_e;
/**
- * @brief Enumerations for Capability Manager app control result type.
- * @since_tizen 5.0
+ * @brief Enumeration for Capability Manager app control result type.
+ * @since_tizen 5.5
*/
typedef enum {
- CAPMGR_APP_CONTROL_RESULT_OK, /**< Successful */
+ CAPMGR_APP_CONTROL_RESULT_OK, /**< Successful */
} capmgr_app_control_result_e;
/**
* @brief Capability Manager device handle.
- * @since_tizen 5.0
+ * @since_tizen 5.5
*/
typedef struct capmgr_device_s* capmgr_device_h;
/**
* @brief Capability Manager app control handle.
- * @since_tizen 5.0
+ * @since_tizen 5.5
*/
typedef struct capmgr_app_control_s* capmgr_app_control_h;
/**
* @brief Capability Manager application info handle.
- * @since_tizen 5.0
+ * @since_tizen 5.5
*/
-typedef struct capmgr_application_info_s* capmgr_application_info_h;
+typedef struct capmgr_app_info_s* capmgr_app_info_h;
/**
* @brief Called to retrieve information of devices currently discovered.
- * @since_tizen 5.0
+ * @since_tizen 5.5
*
* @remarks The @a device can be used only in the callback. To use outside, make a copy.
* @param[in] device Device handle
* @param[in] user_data The user data to be passed to the callback function
- * @see capmgr_device_foreach_devices()
+ * @see capmgr_device_foreach_device()
*/
typedef int (*capmgr_device_foreach_cb)(const capmgr_device_h device,
void* user_data);
/**
- * @brief Called when send app control request has finished.
- * @since_tizen 5.0
+ * @brief Called when a 'send app control' request has finished.
+ * @since_tizen 5.5
*
* @remarks The @a request, @reply can be used only in the callback. To use outside, make a copy.
- * @param[in] request Capability Manager app control handle contains data to be sent
- * @param[in] reply Capability Manager app control handle which contains
- * reply for request
+ * @param[in] request Capability Manager app control handle which contains data to be sent
+ * @param[in] reply Capability Manager app control handle which contains reply for request
* @param[in] result App control send result
* @param[in] user_data The user data to be passed to the callback function
* @see capmgr_app_control_send()
/**
* @brief Called for each remote application info.
- * @since_tizen 5.0
+ * @since_tizen 5.5
*
* @remarks The @a remote_app_info can be used only in the callback. To use outside, make a copy.
* @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()
+ * @see capmgr_app_info_foreach_application()
+ * @see capmgr_app_info_clone()
*/
-typedef int (*capmgr_application_info_foreach_app_cb)(
- const capmgr_application_info_h remote_app_info, void* user_data);
+typedef int (*capmgr_app_info_foreach_app_cb)(
+ const capmgr_app_info_h remote_app_info, void* user_data);
/**
* @brief Retrieves all remote device info stored on local device.
- * @since_tizen 5.0
+ * @details This function iterates over the Capability Manager enabled devices in the local network.
+ * @since_tizen 5.5
*
* @param[in] cb The callback function to invoke
* @param[in] user_data The user data to be passed to the callback function
* @see capmgr_device_foreach_cb()
*
*/
-int capmgr_device_foreach_devices(capmgr_device_foreach_cb cb,
- void* user_data);
+int capmgr_device_foreach_device(capmgr_device_foreach_cb cb, void* user_data);
/**
- * @brief Clones the remote device information handle.
- * @since_tizen 5.0
+ * @brief Clones the remote device information handle received from capmgr_device_foreach_device().
+ * @since_tizen 5.5
+ *
+ * @remarks You must release @a device_clone using capmgr_device_destroy().
* @param[in] device The remote device handle
* @param[out] device_clone A newly created remote device information handle, if successfully cloned
* @return @c 0 on success,
/**
* @brief Destroys the remote device information handle and releases all its resources.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @param[in] device The remote device 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_device_clone()
- * @see capmgr_device_foreach_devices()
+ * @see capmgr_device_foreach_device()
*/
int capmgr_device_destroy(capmgr_device_h device);
/**
- * @brief Gets the device ID with the given remote device context.
- * @since_tizen 5.0
+ * @brief Gets the device ID of the given remote device context.
+ * @since_tizen 5.5
* @remarks You must release @a device_id using free().
* @param[in] device The remote device information handle
* @param[out] device_id The remote device ID of the given remote device context
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
* @see capmgr_device_clone()
- * @see capmgr_device_foreach_devices()
+ * @see capmgr_device_foreach_device()
*/
int capmgr_device_get_device_id(capmgr_device_h device, char** device_id);
/**
- * @brief Gets the model name with the given remote device context.
- * @since_tizen 5.0
+ * @brief Gets the model name of the given remote device context.
+ * @since_tizen 5.5
* @remarks You must release @a model_name using free().
* @param[in] device The remote device information handle
* @param[out] model_name The model name of the given remote device context
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
* @see capmgr_device_clone()
- * @see capmgr_device_foreach_devices()
+ * @see capmgr_device_foreach_device()
*/
int capmgr_device_get_model_name(capmgr_device_h device, char** model_name);
/**
- * @brief Gets the device name with the given remote device context.
- * @since_tizen 5.0
+ * @brief Gets the device name of the given remote device context.
+ * @since_tizen 5.5
* @remarks You must release @a device_name using free().
* @param[in] device The remote device information handle
* @param[out] device_name The device name of the given remote device context
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
* @see capmgr_device_clone()
- * @see capmgr_device_foreach_devices()
+ * @see capmgr_device_foreach_device()
*/
int capmgr_device_get_device_name(capmgr_device_h device, char** device_name);
/**
- * @brief Gets the platform verion with the given remote device context.
- * @since_tizen 5.0
+ * @brief Gets the platform verion of the given remote device context.
+ * @since_tizen 5.5
* @remarks You must release @a platform_ver using free().
* @param[in] device The remote device information handle
* @param[out] platform_ver The platform version of the given remote device context
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
* @see capmgr_device_clone()
- * @see capmgr_device_foreach_devices()
+ * @see capmgr_device_foreach_device()
*/
int capmgr_device_get_platform_ver(capmgr_device_h device, char** platform_ver);
/**
- * @brief Gets the profile with the given remote device context.
- * @since_tizen 5.0
+ * @brief Gets the profile of the given remote device context.
+ * @since_tizen 5.5
* @remarks You must release @a profile using free().
* @param[in] device The remote device information handle
* @param[out] profile The profile value of the given remote device context
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
* @see capmgr_device_clone()
- * @see capmgr_device_foreach_devices()
+ * @see capmgr_device_foreach_device()
*/
int capmgr_device_get_profile(capmgr_device_h device, char** profile);
/**
- * @brief Gets the software verion with the given remote device context.
- * @since_tizen 5.0
+ * @brief Gets the software verion of the given remote device context.
+ * @since_tizen 5.5
* @remarks You must release @a sw_ver using free().
* @param[in] device The remote device information handle
* @param[out] sw_ver The software version of the given remote device context
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
* @see capmgr_device_clone()
- * @see capmgr_device_foreach_devices()
+ * @see capmgr_device_foreach_device()
*/
int capmgr_device_get_sw_ver(capmgr_device_h device, char** sw_ver);
/**
* @brief Creates a remote app control handle.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a app_control using capmgr_app_control_destroy().
*
* @param[out] app_control The remote app control handle that is newly created on success
/**
* @brief Clones the remote app control handle.
- * @since_tizen 5.0
+ * @since_tizen 5.5
+ * @remarks The newly created app_control should be destroyed by calling the capmgr_app_control_destroy() if it is no longer needed.
* @param[in] app_control The remote app control handle
* @param[out] app_control_clone A newly created remote app control handle, if successfully cloned
* @return @c 0 on success,
/**
* @brief Destroys the remote app control handle and releases all its resources.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @param[in] app_control The remote app control handle
* @return @c 0 on success,
* otherwise a negative error value
/**
* @brief Gets the remote device handle from the given app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a device using capmgr_device_destroy().
* @param[in] app_control The remote app control handle
* @param[out] device The remote device handle
/**
* @brief Gets the operation value from the given remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a operation using free().
* @param[in] app_control The remote app control handle
* @param[out] operation The operation value
/**
* @brief Gets the URI value from the given remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a uri using free().
* @param[in] app_control The remote app control handle
* @param[out] uri The URI value
/**
* @brief Gets the MIME value from the given remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a mime using free().
* @param[in] app_control The remote app control handle
* @param[out] mime The MIME value
/**
* @brief Gets the application ID from the given remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a appid using free().
* @param[in] app_control The remote app control handle
* @param[out] appid The application ID
/**
* @brief Gets the extra data corresponding to given key from remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a value using free().
* @param[in] app_control The remote app control handle
* @param[in] key The key value
/**
* @brief Sets the target remote device to given remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @param[in] app_control The remote app control handle
* @param[in] device The remote device handle to set
* @return @c 0 on success,
/**
* @brief Sets the operation value to given remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @param[in] app_control The remote app control handle
* @param[in] operation The operation value to set
* @return @c 0 on success,
/**
* @brief Sets the URI value to given remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @param[in] app_control The remote app control handle
* @param[in] uri The URI value to set
* @return @c 0 on success,
/**
* @brief Sets the MIME value to given remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @param[in] app_control The remote app control handle
* @param[in] mime The MIME value to set
* @return @c 0 on success,
/**
* @brief Sets the application ID to given remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @param[in] app_control The remote app control handle
* @param[in] appid The application ID to set
* @return @c 0 on success,
/**
* @brief Sets the extra data to given remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @param[in] app_control The remote app control handle
* @param[in] key The key of extra data to set
* @param[in] value The value corresponding to key.
/**
* @brief Removes the extra data corresponding to given key at remote app control context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @param[in] app_control The remote app control handle
* @param[in] key The key of extra data to remove
* @return @c 0 on success,
/**
* @brief Sends the app control to remote device specified at handle.
- * @since_tizen 5.0
+ * @remark The remote app should declare %http://tizen.org/privilege/d2d.remotelaunch privilege for receive.
+ * @since_tizen 5.5
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/d2d.datasharing
+ * @privilege %http://tizen.org/privilege/appmanager.launch
* @param[in] app_control The remote app control handle
* @param[in] cb Callback to be invoked when send has done
* @param[in] user_data The user data to be passed to the callback function
* @retval #CAPMGR_ERROR_NONE Successful
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #CAPMGR_ERROR_PERMISSION_DENIED Permission denied
*/
int capmgr_app_control_send(capmgr_app_control_h app_control,
capmgr_app_control_reply_cb cb, void* user_data);
/**
- * @brief Retrieves all applications installed at specified remote device and invoke callback each of it.
- * @since_tizen 5.0
+ * @brief Retrieves all applications installed on the specified remote device and invokes the callback each of them.
+ * @since_tizen 5.5
* @param[in] device The remote device handle
* @param[in] cb Callback to be invoked for each application
* @param[in] user_data The user data to be passed to the callback function
* @retval #CAPMGR_ERROR_IO_ERROR I/O error
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
*/
-int capmgr_application_info_foreach_applications(
+int capmgr_app_info_foreach_application(
const capmgr_device_h device,
- capmgr_application_info_foreach_app_cb cb,
+ capmgr_app_info_foreach_app_cb cb,
void* user_data);
/**
* @brief Clones the remote application information handle.
- * @since_tizen 5.0
+ * @since_tizen 5.5
+ * @remarks The newly created app_info should be destroyed by calling the capmgr_app_info_destroy() if it is no longer needed.
* @param[in] remote_app_info The remote application info handle
* @param[out] remote_app_info_clone A newly created remote application information handle, if successfully cloned
* @return @c 0 on success,
* @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()
+ * @see capmgr_app_info_destroy()
*/
-int capmgr_application_info_clone(
- const capmgr_application_info_h remote_app_info,
- capmgr_application_info_h* remote_app_info_clone);
+int capmgr_app_info_clone(
+ const capmgr_app_info_h remote_app_info,
+ capmgr_app_info_h* remote_app_info_clone);
/**
* @brief Gets the application ID from given remote application information.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a appid using free().
- * @param[in] remote_app_info The application information installed at specific remote device
+ * @param[in] remote_app_info The application information installed on the specific remote device
* @param[out] appid The application ID
* @return @c 0 on success,
* otherwise a negative error value
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
*/
-int capmgr_application_info_get_appid(capmgr_application_info_h remote_app_info,
+int capmgr_app_info_get_appid(capmgr_app_info_h remote_app_info,
char** appid);
/**
* @brief Gets the package ID from given remote application information.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a pkgid using free().
- * @param[in] remote_app_info The application information installed at specific remote device
+ * @param[in] remote_app_info The application information installed on the specific remote device
* @param[out] pkgid The package ID
* @return @c 0 on success,
* otherwise a negative error value
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
*/
-int capmgr_application_info_get_pkgid(capmgr_application_info_h remote_app_info,
+int capmgr_app_info_get_pkgid(capmgr_app_info_h remote_app_info,
char** pkgid);
/**
* @brief Gets the label from given remote application information.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a label using free().
- * @param[in] remote_app_info The application information installed at specific remote device
+ * @param[in] remote_app_info The application information installed on the specific remote device
* @param[out] label The label of application
* @return @c 0 on success,
* otherwise a negative error value
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
*/
-int capmgr_application_info_get_label(capmgr_application_info_h remote_app_info,
+int capmgr_app_info_get_label(capmgr_app_info_h remote_app_info,
char** label);
/**
* @brief Gets the version from given remote application information.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a version using free().
- * @param[in] remote_app_info The application information installed at specific remote device
+ * @param[in] remote_app_info The application information installed on the specific remote device
* @param[out] version The version of application
* @return @c 0 on success,
* otherwise a negative error value
* @retval #CAPMGR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAPMGR_ERROR_OUT_OF_MEMORY Out of memory
*/
-int capmgr_application_info_get_version(
- capmgr_application_info_h remote_app_info, char** version);
+int capmgr_app_info_get_version(
+ capmgr_app_info_h remote_app_info, char** version);
/**
* @brief Gets the remote device handle from the given remote application info context.
- * @since_tizen 5.0
+ * @since_tizen 5.5
* @remarks You must release @a device using capmgr_device_destroy().
- * @param[in] remote_app_info The application information installed at specific remote device
+ * @param[in] remote_app_info The application information installed on the specific remote device
* @param[out] device The remote device handle
* @return @c 0 on success,
* otherwise a negative error value
* @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);
+int capmgr_app_info_get_device(
+ capmgr_app_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
+ * @since_tizen 5.5
* @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()
+ * @see capmgr_app_info_clone()
*/
-int capmgr_application_info_destroy(capmgr_application_info_h remote_app_info);
+int capmgr_app_info_destroy(capmgr_app_info_h remote_app_info);
#ifdef __cplusplus
}
bundle* b;
};
-struct capmgr_application_info_s {
+struct capmgr_app_info_s {
std::string appid;
std::string pkgid;
std::string label;
capmgr_device_h device;
};
-API int capmgr_device_foreach_devices(capmgr_device_foreach_cb cb,
+API int capmgr_device_foreach_device(capmgr_device_foreach_cb cb,
void* user_data) {
if (!cb)
return CAPMGR_ERROR_INVALID_PARAMETER;
return CAPMGR_ERROR_NONE;
}
-API int capmgr_application_info_clone(
- const capmgr_application_info_h remote_app_info,
- capmgr_application_info_h* remote_app_info_clone) {
+API int capmgr_app_info_clone(
+ const capmgr_app_info_h remote_app_info,
+ capmgr_app_info_h* remote_app_info_clone) {
if (!remote_app_info || !remote_app_info_clone)
return CAPMGR_ERROR_INVALID_PARAMETER;
- struct capmgr_application_info_s* clone;
+ struct capmgr_app_info_s* clone;
try {
- clone = new struct capmgr_application_info_s();
+ clone = new struct capmgr_app_info_s();
} catch (const std::bad_alloc& e) {
LOG(ERROR) << e.what();
return CAPMGR_ERROR_OUT_OF_MEMORY;
return CAPMGR_ERROR_NONE;
}
-API int capmgr_application_info_destroy(
- capmgr_application_info_h remote_app_info) {
+API int capmgr_app_info_destroy(
+ capmgr_app_info_h remote_app_info) {
if (!remote_app_info)
return CAPMGR_ERROR_INVALID_PARAMETER;
return CAPMGR_ERROR_NONE;
}
-API int capmgr_application_info_get_appid(
- capmgr_application_info_h remote_app_info, char** appid) {
+API int capmgr_app_info_get_appid(
+ capmgr_app_info_h remote_app_info, char** appid) {
if (!remote_app_info || !appid || remote_app_info->appid.empty())
return CAPMGR_ERROR_INVALID_PARAMETER;
return CAPMGR_ERROR_NONE;
}
-API int capmgr_application_info_get_pkgid(
- capmgr_application_info_h remote_app_info, char** pkgid) {
+API int capmgr_app_info_get_pkgid(
+ capmgr_app_info_h remote_app_info, char** pkgid) {
if (!remote_app_info || !pkgid || remote_app_info->pkgid.empty())
return CAPMGR_ERROR_INVALID_PARAMETER;
return CAPMGR_ERROR_NONE;
}
-API int capmgr_application_info_get_label(
- capmgr_application_info_h remote_app_info, char** label) {
+API int capmgr_app_info_get_label(
+ capmgr_app_info_h remote_app_info, char** label) {
if (!remote_app_info || !label || remote_app_info->label.empty())
return CAPMGR_ERROR_INVALID_PARAMETER;
return CAPMGR_ERROR_NONE;
}
-API int capmgr_application_info_get_version(
- capmgr_application_info_h remote_app_info, char** version) {
+API int capmgr_app_info_get_version(
+ capmgr_app_info_h remote_app_info, char** version) {
if (!remote_app_info || !version || remote_app_info->version.empty())
return CAPMGR_ERROR_INVALID_PARAMETER;
return CAPMGR_ERROR_NONE;
}
-API int capmgr_application_info_get_device(
- capmgr_application_info_h remote_app_info,
+API int capmgr_app_info_get_device(
+ capmgr_app_info_h remote_app_info,
capmgr_device_h* device) {
if (!remote_app_info || !device)
return CAPMGR_ERROR_INVALID_PARAMETER;
return CAPMGR_ERROR_NONE;
}
-API int capmgr_application_info_foreach_applications(
+API int capmgr_app_info_foreach_application(
const capmgr_device_h device,
- capmgr_application_info_foreach_app_cb cb,
+ capmgr_app_info_foreach_app_cb cb,
void* user_data) {
if (!device || !cb)
return CAPMGR_ERROR_INVALID_PARAMETER;
if (stmt->BindString(1, device->device_id)) {
while (stmt->Step() == capmgr::SQLStatement::StepResult::ROW) {
- struct capmgr_application_info_s info;
+ struct capmgr_app_info_s info;
int idx = 0;
info.appid = stmt->GetColumnString(idx++);
info.pkgid = stmt->GetColumnString(idx++);
}
int ApplicationForeachCbForSetup(
- const capmgr_application_info_h remote_app_info, void* user_data) {
- capmgr_application_info_h* clone =
- reinterpret_cast<capmgr_application_info_h*>(user_data);
- int ret = capmgr_application_info_clone(remote_app_info, clone);
+ const capmgr_app_info_h remote_app_info, void* user_data) {
+ capmgr_app_info_h* clone =
+ reinterpret_cast<capmgr_app_info_h*>(user_data);
+ int ret = capmgr_app_info_clone(remote_app_info, clone);
if (ret != CAPMGR_ERROR_NONE)
return 0;
// use the first app
return 1;
}
-int ApplicationForeachCb(const capmgr_application_info_h remote_app_info,
+int ApplicationForeachCb(const capmgr_app_info_h remote_app_info,
void* user_data) {
bool* is_hit = reinterpret_cast<bool*>(user_data);
*is_hit = true;
char* appid;
- capmgr_application_info_get_appid(remote_app_info, &appid);
+ capmgr_app_info_get_appid(remote_app_info, &appid);
free(appid);
LOG(INFO) << appid;
return 0;
TestEnvironment() : device_(nullptr), app_control_(nullptr),
app_(nullptr) {}
void SetUp() override {
- ASSERT_EQ(capmgr_device_foreach_devices(DeviceForeachCbForSetup, &device_),
+ ASSERT_EQ(capmgr_device_foreach_device(DeviceForeachCbForSetup, &device_),
CAPMGR_ERROR_NONE) << "Failed to init test environment!";
ASSERT_NE(device_, nullptr);
char* device_id;
CAPMGR_ERROR_NONE);
ASSERT_EQ(capmgr_app_control_add_extra_data(app_control_, kExtraDataKeyStr,
kExtraDataValueStr), CAPMGR_ERROR_NONE);
- ASSERT_EQ(capmgr_application_info_foreach_applications(device_,
+ ASSERT_EQ(capmgr_app_info_foreach_application(device_,
ApplicationForeachCbForSetup, &app_), CAPMGR_ERROR_NONE);
}
void TearDown() override {
- capmgr_application_info_destroy(app_);
+ capmgr_app_info_destroy(app_);
capmgr_app_control_destroy(app_control_);
capmgr_device_destroy(device_);
}
capmgr_device_h device_;
capmgr_app_control_h app_control_;
- capmgr_application_info_h app_;
+ capmgr_app_info_h app_;
};
TestEnvironment* env = nullptr;
TEST_F(UnitTest, DeviceForeachDevicesPositiveTest) {
bool is_hit = false;
- ASSERT_EQ(capmgr_device_foreach_devices(DeviceForeachCb, &is_hit),
+ ASSERT_EQ(capmgr_device_foreach_device(DeviceForeachCb, &is_hit),
CAPMGR_ERROR_NONE);
ASSERT_TRUE(is_hit);
}
TEST_F(UnitTest, DeviceForeachDevicesNegativeTest) {
- ASSERT_EQ(capmgr_device_foreach_devices(nullptr, nullptr),
+ ASSERT_EQ(capmgr_device_foreach_device(nullptr, nullptr),
CAPMGR_ERROR_INVALID_PARAMETER);
}
}
*/
-TEST_F(UnitTest, ApplicationInfoForeachPackagesPositiveTest) {
+TEST_F(UnitTest, AppInfoForeachPackagesPositiveTest) {
bool is_hit = false;
- ASSERT_EQ(capmgr_application_info_foreach_applications(env->device_,
+ ASSERT_EQ(capmgr_app_info_foreach_application(env->device_,
ApplicationForeachCb, &is_hit), CAPMGR_ERROR_NONE);
ASSERT_TRUE(is_hit);
}
-TEST_F(UnitTest, ApplicationInfoForeachPackagesNegativeTest) {
- ASSERT_EQ(capmgr_application_info_foreach_applications(nullptr,
+TEST_F(UnitTest, AppInfoForeachPackagesNegativeTest) {
+ ASSERT_EQ(capmgr_app_info_foreach_application(nullptr,
ApplicationForeachCb, nullptr), CAPMGR_ERROR_INVALID_PARAMETER);
- ASSERT_EQ(capmgr_application_info_foreach_applications(env->device_,
+ ASSERT_EQ(capmgr_app_info_foreach_application(env->device_,
nullptr, nullptr), CAPMGR_ERROR_INVALID_PARAMETER);
}
-#define APPLICATION_INFO_GET_TEST_BLOCK( \
+#define APP_INFO_GET_TEST_BLOCK( \
POSITIVE_TESTNAME, NEGATIVE_TESTNAME, ATTR) \
TEST_F(UnitTest, POSITIVE_TESTNAME) { \
char* ATTR = nullptr; \
- ASSERT_EQ(capmgr_application_info_get_##ATTR(env->app_, &ATTR), \
+ ASSERT_EQ(capmgr_app_info_get_##ATTR(env->app_, &ATTR), \
CAPMGR_ERROR_NONE); \
ASSERT_NE(ATTR, nullptr); \
free(ATTR); \
\
TEST_F(UnitTest, NEGATIVE_TESTNAME) { \
char* ATTR; \
- ASSERT_EQ(capmgr_application_info_get_##ATTR(nullptr, &ATTR), \
+ ASSERT_EQ(capmgr_app_info_get_##ATTR(nullptr, &ATTR), \
CAPMGR_ERROR_INVALID_PARAMETER); \
- ASSERT_EQ(capmgr_application_info_get_##ATTR(env->app_, nullptr), \
+ ASSERT_EQ(capmgr_app_info_get_##ATTR(env->app_, nullptr), \
CAPMGR_ERROR_INVALID_PARAMETER); \
} \
-APPLICATION_INFO_GET_TEST_BLOCK(ApplicationInfoGetAppidPositiveTest,
- ApplicationInfoGetAppidNegativeTest, appid)
+APP_INFO_GET_TEST_BLOCK(AppInfoGetAppidPositiveTest,
+ AppInfoGetAppidNegativeTest, appid)
-APPLICATION_INFO_GET_TEST_BLOCK(ApplicationInfoGetPkgidPositiveTest,
- ApplicationInfoGetPkgidNegativeTest, pkgid)
+APP_INFO_GET_TEST_BLOCK(AppInfoGetPkgidPositiveTest,
+ AppInfoGetPkgidNegativeTest, pkgid)
-APPLICATION_INFO_GET_TEST_BLOCK(ApplicationInfoGetLabelPositiveTest,
- ApplicationInfoGetLabelNegativeTest, label)
+APP_INFO_GET_TEST_BLOCK(AppInfoGetLabelPositiveTest,
+ AppInfoGetLabelNegativeTest, label)
-APPLICATION_INFO_GET_TEST_BLOCK(ApplicationInfoGetVersionPositiveTest,
- ApplicationInfoGetVersionNegativeTest, version)
+APP_INFO_GET_TEST_BLOCK(AppInfoGetVersionPositiveTest,
+ AppInfoGetVersionNegativeTest, version)
} // namespace capmgr