usbservices_plat/usb_watcher_api/inc/usbwatcher.h
changeset 34 7858bc6ead78
parent 31 dfdd8240f7c8
child 35 9d8b04ca6939
equal deleted inserted replaced
31:dfdd8240f7c8 34:7858bc6ead78
     1 /*
       
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  UsbWatcher server API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef RUSBWATCHER_H
       
    20 #define RUSBWATCHER_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <usb.h>
       
    24 
       
    25 /**
       
    26  *  RUsbWatcher class
       
    27  *
       
    28  *  This class offers access to UsbWatcher server to make personality
       
    29  *  related operations.
       
    30  *
       
    31  *  @lib usbwatcher.lib
       
    32  *  @since S60 v3.2
       
    33  */
       
    34 NONSHARABLE_CLASS(RUsbWatcher) : public RSessionBase
       
    35     {
       
    36 public:
       
    37 	IMPORT_C RUsbWatcher();
       
    38 
       
    39 	IMPORT_C ~RUsbWatcher();
       
    40 
       
    41     /**
       
    42      * Return version of the server.
       
    43      *
       
    44      * @since S60 3.2
       
    45      * @return Version of the server
       
    46      */
       
    47 	IMPORT_C TVersion Version() const;
       
    48 
       
    49     /**
       
    50      * Connect to the server
       
    51      *
       
    52      * @since S60 3.2
       
    53      * @return KErrNone if successful, otherwise one of the other system-wide error codes.
       
    54      */
       
    55 	IMPORT_C TInt Connect();
       
    56     
       
    57     /**
       
    58      * Set and select personality
       
    59      * Personality is saved to central repository and if there is an active 
       
    60      * USB connection also current personality is changed to new one.
       
    61      *
       
    62      * If the aForce parameter is set ETrue, the Ask on connection mode query
       
    63      * is not shown at the following cable connections until 
       
    64      * - the session is closed 
       
    65      * - or aForce is set EFalse in subsequent SetPersonality
       
    66      * - or CancelSetPersonality is called for outstanding SetPersonality
       
    67      * - or SetPreviousPersonality or SetPreviousPersonalitySync is called
       
    68      * - or SetPreviousPersonalityOnDisconnect is called.
       
    69      * The Ask on connection is suppressed until all the sessions using aForce 
       
    70      * have been closed or have been resetted the suppression with one of the 
       
    71      * function calls listed above. Do not leave session open without resetting 
       
    72      * aForce, if Ask on connection needs to work normally.
       
    73      *
       
    74      * Note that if KErrDiskFull is returned in aStatus, while the cable is 
       
    75      * connected, the personality was loaded, but the new personality was not 
       
    76      * stored to Central Repository.
       
    77      *
       
    78      * @since S60 3.2
       
    79      * @param aStatus The completion status of the request.
       
    80      * @param aId Identifies personality to set.
       
    81      * @param aForce If this parameter has value ETrue, USB mode is not asked from the user.
       
    82      * @param aNonBlocking If ETrue, no personality switch blocking queries are shown.
       
    83      */
       
    84     IMPORT_C void SetPersonality(TRequestStatus& aStatus, TInt aId, TBool aForce = EFalse, 
       
    85         TBool aNonBlocking = EFalse);
       
    86     
       
    87     /**
       
    88      * Cancel pending set personality request.
       
    89      *
       
    90      * @since S60 3.2
       
    91      */    
       
    92     IMPORT_C void CancelSetPersonality();
       
    93 
       
    94     /**
       
    95      * Set to previous personality. Central repository key is updated with the previous one and if
       
    96      * USB is connected current personality is replaced with previous one.
       
    97      * 
       
    98      * @since S60 3.2
       
    99      * @param aStatus The completion status of the request.
       
   100      */
       
   101     IMPORT_C void SetPreviousPersonality(TRequestStatus& aStatus);
       
   102 
       
   103     /**
       
   104      * This service is same as previous one. Except that this one is comleted before it is ready.
       
   105      * 
       
   106      * @since S60 3.2
       
   107      */
       
   108     IMPORT_C void SetPreviousPersonality();
       
   109 
       
   110     /**
       
   111      * This service cancels pending SetPreviousPersonality() request.
       
   112      * 
       
   113      * @since S60 3.2
       
   114      */
       
   115     IMPORT_C void CancelSetPreviousPersonality();
       
   116     
       
   117     /**
       
   118      * This service will set the previous personality on cable disconnect. If cable is disconnected
       
   119      * already when this service is used, nothing will happen.
       
   120      * 
       
   121      * @since S60 3.2
       
   122      */    
       
   123     IMPORT_C void SetPreviousPersonalityOnDisconnect();
       
   124     };
       
   125     
       
   126 #endif //RUSBWATCHER_H