|
1 /* |
|
2 * Copyright (c) 2004 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 * This class handles SAP request message |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef BT_SAP_REQUEST_HANDLER_H |
|
21 #define BT_SAP_REQUEST_HANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "BTSapServerState.h" |
|
25 |
|
26 const TBTSapServerState KStateByRequest[] = |
|
27 { |
|
28 EStateConnect, |
|
29 EStateIdle, |
|
30 EStateDisconnect, |
|
31 EStateIdle, |
|
32 EStateIdle, |
|
33 EStateAPDU, |
|
34 EStateIdle, |
|
35 EStateATR, |
|
36 EStateIdle, |
|
37 EStatePowerOff, |
|
38 EStateIdle, |
|
39 EStatePowerOn, |
|
40 EStateIdle, |
|
41 EStateReset, |
|
42 EStateIdle, |
|
43 EStateCardReaderStatus |
|
44 }; |
|
45 |
|
46 class CBTSapRequestHandler : public CActive |
|
47 { |
|
48 private: |
|
49 class CSegmentTimer : public CTimer |
|
50 { |
|
51 public: |
|
52 static CSegmentTimer* NewL(CBTSapRequestHandler* aRequestHandler); |
|
53 |
|
54 private: |
|
55 CSegmentTimer(CBTSapRequestHandler* aRequestHandler); |
|
56 |
|
57 void RunL(); |
|
58 |
|
59 private: |
|
60 CBTSapRequestHandler* iRequestHandler; |
|
61 }; |
|
62 |
|
63 public: |
|
64 // Constructors |
|
65 static CBTSapRequestHandler* NewL(CBTSapServerState& aServerState); |
|
66 |
|
67 // Destructor |
|
68 ~CBTSapRequestHandler(); |
|
69 |
|
70 private: // From CActive |
|
71 |
|
72 /** |
|
73 * DoCancel() has to be implemented by all the classes deriving CActive. |
|
74 * Request cancellation routine. |
|
75 * @param none |
|
76 * @return none |
|
77 */ |
|
78 void DoCancel(); |
|
79 |
|
80 /** |
|
81 * RunL is called by framework after request is being completed. |
|
82 * @param nones |
|
83 * @return none |
|
84 */ |
|
85 void RunL(); |
|
86 |
|
87 public: |
|
88 |
|
89 void HandleSapData(const TDes8& aData); |
|
90 |
|
91 void HandleSegmentTimeout(); |
|
92 |
|
93 private: |
|
94 |
|
95 // Two-phase constructor |
|
96 void ConstructL(); |
|
97 |
|
98 // Default constructor |
|
99 CBTSapRequestHandler(CBTSapServerState& aServerState); |
|
100 |
|
101 void HandleSapMessage(const TValidationResult aResult); |
|
102 |
|
103 private: |
|
104 |
|
105 CBTSapServerState& iServerState; |
|
106 TBTSapMessage& iRequestMessage; |
|
107 TBTSapMessage iRawMessage; |
|
108 CSegmentTimer* iSegmentTimer; |
|
109 }; |
|
110 |
|
111 #endif // BT_SAP_REQUEST_HANDLER_H |