2012-05-24 21:03:34 -07: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 07:25:31 -07:00
|
|
|
#include <stdint.h>
|
2012-05-24 21:03:34 -07:00
|
|
|
|
2013-05-13 17:53:23 -07:00
|
|
|
class nsCString;
|
|
|
|
|
2012-05-24 21:03:34 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace system {
|
|
|
|
|
|
|
|
// AutoMounter modes
|
|
|
|
#define AUTOMOUNTER_DISABLE 0
|
|
|
|
#define AUTOMOUNTER_ENABLE 1
|
|
|
|
#define AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED 2
|
|
|
|
|
2013-10-17 15:41:46 -07:00
|
|
|
// Automounter statuses
|
|
|
|
#define AUTOMOUNTER_STATUS_DISABLED 0
|
|
|
|
#define AUTOMOUNTER_STATUS_ENABLED 1
|
|
|
|
#define AUTOMOUNTER_STATUS_FILES_OPEN 2
|
|
|
|
|
2012-05-24 21:03:34 -07: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-13 17:53:23 -07:00
|
|
|
void
|
|
|
|
InitAutoMounter();
|
2012-05-24 21:03:34 -07: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-13 17:53:23 -07:00
|
|
|
void
|
|
|
|
SetAutoMounterMode(int32_t aMode);
|
|
|
|
|
2013-10-17 15:41:46 -07:00
|
|
|
/**
|
|
|
|
* Reports the status of the automounter.
|
|
|
|
*/
|
|
|
|
int32_t
|
|
|
|
GetAutoMounterStatus();
|
|
|
|
|
2013-05-13 17:53:23 -07: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-24 21:03:34 -07:00
|
|
|
|
2013-09-05 23:11:58 -07: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);
|
|
|
|
|
2012-05-24 21:03:34 -07:00
|
|
|
/**
|
|
|
|
* Shuts down the automounter.
|
|
|
|
*
|
|
|
|
* This leaves the volumes in whatever state they're in.
|
|
|
|
*/
|
2013-05-13 17:53:23 -07:00
|
|
|
void
|
|
|
|
ShutdownAutoMounter();
|
2012-05-24 21:03:34 -07:00
|
|
|
|
|
|
|
} // system
|
|
|
|
} // mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_system_automounter_h__
|