Public Types | Signals | Public Member Functions | Protected Member Functions

MeeGo::QmUSBMode Class Reference

Provides a way to set and get the mode of the USB (Universal Serial Bus) on the device. More...

#include <qmusbmode.h>

List of all members.

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)

Detailed Description

Provides a way to set and get the mode of the USB (Universal Serial Bus) on the device.

Scope:
Internal

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.


Member Enumeration Documentation

The mode of the USB (Universal Serial Bus) on the device.

Enumerator:
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.

Enumerator:
ReadOnlyMount 

Read only.

ReadWriteMount 

Read/write.

Definition at line 132 of file qmusbmode.h.

Mount path.

Enumerator:
DocumentDirectoryMount 

Mount for user content.

The document directory (/home/user/MyDocs) is available as a mount point depending on the USB mode: 1) If the USB cable has been unplugged, the document directory will be available regardless of the chosen USB mode. 2) If the USB cable has been plugged in, the document directory will not be available in the mass storage mode.

Definition at line 115 of file qmusbmode.h.


Constructor & Destructor Documentation

MeeGo::QmUSBMode::QmUSBMode ( QObject *  parent = 0  ) 
MeeGo::QmUSBMode::~QmUSBMode (  ) 

Member Function Documentation

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.

Parameters:
errorCode an error code representing the error. The following error codes are supported:

  • qtn_usb_filessystem_inuse The file system is in use.
  • mount_failed Mounting a file system failed.
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.

Parameters:
mountPath The mount which is going to be unmounted
QmUSBMode::Mode MeeGo::QmUSBMode::getDefaultMode (  ) 

Gets the default USB mode.

Returns:
The default USB mode
QmUSBMode::Mode MeeGo::QmUSBMode::getMode (  ) 

Gets the current USB mode.

Returns:
Returns 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:

QmUSBMode::MountOptionFlags MeeGo::QmUSBMode::mountStatus ( QmUSBMode::MountPath  mountPath  ) 

Gets the status of a mount.

Returns:
The mount status as MountOptionFlags
bool MeeGo::QmUSBMode::setDefaultMode ( QmUSBMode::Mode  mode  ) 

Sets the default USB mode.

Parameters:
mode The new default USB mode. The OviSuite, MassStorage, ChargingOnly, Ask and SDK modes can be set
Returns:
True if successful, false otherwise
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.

Parameters:
mode The USB mode to be set. The OviSuite, MassStorage, ChargingOnly and SDK modes can be requested.
Returns:
True if a valid mode was requested, false otherwise

The documentation for this class was generated from the following file: