3 * Copyright (C) 2005-2013 Team XBMC
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
21 #include "storage/IStorageProvider.h"
28 CUDiskDevice(const char *DeviceKitUDI);
38 CStdString toString();
40 CMediaSource ToMediaShare();
42 CStdString m_UDI, m_DeviceKitUDI, m_MountPath, m_FileSystem, m_Label;
43 bool m_isMounted, m_isMountedByUs, m_isRemovable, m_isPartition, m_isFileSystem, m_isSystemInternal, m_isOptical;
44 float m_PartitionSizeGiB;
47 class CUDisksProvider : public IStorageProvider
51 virtual ~CUDisksProvider();
53 virtual void Initialize();
54 virtual void Stop() { }
56 virtual void GetLocalDrives(VECSOURCES &localDrives) { GetDisks(localDrives, false); }
57 virtual void GetRemovableDrives(VECSOURCES &removableDrives) { GetDisks(removableDrives, true); }
59 virtual bool Eject(CStdString mountpath);
61 virtual std::vector<CStdString> GetDiskUsage();
63 virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback);
65 static bool HasUDisks();
67 typedef std::map<CStdString, CUDiskDevice *> DeviceMap;
68 typedef std::pair<CStdString, CUDiskDevice *> DevicePair;
70 void DeviceAdded(const char *object, IStorageEventsCallback *callback);
71 void DeviceRemoved(const char *object, IStorageEventsCallback *callback);
72 void DeviceChanged(const char *object, IStorageEventsCallback *callback);
74 std::vector<CStdString> EnumerateDisks();
76 void GetDisks(VECSOURCES& devices, bool EnumerateRemovable);
80 DeviceMap m_AvailableDevices;
82 DBusConnection *m_connection;