Provides a way to set and get the mode of the USB (Universal Serial Bus) on the device. More...
#include <qmusbmode.h>
Public Types | |
enum | Mode { Connected = 0, DataInUse, Disconnected, MassStorage, ChargingOnly, OviSuite, ModeRequest, Ask, Undefined, SDK } |
The mode of the USB (Universal Serial Bus) on the device. More... | |
enum | MountPath { DocumentDirectoryMount = 0 } |
Mount path. More... | |
enum | MountOption { ReadOnlyMount = 0x0000001, ReadWriteMount = 0x0000002 } |
Mount options. More... | |
Signals | |
void | modeChanged (MeeGo::QmUSBMode::Mode mode) |
This signal is emitted when the USB mode is changed. The signal can be emitted in the following conditions: | |
void | fileSystemWillUnmount (MeeGo::QmUSBMode::MountPath mountPath) |
This signal is emitted before a file system is being unmounted. Applications can use the signal as an indication that a certain mount path will be unavailable soon. | |
void | error (const QString &errorCode) |
This signal is emitted if there was an error changing the USB mode. | |
Public Member Functions | |
QmUSBMode (QObject *parent=0) | |
~QmUSBMode () | |
QmUSBMode::Mode | getMode () |
Gets the current USB mode. | |
bool | setMode (QmUSBMode::Mode mode) |
Sets the USB mode. Note that calling setMode is non-blocking, so the method returns immediately. If the USB mode change succeeded, the modeChanged signal is emitted. | |
bool | setDefaultMode (QmUSBMode::Mode mode) |
Sets the default USB mode. | |
QmUSBMode::Mode | getDefaultMode () |
Gets the default USB mode. | |
QmUSBMode::MountOptionFlags | mountStatus (QmUSBMode::MountPath mountPath) |
Gets the status of a mount. | |
Protected Member Functions | |
void | connectNotify (const char *signal) |
void | disconnectNotify (const char *signal) |
Provides a way to set and get the mode of the USB (Universal Serial Bus) on the device.
When the USB state is changed, the modeChanged signal is emitted. First, when the USB cable is plugged in, the QmUSBMode::Connected mode is signaled. If there is a default USB mode other than QmUSBMode::Ask set, it will be the next USB mode. Otherwise, QmUSBMode::ModeRequest is emitted, for which one should respond by calling setMode(QmUSBMode::Mode). If no USB mode is set in 30 seconds, the USB mode will be set to QmUSBMode::ChargingOnly.
The USB state can be also set by calling setMode(QmUSBMode::Mode).
Typically, the default mode is either set to QmUSBMode::OviSuite or QmUSBMode::MassStorage, which is then used when the USB cable is plugged in. The other option is to set the default mode to QmUSBMode::Ask, listen for the QmUSBMode::ModeRequest mode, and then set the QmUSBMode::MassStorage or QmUSBMode::OviSuite mode.
Switching the USB mode from QmUSBMode::MassStorage to QmUSBMode::OviSuite (and vice versa) is not supported without re-plugging the USB cable.
Definition at line 61 of file qmusbmode.h.
The mode of the USB (Universal Serial Bus) on the device.
Connected |
Signaled when the USB cable is plugged in. |
DataInUse |
Signaled when the mass storage is in use and the chosen USB mode can cause data loss, mode change denied. |
Disconnected |
Signaled when the USB cable is unplugged. |
MassStorage |
Mass storage mode. |
ChargingOnly |
Charging only mode. |
OviSuite |
Ovi suite mode. Requires an MTP (media transfer protocol) client on the USB host. |
ModeRequest |
Signaled as an indication that the USB mode should be set with setMode(QmUSBMode::Mode). |
Ask |
Waiting for the USB mode to be set with setMode(QmUSBMode::Mode). |
Undefined |
Unknown/error. |
SDK |
Windows network mode. Allows USB networking on the device. |
Definition at line 72 of file qmusbmode.h.
Mount options.
Definition at line 132 of file qmusbmode.h.
Mount path.
Definition at line 115 of file qmusbmode.h.
MeeGo::QmUSBMode::QmUSBMode | ( | QObject * | parent = 0 |
) |
MeeGo::QmUSBMode::~QmUSBMode | ( | ) |
void MeeGo::QmUSBMode::connectNotify | ( | const char * | signal | ) | [protected] |
void MeeGo::QmUSBMode::disconnectNotify | ( | const char * | signal | ) | [protected] |
void MeeGo::QmUSBMode::error | ( | const QString & | errorCode | ) | [signal] |
This signal is emitted if there was an error changing the USB mode.
errorCode | an error code representing the error. The following error codes are supported:
|
void MeeGo::QmUSBMode::fileSystemWillUnmount | ( | MeeGo::QmUSBMode::MountPath | mountPath | ) | [signal] |
This signal is emitted before a file system is being unmounted. Applications can use the signal as an indication that a certain mount path will be unavailable soon.
mountPath | The mount which is going to be unmounted |
QmUSBMode::Mode MeeGo::QmUSBMode::getDefaultMode | ( | ) |
Gets the default USB mode.
QmUSBMode::Mode MeeGo::QmUSBMode::getMode | ( | ) |
Gets the current USB mode.
void MeeGo::QmUSBMode::modeChanged | ( | MeeGo::QmUSBMode::Mode | mode | ) | [signal] |
This signal is emitted when the USB mode is changed. The signal can be emitted in the following conditions:
mode | The current mode. |
QmUSBMode::MountOptionFlags MeeGo::QmUSBMode::mountStatus | ( | QmUSBMode::MountPath | mountPath | ) |
Gets the status of a mount.
bool MeeGo::QmUSBMode::setDefaultMode | ( | QmUSBMode::Mode | mode | ) |
Sets the default USB mode.
mode | The new default USB mode. The OviSuite, MassStorage, ChargingOnly, Ask and SDK modes can be set |
bool MeeGo::QmUSBMode::setMode | ( | QmUSBMode::Mode | mode | ) |
Sets the USB mode. Note that calling setMode is non-blocking, so the method returns immediately. If the USB mode change succeeded, the modeChanged signal is emitted.
mode | The USB mode to be set. The OviSuite, MassStorage, ChargingOnly and SDK modes can be requested. |