|
1 // Copyright (c) 2004-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 "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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef REMCONAVRCPSTATUSCONVERTER_H |
|
22 #define REMCONAVRCPSTATUSCONVERTER_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <remcon/remconconverterinterface.h> |
|
26 #include <remcon/remconconverterplugin.h> |
|
27 |
|
28 // These values are in bytes |
|
29 const TUint KUnitIdOffset = 4; |
|
30 const TUint KUnitIdLength = 1; |
|
31 const TUint KUnitTypeOffset = 4; |
|
32 const TUint KUnitTypeLength =1; |
|
33 const TUint KUnitTypeExtendOffset = 5; |
|
34 const TUint KUnitTypeExtendExtendOffset = 6; |
|
35 const TUint KVendorIdBaseOffset = 5; |
|
36 const TUint KVendorIdLength = 3; |
|
37 const TUint KUnitInfoResponseLength = 8; |
|
38 const TUint KRemConStatusApiDefaultPageDataLength = 4; |
|
39 |
|
40 const TUint KSubunitPageOffset = 3; |
|
41 const TUint KSubunitPageLength = 1; |
|
42 const TUint KSubunitExtensionOffset = 3; |
|
43 const TUint KSubunitExtensionLength = 1; |
|
44 const TUint KSubunitPageDataOffset = 4; |
|
45 |
|
46 // These values are in bits |
|
47 const TUint KUnitTypeShift = 3; |
|
48 |
|
49 // Defined values for comparison |
|
50 const TUint KUnitTypeExtend = 0x1e; |
|
51 const TUint KUnitTypeExtendExtend = 0xff; |
|
52 const TUint KSubunitPageMask = 0xf8; |
|
53 const TUint KSubunitExtensionMask = 0x7; |
|
54 |
|
55 const TUint KRemConStatusApiDefaultVendorId = 0xffffff; |
|
56 const TUint KRemConStatusApiDefaultPageData = 0xffffff48; |
|
57 |
|
58 _LIT(KStatusConverterPanicName, "Stat Conv Panic"); |
|
59 |
|
60 enum TStatusConverterPanic |
|
61 { |
|
62 EStatusConverterWrongInterface = 0, |
|
63 EStatusConverterDataTooShort = 1, |
|
64 EAvrcpPassedTooSmallABuffer = 2, |
|
65 }; |
|
66 |
|
67 class CAVCFrame; |
|
68 NONSHARABLE_CLASS(CRemConAvrcpStatusConverter) : public CRemConConverterPlugin, public MRemConConverterInterface |
|
69 { |
|
70 public: |
|
71 static CRemConAvrcpStatusConverter* NewL(); |
|
72 ~CRemConAvrcpStatusConverter(); |
|
73 |
|
74 private: // from CRemConConverterPlugin |
|
75 TAny* GetInterface(TUid aUid); |
|
76 |
|
77 // from MRemConConverterInterface |
|
78 TInt InterfaceToBearer(TUid aInterfaceUid, |
|
79 TUint aOperationId, |
|
80 const TDesC8& aData, |
|
81 TRemConMessageType aMsgType, |
|
82 TDes8& aBearerData) const; |
|
83 |
|
84 TInt BearerToInterface(const TDesC8& aBearerData, |
|
85 TUid& aInterfaceUid, |
|
86 TUint& aOperationId, |
|
87 TRemConMessageType& aMsgType, |
|
88 TDes8& aData) const; |
|
89 |
|
90 TBool SupportedUids(const TUid& aInterfaceUid, |
|
91 const TUid& aBearerUid) const; |
|
92 TBool SupportedInterface(const TDesC8& aInterfaceData, |
|
93 const TUid& aBearerUid) const; |
|
94 |
|
95 private: |
|
96 CRemConAvrcpStatusConverter(); |
|
97 |
|
98 static CAVCFrame* UnitInfoL(); |
|
99 static CAVCFrame* SubunitInfoL(); |
|
100 |
|
101 static void SetUnitInfoResponseDataL(const TDesC8& aBearerData, |
|
102 TDes8& aRemConData); |
|
103 static void SetSubunitInfoResponseDataL(const TDesC8& aBearerData, |
|
104 TDes8& aRemConData); |
|
105 |
|
106 static void ReadCommandDataToInt(const TDesC8& aCommandData, |
|
107 TInt aOffset, TInt aLength, TInt& aValue); |
|
108 static void SetCommandDataFromInt(TDes8& aCommandData, |
|
109 TInt aOffset, TInt aLength, TInt aValue); |
|
110 |
|
111 static void Panic(TStatusConverterPanic aPanic); |
|
112 }; |
|
113 |
|
114 #endif // REMCONAVRCPSTATUSCONVERTER_H |