2 * Copyright 2017 Konsulko Group
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 #ifndef MEDIAPLAYER_MANAGER_H
18 #define MEDIAPLAYER_MANAGER_H
22 #include <glib-object.h>
24 #include "lightmediascanner_interface.h"
25 #include "udisks_interface.h"
27 /* Debug Trace Level */
28 #define DT_LEVEL_ERROR (1 << 1)
29 #define DT_LEVEL_WARNING (1 << 2)
30 #define DT_LEVEL_NOTICE (1 << 3)
31 #define DT_LEVEL_INFO (1 << 4)
32 #define DT_LEVEL_DEBUG (1 << 5)
35 #define LOGE(fmt, args...) \
36 DebugTraceSendMsg(DT_LEVEL_ERROR, g_strdup_printf("[%d:%s]" fmt, __LINE__, __FUNCTION__, ## args))
37 #define LOGW(fmt, args...) \
38 DebugTraceSendMsg(DT_LEVEL_WARNING, g_strdup_printf("[%d:%s]" fmt, __LINE__, __FUNCTION__, ## args))
39 #define LOGN(fmt, args...) \
40 DebugTraceSendMsg(DT_LEVEL_NOTICE, g_strdup_printf("[%d:%s]" fmt, __LINE__, __FUNCTION__, ## args))
41 #define LOGI(fmt, args...) \
42 DebugTraceSendMsg(DT_LEVEL_INFO, g_strdup_printf("[%d:%s]" fmt, __LINE__, __FUNCTION__, ## args))
43 #define LOGD(fmt, args...) \
44 DebugTraceSendMsg(DT_LEVEL_DEBUG, g_strdup_printf("[%d:%s]" fmt, __LINE__, __FUNCTION__, ## args))
47 #define _DEBUG_PRINT_DBUS
48 #define LOCAL_PRINT_DEBUG
51 #ifdef LOCAL_PRINT_DEBUG
52 #define D_PRINTF(fmt, args...) \
53 g_print("[DEBUG][%d:%s]"fmt, __LINE__, __FUNCTION__, ## args)
54 #define D_PRINTF_RAW(fmt, args...) \
55 g_print(""fmt, ## args)
57 #define D_PRINTF(fmt, args...)
58 #define D_PRINTF_RAW(fmt, args...)
59 #endif /* ifdef _DEBUG */
61 void DebugTraceSendMsg(int level, gchar* message);
64 #define AGENT_SERVICE "org.agent"
67 #define LIGHTMEDIASCANNER_SERVICE "org.lightmediascanner"
68 #define UDISKS_SERVICE "org.freedesktop.UDisks"
71 #define LIGHTMEDIASCANNER_PATH "/org/lightmediascanner/Scanner1"
72 #define UDISKS_PATH "/org/freedesktop/UDisks"
75 #define LIGHTMEDIASCANNER_INTERFACE "org.lightmediascanner.Scanner1"
76 #define UDISKS_INTERFACE "org.freedesktop.UDisks"
77 #define FREEDESKTOP_PROPERTIES "org.freedesktop.DBus.Properties"
80 #define SQL_QUERY "SELECT files.path FROM files LEFT JOIN audios " \
81 "WHERE audios.id = files.id ORDER BY " \
82 "audios.artist_id, audios.album_id, audios.trackno"
88 OrgFreedesktopUDisks *udisks_proxy;
89 } stMediaPlayerManage;
91 typedef struct tagBinding_RegisterCallback
93 void (*binding_device_added)(GList *list);
94 void (*binding_device_removed)(const char *obj_path);
95 } Binding_RegisterCallback_t;
97 /* ------ PUBLIC PLUGIN FUNCTIONS --------- */
98 void BindingAPIRegister(const Binding_RegisterCallback_t* pstRegisterCallback);
99 int MediaPlayerManagerInit(void);
104 GList* media_lightmediascanner_scan(void);