1 |
|
2 // Copyright (c) 2007-2009 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: |
|
15 // |
|
16 |
|
17 #ifndef TAVSRCOPERATIONS_H |
|
18 #define TAVSRCOPERATIONS_H |
|
19 |
|
20 #include <e32def.h> |
|
21 #include <e32cmn.h> |
|
22 #include <e32base.h> |
|
23 #include <e32keys.h> |
|
24 |
|
25 // all key operations available for user input |
|
26 static const TInt KTavsrcOpConnect = ']'; |
|
27 static const TInt KTavsrcOpCancel = '['; |
|
28 static const TInt KTavsrcOpDiscoverSEPs = 'd'; |
|
29 static const TInt KTavsrcOpCreateBearers = '1'; |
|
30 static const TInt KTavsrcOpCloseBearers = '!'; |
|
31 static const TInt KTavsrcOpContentProtection = 'p'; |
|
32 static const TInt KTavsrcOpGetCapabilities = 'g'; |
|
33 static const TInt KTavsrcOpStartStreams = 's'; |
|
34 static const TInt KTavsrcOpSuspendStreams = 'e'; |
|
35 static const TInt KTavsrcOpEchoStorm = 'E'; |
|
36 static const TInt KTavsrcOpAbort = 'a'; |
|
37 static const TInt KTavsrcOpStream = '@'; |
|
38 static const TInt KTavsrcOpStreamFaster = '+'; |
|
39 static const TInt KTavsrcOpStreamSlower = '-'; |
|
40 static const TInt KTavsrcOpAutoStream = 'A'; |
|
41 static const TInt KTavsrcOpStopStream = '\''; |
|
42 static const TInt KTavsrcOpRegisterSEP = 't'; |
|
43 static const TInt KTavsrcOpRegisterMultipleSEPs = 'T'; |
|
44 static const TInt KTavsrcOpStartSrc = 'o'; |
|
45 static const TInt KTavsrcOpStopSrc = 'c'; |
|
46 static const TInt KTavsrcOpDisconnectSrc = 'f'; |
|
47 static const TInt KTavsrcOpConfigureSEP = 'x'; |
|
48 static const TInt KTavsrcOpReconfigureSEP = 'x'; |
|
49 static const TInt KTavsrcOpPacketDropIoctl = 'i'; |
|
50 static const TInt KTavsrcOpVolumeUp = EKeyUpArrow; |
|
51 static const TInt KTavsrcOpVolumeDown = EKeyDownArrow; |
|
52 static const TInt KTavsrcOpBackwards = EKeyLeftArrow; |
|
53 static const TInt KTavsrcOpForwards = EKeyRightArrow; |
|
54 static const TInt KTavsrcOpPlay = '}'; |
|
55 static const TInt KTavsrcOpStop = '{'; |
|
56 static const TInt KTavsrcOpExit = EKeyEscape; |
|
57 static const TInt KTavsrcOpToggleSafeMode = 'W'; |
|
58 |
|
59 // describes one operation including key to press and next possible operations |
|
60 class TTavsrcOperation |
|
61 { |
|
62 public: |
|
63 TTavsrcOperation(TInt aOpCode, TChar aOperation, TInt aNextOpCodes); |
|
64 |
|
65 static TBool OperationMatchesAndAllowed(const TTavsrcOperation& aOpA, const TTavsrcOperation& aOpB); |
|
66 TInt GetNextOpCodes() const; |
|
67 |
|
68 private: |
|
69 // iOpCode is the internal representation of the operation and can be used in a bitmask to define |
|
70 // all possible next operations |
|
71 TInt iOpCode; |
|
72 |
|
73 // iOperation is the external representation of the operation, i.e. the key pressed by the user defined |
|
74 // above |
|
75 TChar iOperation; |
|
76 |
|
77 // iNextOpCodes is a bitmask of all the next possible operations after this operation |
|
78 TInt iNextOpCodes; |
|
79 }; |
|
80 |
|
81 // describes all operations and is used to only allow acceptable, as defined by GAVDP, operations |
|
82 // to be selected by the user. All checking of whether an operation is allowed can be disabled |
|
83 // by turning off safe mode. |
|
84 class CTavsrcOperations : public CBase |
|
85 { |
|
86 public: |
|
87 static CTavsrcOperations* NewL(); |
|
88 ~CTavsrcOperations(); |
|
89 |
|
90 TBool IsOperationAllowed(TChar aOperation); |
|
91 TInt BeginOperation(TChar aOperation); |
|
92 void EndOperation(TChar aOperation, TInt aError); |
|
93 |
|
94 TBool SafeMode(); |
|
95 void SetSafeMode(TBool aSafeMode); |
|
96 |
|
97 private: |
|
98 CTavsrcOperations(); |
|
99 void ConstructL(); |
|
100 |
|
101 TInt GetAllowedOperationIndex(TChar aOperation, TInt aAllowedNextOpcodes); |
|
102 TBool IsOperationAllowed(TInt aIndex); |
|
103 |
|
104 private: |
|
105 TInt iLastOperationIndex; |
|
106 TInt iPendingOperationIndex; |
|
107 |
|
108 TBool iSafeMode; |
|
109 |
|
110 RArray<TTavsrcOperation> iOperations; |
|
111 }; |
|
112 |
|
113 #endif // TAVSRCOPERATIONS_H |
|