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.
20 #include "utility/sync_util.h"
21 #include "device/information.h"
22 #include "device/information_internal.h"
23 #include "plugin/device_info_plugin.h"
26 #define EXPORT_API __attribute__ ((visibility("default")))
29 #ifndef SYNC_AGENT_LOG
31 #define LOG_TAG "AF_DCI"
34 sync_agent_dev_return_e dev_init_dev(int device_plugin_id)
38 sync_agent_dev_return_e res = SYNC_AGENT_DEV_RETURN_SUCCESS;
40 _DEBUG_INFO("[%s] plug-in id : %d\n", __func__, device_plugin_id);
42 plugin_load_devinfo_cb func_point_load_dev_info = plugin_get_function_load_devinfo(device_plugin_id);
44 retvm_if(func_point_load_dev_info == NULL, SYNC_AGENT_DEV_RETURN_FAIL, "cannot get plugin_load_devinfo_cb !!");
46 int err = func_point_load_dev_info();
48 _DEBUG_INFO("[%s] fail !!\n", __func__);
49 res = SYNC_AGENT_DEV_RETURN_FAIL;
51 _DEBUG_INFO("[%s] success !! \n", __func__);
59 EXPORT_API sync_agent_dev_return_e sync_agent_get_devinfo(int device_plugin_id, char *info_name, char **value)
63 sync_agent_dev_return_e res = SYNC_AGENT_DEV_RETURN_SUCCESS;
65 if (info_name == NULL || !strcmp(info_name, ""))
66 return SYNC_AGENT_DEV_RETURN_FAIL;
68 plugin_get_devinfo_cb func_point_get_devInfo = plugin_get_function_get_devinfo(device_plugin_id);
70 retvm_if(func_point_get_devInfo == NULL, SYNC_AGENT_DEV_RETURN_FAIL, "cannot get plugin_get_devinfo_cb !!");
72 int err = func_point_get_devInfo(info_name, value);
73 _DEBUG_INFO("[%s] info name : %s\n", __func__, info_name);
74 _DEBUG_INFO("[%s] value : %s\n", __func__, *value);
77 _DEBUG_INFO("[%s] fail - value is null !!\n", __func__);
78 res = SYNC_AGENT_DEV_RETURN_DEVINFO_VALUE_IS_NULL;
79 } else if (err == -1) {
80 _DEBUG_INFO("[%s] fail - not exist this information !!\n", __func__);
81 res = SYNC_AGENT_DEV_RETURN_NOT_EXIST_DEVINFO;
83 _DEBUG_INFO("[%s] success !! \n", __func__);
91 sync_agent_dev_return_e dev_destroy_dev(int device_plugin_id)
95 sync_agent_dev_return_e res = SYNC_AGENT_DEV_RETURN_SUCCESS;
97 plugin_clear_devinfo_cb func_point_clear_devInfo = plugin_get_function_clear_devinfo(device_plugin_id);
99 retvm_if(func_point_clear_devInfo == NULL, SYNC_AGENT_DEV_RETURN_FAIL, "cannot get plugin_clear_devinfo_cb !!");
101 int err = func_point_clear_devInfo();
103 _DEBUG_INFO("[%s] fail !!\n", __func__);
104 res = SYNC_AGENT_DEV_RETURN_FAIL;
106 _DEBUG_INFO("[%s] success !! \n", __func__);