/* 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/. */ #include "nsISupports.idl" #include "nsIVolumeStat.idl" [scriptable, uuid(1134f267-7b81-42f2-b64a-6edb91286576)] interface nsIVolume : nsISupports { // These MUST match the states from android's system/vold/Volume.h header const long STATE_INIT = -1; const long STATE_NOMEDIA = 0; const long STATE_IDLE = 1; const long STATE_PENDING = 2; const long STATE_CHECKING = 3; const long STATE_MOUNTED = 4; const long STATE_UNMOUNTING = 5; const long STATE_FORMATTING = 6; const long STATE_SHARED = 7; const long STATE_SHAREDMNT = 8; // The name of the volume. Often there is only one volume, called sdcard. // But some phones support multiple volumes. readonly attribute DOMString name; // The mount point is the path on the system where the volume is mounted // and is only valid when state == STATE_MOUNTED. readonly attribute DOMString mountPoint; // Reflects the current state of the volume, using STATE_xxx constants // from above. readonly attribute long state; // mountGeneration is a unique number which is used distinguish between // periods of time that a volume is in the mounted state. Each time a // volume transitions to the mounted state, the mountGeneration will // be different from the last time it transitioned to the mounted state. readonly attribute long mountGeneration; // While a volume is mounted, it can be locked, preventing it from being // shared with the PC. To lock a volume, acquire an nsIDOMMozWakeLock // using the name of this attribute. Note that mountLockName changes // every time the mountGeneration changes, so you'll need to reacquire // the wakelock every time the volume becomes mounted. readonly attribute DOMString mountLockName; nsIVolumeStat getStats(); }; %{C++ // For use with the ObserverService #define NS_VOLUME_STATE_CHANGED "volume-state-changed" namespace mozilla { namespace system { // Convert a state into a loggable/printable string. const char* NS_VolumeStateStr(int32_t aState); } // system } // mozilla %}