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