2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "mtp_gdbus_deviceinfo.h"
19 mtpgdbuslibDeviceinfo *deviceinfo_proxy = NULL;
21 void mtp_gdbus_deviceinfo_proxy_init(void)
23 deviceinfo_proxy = mtp_gdbuslib_deviceinfo_proxy_new_for_bus_sync(
25 G_DBUS_PROXY_FLAGS_NONE,
27 MTP_DBUS_DEVICEINFO_PATH,
32 void mtp_gdbus_deviceinfo_proxy_deinit(void)
34 deviceinfo_proxy = NULL;
38 mtp_error_e mtp_gdbus_deviceinfo_get_manufacturer_name(int mtp_device, char **manufacturer_name)
40 mtp_error_e result = MTP_ERROR_NONE;
43 if (deviceinfo_proxy == NULL)
44 return MTP_ERROR_NOT_COMM_INITIALIZED;
46 if (mtp_gdbuslib_deviceinfo_call_get_manufacturer_name_sync(
53 result = MTP_ERROR_COMM_ERROR;
60 mtp_error_e mtp_gdbus_deviceinfo_get_model_name(int mtp_device, char **model_name)
62 mtp_error_e result = MTP_ERROR_NONE;
65 if (deviceinfo_proxy == NULL)
66 return MTP_ERROR_NOT_COMM_INITIALIZED;
68 if (mtp_gdbuslib_deviceinfo_call_get_model_name_sync(
75 result = MTP_ERROR_COMM_ERROR;
82 mtp_error_e mtp_gdbus_deviceinfo_get_serial_number(int mtp_device, char **serial_number)
84 mtp_error_e result = MTP_ERROR_NONE;
87 if (deviceinfo_proxy == NULL)
88 return MTP_ERROR_NOT_COMM_INITIALIZED;
90 if (mtp_gdbuslib_deviceinfo_call_get_serial_number_sync(
97 result = MTP_ERROR_COMM_ERROR;
104 mtp_error_e mtp_gdbus_deviceinfo_get_device_version(int mtp_device, char **device_version)
106 mtp_error_e result = MTP_ERROR_NONE;
107 GError *error = NULL;
109 if (deviceinfo_proxy == NULL)
110 return MTP_ERROR_NOT_COMM_INITIALIZED;
112 if (mtp_gdbuslib_deviceinfo_call_get_device_version_sync(
119 result = MTP_ERROR_COMM_ERROR;
126 mtp_error_e mtp_gdbus_deviceinfo_get_bus_location(int mtp_device, int *bus_location)
128 mtp_error_e result = MTP_ERROR_NONE;
129 GError *error = NULL;
131 if (deviceinfo_proxy == NULL)
132 return MTP_ERROR_NOT_COMM_INITIALIZED;
134 if (mtp_gdbuslib_deviceinfo_call_get_bus_location_sync(
141 result = MTP_ERROR_COMM_ERROR;
148 mtp_error_e mtp_gdbus_deviceinfo_get_device_number(int mtp_device, int *device_number)
150 mtp_error_e result = MTP_ERROR_NONE;
151 GError *error = NULL;
153 if (deviceinfo_proxy == NULL)
154 return MTP_ERROR_NOT_COMM_INITIALIZED;
156 if (mtp_gdbuslib_deviceinfo_call_get_device_number_sync(
163 result = MTP_ERROR_COMM_ERROR;
170 mtp_error_e mtp_gdbus_deviceinfo_get_stitching_engine_version(int mtp_device,
171 char **stitching_engine_version)
173 mtp_error_e result = MTP_ERROR_NONE;
174 GError *error = NULL;
176 if (deviceinfo_proxy == NULL)
177 return MTP_ERROR_NOT_COMM_INITIALIZED;
179 if (mtp_gdbuslib_deviceinfo_call_get_stitching_engine_version_sync(
182 stitching_engine_version,
186 result = MTP_ERROR_COMM_ERROR;