diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/system/gonk/VolumeCommand.cpp | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/system/gonk/VolumeCommand.cpp')
-rw-r--r-- | dom/system/gonk/VolumeCommand.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/dom/system/gonk/VolumeCommand.cpp b/dom/system/gonk/VolumeCommand.cpp new file mode 100644 index 000000000..8095956a7 --- /dev/null +++ b/dom/system/gonk/VolumeCommand.cpp @@ -0,0 +1,85 @@ +/* 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 "nsString.h" +#include "nsWhitespaceTokenizer.h" + +#include "Volume.h" +#include "VolumeCommand.h" +#include "VolumeManager.h" +#include "VolumeManagerLog.h" + +namespace mozilla { +namespace system { + +/*************************************************************************** +* +* The VolumeActionCommand class is used to send commands which apply +* to a particular volume. +* +* The following commands would fit into this category: +* +* volume mount <volname> +* volume unmount <volname> [force] +* volume format <volname> +* volume share <volname> <method> +* volume unshare <volname> <method> +* volume shared <volname> <method> +* +* A typical response looks like: +* +* # vdc volume unshare sdcard ums +* 605 Volume sdcard /mnt/sdcard state changed from 7 (Shared-Unmounted) to 1 (Idle-Unmounted) +* 200 volume operation succeeded +* +* Note that the 600 series of responses are considered unsolicited and +* are dealt with directly by the VolumeManager. This command will only +* see the terminating response code (200 in the example above). +* +***************************************************************************/ + +VolumeActionCommand::VolumeActionCommand(Volume* aVolume, + const char* aAction, + const char* aExtraArgs, + VolumeResponseCallback* aCallback) + : VolumeCommand(aCallback), + mVolume(aVolume) +{ + nsAutoCString cmd; + + cmd = "volume "; + cmd += aAction; + cmd += " "; + cmd += aVolume->Name().get(); + + // vold doesn't like trailing white space, so only add it if we really need to. + if (aExtraArgs && (*aExtraArgs != '\0')) { + cmd += " "; + cmd += aExtraArgs; + } + SetCmd(cmd); +} + +/*************************************************************************** +* +* The VolumeListCommand class is used to send the "volume list" command to +* vold. +* +* A typical response looks like: +* +* # vdc volume list +* 110 sdcard /mnt/sdcard 4 +* 110 sdcard1 /mnt/sdcard/external_sd 4 +* 200 Volumes listed. +* +***************************************************************************/ + +VolumeListCommand::VolumeListCommand(VolumeResponseCallback* aCallback) + : VolumeCommand(NS_LITERAL_CSTRING("volume list"), aCallback) +{ +} + +} // system +} // mozilla + |