michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_system_automounter_h__ michael@0: #define mozilla_system_automounter_h__ michael@0: michael@0: #include michael@0: michael@0: class nsCString; michael@0: michael@0: namespace mozilla { michael@0: namespace system { michael@0: michael@0: // AutoMounter modes michael@0: #define AUTOMOUNTER_DISABLE 0 michael@0: #define AUTOMOUNTER_ENABLE 1 michael@0: #define AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED 2 michael@0: michael@0: // Automounter statuses michael@0: #define AUTOMOUNTER_STATUS_DISABLED 0 michael@0: #define AUTOMOUNTER_STATUS_ENABLED 1 michael@0: #define AUTOMOUNTER_STATUS_FILES_OPEN 2 michael@0: michael@0: /** michael@0: * Initialize the automounter. This causes some of the phone's michael@0: * directories to show up on the host when the phone is plugged michael@0: * into the host via USB. michael@0: * michael@0: * When the AutoMounter starts, it will poll the current state michael@0: * of affairs (usb cable plugged in, automounter enabled, etc) michael@0: * and try to make the state of the volumes match. michael@0: */ michael@0: void michael@0: InitAutoMounter(); michael@0: michael@0: /** michael@0: * Sets the enabled state of the automounter. michael@0: * michael@0: * This will in turn cause the automounter to re-evaluate michael@0: * whether it should mount/unmount/share/unshare volumes. michael@0: */ michael@0: void michael@0: SetAutoMounterMode(int32_t aMode); michael@0: michael@0: /** michael@0: * Reports the status of the automounter. michael@0: */ michael@0: int32_t michael@0: GetAutoMounterStatus(); michael@0: michael@0: /** michael@0: * Sets the sharing mode of an individual volume. michael@0: * michael@0: * If a volume is enabled for sharing, and the autmounter michael@0: * is in a state to share, then the volume will be shared michael@0: * with the PC. michael@0: */ michael@0: void michael@0: SetAutoMounterSharingMode(const nsCString& aVolumeName, bool aAllowSharing); michael@0: michael@0: /** michael@0: * Formats the volume with specified volume name. michael@0: * michael@0: * If the volume is ready to format, automounter michael@0: * will unmount it, format it and then mount it again. michael@0: */ michael@0: void michael@0: AutoMounterFormatVolume(const nsCString& aVolumeName); michael@0: michael@0: /** michael@0: * Mounts the volume with specified volume name. michael@0: * michael@0: * If the volume is already unmounted, automounter michael@0: * will mount it. Otherwise automounter will skip this. michael@0: */ michael@0: void michael@0: AutoMounterMountVolume(const nsCString& aVolumeName); michael@0: michael@0: /** michael@0: * Unmounts the volume with specified volume name. michael@0: * michael@0: * If the volume is already mounted, automounter michael@0: * will unmount it. Otherwise automounter will skip this. michael@0: */ michael@0: void michael@0: AutoMounterUnmountVolume(const nsCString& aVolumeName); michael@0: michael@0: /** michael@0: * Shuts down the automounter. michael@0: * michael@0: * This leaves the volumes in whatever state they're in. michael@0: */ michael@0: void michael@0: ShutdownAutoMounter(); michael@0: michael@0: } // system michael@0: } // mozilla michael@0: michael@0: #endif // mozilla_system_automounter_h__