kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/inc/usbmsshared.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Shared client/server definitions
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalAll
       
    23  @released
       
    24 */
       
    25 
       
    26 #ifndef __USBMSSHARED_H__
       
    27 #define __USBMSSHARED_H__
       
    28 
       
    29 #include <f32fsys.h>
       
    30 
       
    31 #include "mstypes.h"
       
    32 
       
    33 const TInt KUsbMsSrvMajorVersionNumber = 1;
       
    34 const TInt KUsbMsSrvMinorVersionNumber = 0;
       
    35 const TInt KUsbMsSrvBuildVersionNumber = 0;
       
    36 
       
    37 const TInt KUsbMsResourceVersion = 0;
       
    38 
       
    39 _LIT(KUsbMsServerName, "usbmsserver");
       
    40 
       
    41 
       
    42 /** Types of requests USB mass storage class controller can make */
       
    43 enum TUsbMsReqType
       
    44 	{
       
    45 	EUsbMsStart,
       
    46 	EUsbMsStop,
       
    47 	EUsbMsShutdown,
       
    48 	};
       
    49 
       
    50 /**
       
    51 @publishedPartner
       
    52 @released
       
    53 
       
    54 The USB Class Controller identifier.
       
    55 */
       
    56 const TUid KUsbMsClassControllerUID={0x10204BBC};
       
    57 
       
    58 /**
       
    59 @publishedPartner
       
    60 @released
       
    61 
       
    62 The Publish & Subscribe Category for all USB Mass Storage events.
       
    63 */
       
    64 const TUid KUsbMsDriveState_Category={KFileServerUidValue};
       
    65 
       
    66 /**
       
    67 @publishedPartner
       
    68 @released
       
    69 
       
    70 The Publish & Subscribe event subkey enumeration.
       
    71 */
       
    72 enum TUsbMsDriveState_Subkey
       
    73 	{
       
    74 	EUsbMsDriveState_DriveStatus,
       
    75 	EUsbMsDriveState_KBytesRead,
       
    76 	EUsbMsDriveState_KBytesWritten,
       
    77 	EUsbMsDriveState_MediaError
       
    78 	};
       
    79 
       
    80 /**
       
    81 @publishedPartner
       
    82 @released
       
    83 
       
    84 Possible values for each of EUsbMsDriveState_DriveStatus status codes.
       
    85 */
       
    86 enum EUsbMsDriveStates
       
    87 	{
       
    88 	/** File system not available for Mass Storage */
       
    89 	EUsbMsDriveState_Disconnected	=0x0,
       
    90 	/** Host has required connection */
       
    91 	EUsbMsDriveState_Connecting		=0x1,
       
    92 	/** File system available to Mass Storage */
       
    93 	EUsbMsDriveState_Connected		=0x2,
       
    94 	/** Disconnecting from Mass Storage */
       
    95 	EUsbMsDriveState_Disconnecting	=0x3,
       
    96 	/** Critical write - do not remove card */
       
    97 	EUsbMsDriveState_Active			=0x4,
       
    98 	/** Connected, but locked with a password */
       
    99 	EUsbMsDriveState_Locked			=0x5,
       
   100 	/** Connected, but card not present */
       
   101 	EUsbMsDriveState_MediaNotPresent=0x6,
       
   102 	/** Card removed while active */
       
   103 	EUsbMsDriveState_Removed		=0x7,
       
   104 	/** General error */
       
   105 	EUsbMsDriveState_Error			=0x8
       
   106 	};
       
   107 
       
   108 
       
   109 /**
       
   110 @publishedPartner
       
   111 @released
       
   112 
       
   113 A collection of integers, contained in a TBuf8 for compatibility
       
   114 with RProperty.  Used for the EUsbMsDriveState_KBytesRead/Written
       
   115 events.
       
   116 */
       
   117 class TUsbMsBytesTransferred : public TBuf8<KUsbMsMaxDrives*sizeof(TInt)>
       
   118 	{
       
   119 	public:
       
   120 	inline TUsbMsBytesTransferred();
       
   121 	inline TInt& operator[](TUint aLun);
       
   122 	};
       
   123 /**
       
   124 @publishedPartner
       
   125 @released */
       
   126 TUsbMsBytesTransferred::TUsbMsBytesTransferred()
       
   127 	{
       
   128 	SetLength(MaxLength());
       
   129 	Fill(0);
       
   130 	}
       
   131 
       
   132 /**
       
   133 @publishedPartner
       
   134 @released
       
   135 
       
   136 Return one of the integers contained in this buffer.
       
   137 @return Bytes transferred count for the specified drive.
       
   138 @param aLun Drive index
       
   139 */
       
   140 TInt& TUsbMsBytesTransferred::operator[](TUint aLun)
       
   141 	{
       
   142 	__ASSERT_DEBUG(aLun < static_cast<TUint>(MaxLength()), User::Invariant());
       
   143 	return *(reinterpret_cast<TInt*>(const_cast<TUint8*>(Ptr())) + aLun);
       
   144 	}
       
   145 
       
   146 #endif //__USBMSSHARED_H__