3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #ifndef DEVICE_MANAGER_PLUGIN_H_
19 #define DEVICE_MANAGER_PLUGIN_H_
25 #include "device-manager/mdm_type.h"
26 #include "device-manager/mdm_error.h"
27 #include "device-manager/mdm_control_code.h"
30 * @file device_manager_plugin.h
31 * @brief Provides function pointer manipulate operation for device manager module
34 /** @addtogroup plugin
39 * @brief Maximum number of device-manager plugin
41 #define PLUGIN_MAX_DEVICE_MANAGER 1
44 * @brief Prototype of plugin function for registering client to the service
45 * @param[in] pkg_name client package name
46 * @return SYNC_AGENT_DM_MDM_SUCCEEDED on success, otherwise error
48 typedef sync_agent_dm_mdm_return_e(*plugin_start_service_cb) (char *pkg_name);
51 * @brief Prototype of plugin function for deregistering client to the service
52 * @param[in] pkg_name client package name
53 * @return SYNC_AGENT_DM_MDM_SUCCEEDED on success, otherwise error
55 typedef sync_agent_dm_mdm_return_e(*plugin_stop_service_cb) (char *pkg_name);
58 * @brief Prototype of plugin function for setting user value to the service
59 * @param[in] ctrl item that user want to set
60 * @param[in] va user value
61 * @return SYNC_AGENT_DM_MDM_SUCCEEDED on success, otherwise error
63 typedef sync_agent_dm_mdm_return_e(*plugin_set_device_manager_value_cb) (sync_agent_dm_mdm_ctrl_e ctrl, va_list va);
66 * @brief Prototype of plugin function for getting value that user want to know
67 * @param[in] ctrl item that user want to know
68 * @param[in] va as returned by plugin_get_device_manager_value_cb - service value
69 * @return SYNC_AGENT_DM_MDM_SUCCEEDED on success, otherwise error
71 typedef sync_agent_dm_mdm_return_e(*plugin_get_device_manager_value_cb) (sync_agent_dm_mdm_ctrl_e ctrl, va_list va);
74 * @brief Prototype of plugin function for executing service that user want to do
75 * @param[in] ctrl item that user want to execute
76 * @param[in] va user value
77 * @return SYNC_AGENT_DM_MDM_SUCCEEDED on success, otherwise error
79 typedef sync_agent_dm_mdm_return_e(*plugin_execute_device_manager_cb) (sync_agent_dm_mdm_ctrl_e ctrl, va_list va);
82 * @brief Prototype of plugin function for registering user callback function for each service event
83 * @remarks not supported api
84 * @param[in] event service event
85 * @param[in] callback user callback function
86 * @param[in] user_data additional user data
87 * @return SYNC_AGENT_DM_MDM_SUCCEEDED on success, otherwise error
89 typedef int (*plugin_register_device_manager_callback_cb) (sync_agent_dm_mdm_event_e event, sync_agent_device_manager_cb callback, void *user_data);
92 * @brief Prototype of plugin function for deregistering user callback function that was previously registered to the service
93 * @remarks not supported api
95 * @return SYNC_AGENT_DM_MDM_SUCCEEDED on success, otherwise error
97 typedef sync_agent_dm_mdm_return_e(*plugin_deregister_device_manager_callback_cb) (int handle);
100 * @brief Structure for device-manager plugin function pointer set
103 plugin_start_service_cb func_start_service; /**< function pointer of plugin_start_service_cb */
104 plugin_stop_service_cb func_stop_service; /**< function pointer of plugin_stop_service_cb */
105 plugin_set_device_manager_value_cb func_set_device_manager_value; /**< function pointer of plugin_set_device_manager_value_cb */
106 plugin_get_device_manager_value_cb func_get_device_manager_value; /**< function pointer of plugin_get_device_manager_value_cb */
107 plugin_execute_device_manager_cb func_execute_device_manager; /**< function pointer of plugin_execute_device_manager_cb */
108 plugin_register_device_manager_callback_cb func_register_device_manager_callback; /**< function pointer of plugin_register_device_manager_callback_cb */
109 plugin_deregister_device_manager_callback_cb func_deregister_device_manager_callback; /**< function pointer of plugin_deregister_device_manager_callback_cb */
110 } plugin_device_manager_func_set_s;
113 * @brief Structure for device-manager plugin management
116 plugin_info_s plugin_info; /**< plugin info */
117 plugin_device_manager_func_set_s func_set; /**< device-manager plugin function pointer set */
118 } plugin_device_manager_s;
121 * @brief Get device-manager plugin function pointer set
122 * @param[in] plugin_handle handle of device-manager plugin (result of dlopen for device-manager plugin)
123 * @param[in] error_code as returned by plugin_get_device_manager_func_set() - plugin error
124 * @return plugin_device_manager_func_set_s instance
126 plugin_device_manager_func_set_s plugin_get_device_manager_func_set(void *plugin_handle, plugin_error_e * error_code);
129 * @brief Register device-manager plugin instance to the device-manager plugin repository being maintained as a singleton
130 * @param[in] plugin plugin_device_manager_s instance
131 * @return PLUGIN_SUCCESS on success, otherwise on error
133 plugin_error_e plugin_register_plugin_device_manager(plugin_device_manager_s plugin);
136 * @brief Clear device-manager plugin repository being maintained as a singleton
138 void plugin_clear_plugin_device_manager();
141 * @brief Get device-manager plugin repository
142 * @param[in] count as returned by plugin_get_device_manager_plugin_repository() - the number of device-manager plugin
143 * @return device-manager plugin repository being maintained as a singleton
145 const plugin_device_manager_s *plugin_get_device_manager_plugin_repository(int *count);
148 * @brief Get function pointer of plugin_start_service_cb
149 * @param[in] plugin_id device-manager plugin id
150 * @return function pointer of plugin_start_service_cb on success, NULL on error
152 plugin_start_service_cb plugin_get_function_start_service(int plugin_id);
155 * @brief Get function pointer of plugin_stop_service_cb
156 * @param[in] plugin_id device-manager plugin id
157 * @return function pointer of plugin_stop_service_cb on success, NULL on error
159 plugin_stop_service_cb plugin_get_function_stop_service(int plugin_id);
162 * @brief Get function pointer of plugin_set_device_manager_value_cb
163 * @param[in] plugin_id device-manager plugin id
164 * @return function pointer of plugin_set_device_manager_value_cb on success, NULL on error
166 plugin_set_device_manager_value_cb plugin_get_function_set_device_manager_value(int plugin_id);
169 * @brief Get function pointer of plugin_get_device_manager_value_cb
170 * @param[in] plugin_id device-manager plugin id
171 * @return function pointer of plugin_get_device_manager_value_cb on success, NULL on error
173 plugin_get_device_manager_value_cb plugin_get_function_get_device_manager_value(int plugin_id);
176 * @brief Get function pointer of plugin_execute_device_manager_cb
177 * @param[in] plugin_id device-manager plugin id
178 * @return function pointer of plugin_execute_device_manager_cb on success, NULL on error
180 plugin_execute_device_manager_cb plugin_get_function_execute_device_manager(int plugin_id);
183 * @brief Get function pointer of plugin_device_manager_register_callback_cb
184 * @param[in] plugin_id device-manager plugin id
185 * @return function pointer of plugin_device_manager_register_callback_cb on success, NULL on error
187 plugin_register_device_manager_callback_cb plugin_get_function_register_device_manager_callback(int plugin_id);
190 * @brief Get function pointer of plugin_device_manager_deregister_callback_cb
191 * @param[in] plugin_id device-manager plugin id
192 * @return function pointer of plugin_device_manager_deregister_callback_cb on success, NULL on error
194 plugin_deregister_device_manager_callback_cb plugin_get_function_deregister_device_manager_callback(int plugin_id);
200 #endif /* DEVICE_MANAGER_PLUGIN_H_ */