|
1 /* |
|
2 * Copyright (c) 2006 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: Command handler for SSY <--> Sensor messages |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SSYREFERENCECMDHANDLER_H |
|
20 #define SSYREFERENCECMDHANDLER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "ssyreferenceconfig.h" |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CSsyReferenceChannel; |
|
27 |
|
28 /** |
|
29 * Command handler class for handling commands of one channel. Each opened |
|
30 * channel has its own instance of this class |
|
31 * |
|
32 * @lib ssyreferenceplugin.lib |
|
33 * @since S60 5.0 |
|
34 */ |
|
35 class CSsyReferenceCmdHandler : public CActive |
|
36 { |
|
37 |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Two-phase constructor |
|
42 * |
|
43 * @since S60 5.0 |
|
44 * @param[in] aSsyChannel Reference to SSY Channel instance. |
|
45 * @return CSsyReferenceCmdHandler* Pointer to created CSsyReferenceCmdHandler object |
|
46 */ |
|
47 static CSsyReferenceCmdHandler* NewL( CSsyReferenceChannel& aSsyChannel ); |
|
48 |
|
49 /** |
|
50 * Virtual destructor |
|
51 * |
|
52 * @since S60 5.0 |
|
53 */ |
|
54 virtual ~CSsyReferenceCmdHandler(); |
|
55 |
|
56 // from base class CSsyControl |
|
57 |
|
58 /** |
|
59 * Processes command specified in param aMessage. |
|
60 * |
|
61 * @since S60 5.0 |
|
62 * @param[in] aMessage Contains command information to process |
|
63 * @return void Symbian OS error code |
|
64 */ |
|
65 TInt ProcessCommand( TSsyReferenceMsg aMessage ); |
|
66 |
|
67 /** |
|
68 * From CActive |
|
69 */ |
|
70 void RunL(); |
|
71 |
|
72 /** |
|
73 * From CActive |
|
74 */ |
|
75 void DoCancel(); |
|
76 |
|
77 /** |
|
78 * From CActive |
|
79 */ |
|
80 TInt RunError( TInt aError ); |
|
81 |
|
82 /** |
|
83 * Callback function for DataItem generation |
|
84 */ |
|
85 static TInt DataItemCallback( TAny* aThis ); |
|
86 |
|
87 /** |
|
88 * Handles data item generation. Called from DataItemCallback |
|
89 */ |
|
90 TInt GenerateChannelDataItem(); |
|
91 |
|
92 private: |
|
93 |
|
94 /** |
|
95 * C++ constructor. |
|
96 * |
|
97 * @since S60 5.0 |
|
98 * @param[in] aSsyChannel Reference to SSY Channel instance. |
|
99 */ |
|
100 CSsyReferenceCmdHandler( CSsyReferenceChannel& aSsyChannel ); |
|
101 |
|
102 /** |
|
103 * Symbian 2nd phase constructor. |
|
104 */ |
|
105 void ConstructL(); |
|
106 |
|
107 /** |
|
108 * Makes synchronous calls asynchronous |
|
109 */ |
|
110 void IssueRequest( TInt aError = KErrNone ); |
|
111 |
|
112 /** |
|
113 * Sends response to channel |
|
114 */ |
|
115 void SendResponse( TInt aError = KErrNone ); |
|
116 |
|
117 private: // data |
|
118 |
|
119 /** |
|
120 * Reference to SSY Conrtol to send responses for commands |
|
121 */ |
|
122 CSsyReferenceChannel& iSsyChannel; |
|
123 |
|
124 /** |
|
125 * Pointer to currently processing message |
|
126 */ |
|
127 TSsyReferenceMsg* iMessage; |
|
128 |
|
129 /** |
|
130 * Data item array |
|
131 */ |
|
132 TSsyRefDataItemArray iDataItemArray; |
|
133 |
|
134 /** |
|
135 * Pointer to next item to generate in iDataItemArray |
|
136 */ |
|
137 TInt iDataItemPtr; |
|
138 |
|
139 /** |
|
140 * Periodic timer for generating channel data |
|
141 */ |
|
142 CPeriodic* iTimer; |
|
143 |
|
144 }; |
|
145 |
|
146 #endif // SSYREFERENCECMDHANDLER_H |
|
147 |
|
148 // End of file |