2012-05-25 04:03:34 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_system_automounter_h__
|
|
|
|
#define mozilla_system_automounter_h__
|
|
|
|
|
2013-07-30 14:25:31 +00:00
|
|
|
#include <stdint.h>
|
2012-05-25 04:03:34 +00:00
|
|
|
|
2013-05-14 00:53:23 +00:00
|
|
|
class nsCString;
|
|
|
|
|
2012-05-25 04:03:34 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace system {
|
|
|
|
|
|
|
|
// AutoMounter modes
|
|
|
|
#define AUTOMOUNTER_DISABLE 0
|
2014-08-19 20:41:35 +00:00
|
|
|
#define AUTOMOUNTER_ENABLE_UMS 1
|
2012-05-25 04:03:34 +00:00
|
|
|
#define AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED 2
|
2014-08-19 20:41:35 +00:00
|
|
|
#define AUTOMOUNTER_ENABLE_MTP 3
|
2012-05-25 04:03:34 +00:00
|
|
|
|
2013-10-17 22:41:46 +00:00
|
|
|
// Automounter statuses
|
|
|
|
#define AUTOMOUNTER_STATUS_DISABLED 0
|
|
|
|
#define AUTOMOUNTER_STATUS_ENABLED 1
|
|
|
|
#define AUTOMOUNTER_STATUS_FILES_OPEN 2
|
|
|
|
|
2012-05-25 04:03:34 +00:00
|
|
|
/**
|
|
|
|
* Initialize the automounter. This causes some of the phone's
|
|
|
|
* directories to show up on the host when the phone is plugged
|
|
|
|
* into the host via USB.
|
|
|
|
*
|
|
|
|
* When the AutoMounter starts, it will poll the current state
|
|
|
|
* of affairs (usb cable plugged in, automounter enabled, etc)
|
|
|
|
* and try to make the state of the volumes match.
|
|
|
|
*/
|
2013-05-14 00:53:23 +00:00
|
|
|
void
|
|
|
|
InitAutoMounter();
|
2012-05-25 04:03:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the enabled state of the automounter.
|
|
|
|
*
|
|
|
|
* This will in turn cause the automounter to re-evaluate
|
|
|
|
* whether it should mount/unmount/share/unshare volumes.
|
|
|
|
*/
|
2013-05-14 00:53:23 +00:00
|
|
|
void
|
|
|
|
SetAutoMounterMode(int32_t aMode);
|
|
|
|
|
2013-10-17 22:41:46 +00:00
|
|
|
/**
|
|
|
|
* Reports the status of the automounter.
|
|
|
|
*/
|
|
|
|
int32_t
|
|
|
|
GetAutoMounterStatus();
|
|
|
|
|
2013-05-14 00:53:23 +00:00
|
|
|
/**
|
|
|
|
* Sets the sharing mode of an individual volume.
|
|
|
|
*
|
|
|
|
* If a volume is enabled for sharing, and the autmounter
|
|
|
|
* is in a state to share, then the volume will be shared
|
|
|
|
* with the PC.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
SetAutoMounterSharingMode(const nsCString& aVolumeName, bool aAllowSharing);
|
2012-05-25 04:03:34 +00:00
|
|
|
|
2013-09-06 06:11:58 +00:00
|
|
|
/**
|
|
|
|
* Formats the volume with specified volume name.
|
|
|
|
*
|
|
|
|
* If the volume is ready to format, automounter
|
|
|
|
* will unmount it, format it and then mount it again.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
AutoMounterFormatVolume(const nsCString& aVolumeName);
|
|
|
|
|
2014-03-04 11:24:19 +00:00
|
|
|
/**
|
|
|
|
* Mounts the volume with specified volume name.
|
|
|
|
*
|
|
|
|
* If the volume is already unmounted, automounter
|
|
|
|
* will mount it. Otherwise automounter will skip this.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
AutoMounterMountVolume(const nsCString& aVolumeName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unmounts the volume with specified volume name.
|
|
|
|
*
|
|
|
|
* If the volume is already mounted, automounter
|
|
|
|
* will unmount it. Otherwise automounter will skip this.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
AutoMounterUnmountVolume(const nsCString& aVolumeName);
|
|
|
|
|
2012-05-25 04:03:34 +00:00
|
|
|
/**
|
|
|
|
* Shuts down the automounter.
|
|
|
|
*
|
|
|
|
* This leaves the volumes in whatever state they're in.
|
|
|
|
*/
|
2013-05-14 00:53:23 +00:00
|
|
|
void
|
|
|
|
ShutdownAutoMounter();
|
2012-05-25 04:03:34 +00:00
|
|
|
|
|
|
|
} // system
|
|
|
|
} // mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_system_automounter_h__
|