|
1 /* |
|
2 * Copyright (c) 2006-2008 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: Reference implementation of SSY Channel Data Provider interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SSYREFERENCECHANNELDATAPROVIDER_H |
|
20 #define SSYREFERENCECHANNELDATAPROVIDER_H |
|
21 |
|
22 #include <ssychanneldataprovider.h> |
|
23 |
|
24 class CSsyReferenceChannel; |
|
25 class TSsyReferenceMsg; |
|
26 |
|
27 /** |
|
28 * Channel data provider implementation. |
|
29 * |
|
30 * @lib ssyreferenceplugin.lib |
|
31 * @since S60 5.0 |
|
32 */ |
|
33 class CSsyReferenceChannelDataProvider : public CBase, public MSsyChannelDataProvider |
|
34 { |
|
35 |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Two-phase constructor |
|
40 * |
|
41 * @since S60 5.0 |
|
42 * @param[in] aChannel Reference to channel this provider belongs to |
|
43 * @return CSsyReferenceChannelDataProvider* Pointer to created CSsyReferenceControl object |
|
44 */ |
|
45 static CSsyReferenceChannelDataProvider* NewL( CSsyReferenceChannel& aChannel ); |
|
46 |
|
47 /** |
|
48 * Virtual destructor |
|
49 * |
|
50 * @since S60 5.0 |
|
51 */ |
|
52 virtual ~CSsyReferenceChannelDataProvider(); |
|
53 |
|
54 // from base class MSsyChannelDataProvider |
|
55 |
|
56 /** |
|
57 * From MSsyChannelDataProvider |
|
58 * Starts asynchronous data listening. Multiple OpenChannel()-requests |
|
59 * can be active for different channels at the same time. |
|
60 * |
|
61 * @since S60 5.0 |
|
62 * @param[in] aBuffer Pointer to a data buffer |
|
63 * @param[in] aCount Indicates data buffer size as a count of the data objects. |
|
64 */ |
|
65 void StartChannelDataL( const TSensrvChannelId aChannelId, TUint8* aBuffer, TInt aCount ); |
|
66 |
|
67 /** |
|
68 * From MSsyChannelDataProvider |
|
69 * Stops asynchronous data listening. The data buffer is not valid after call of |
|
70 * this function. |
|
71 * |
|
72 * @since S60 5.0 |
|
73 */ |
|
74 void StopChannelDataL( const TSensrvChannelId aChannelId ); |
|
75 |
|
76 /** |
|
77 * From MSsyChannelDataProvider |
|
78 * Forces SSY to call BufferFilled() regardless of how many data items have been |
|
79 * written to buffer. Even if no data items have yet been written, BufferFilled() |
|
80 * must be called. |
|
81 * |
|
82 * @since S60 5.0 |
|
83 */ |
|
84 void ForceBufferFilledL( const TSensrvChannelId aChannelId ); |
|
85 |
|
86 /** |
|
87 * Returns a pointer to a specified interface - to allow future extension |
|
88 * of this class without breaking binary compatibility |
|
89 * |
|
90 * @since S60 5.0 |
|
91 * @param aInterfaceUid Identifier of the interface to be retrieved |
|
92 * @param aInterface A reference to a pointer that retrieves the specified interface. |
|
93 */ |
|
94 void GetChannelDataProviderInterfaceL( TUid aInterfaceUid, TAny*& aInterface ); |
|
95 |
|
96 /** |
|
97 * Channel data item received |
|
98 * |
|
99 * @param[in] aMessage Contains channel item |
|
100 */ |
|
101 void ChannelDataReceivedL( TSsyReferenceMsg* aMessage ); |
|
102 |
|
103 private: |
|
104 |
|
105 /** |
|
106 * C++ constructor. |
|
107 * @param[in] aChannel Reference to channel this provider belongs to |
|
108 */ |
|
109 CSsyReferenceChannelDataProvider( CSsyReferenceChannel& aChannel ); |
|
110 |
|
111 /** |
|
112 * Symbian 2nd phase constructor. |
|
113 */ |
|
114 void ConstructL(); |
|
115 |
|
116 /** |
|
117 * Adds data into buffer. |
|
118 * |
|
119 *@param[in] aData Data to add to buffer |
|
120 *@param[in] aSize Size of data |
|
121 */ |
|
122 void AddDataToBuffer( TUint8* aData, const TInt aSize ); |
|
123 |
|
124 /** |
|
125 * Sends BufferFilled notification to MSsyCallback |
|
126 */ |
|
127 void SendBufferFilled(); |
|
128 |
|
129 private: // data |
|
130 |
|
131 /** |
|
132 * Reference to channel for which this provider belongs to |
|
133 */ |
|
134 CSsyReferenceChannel& iChannel; |
|
135 |
|
136 /** |
|
137 * Pointer to data buffer in Sensor Server side |
|
138 */ |
|
139 TUint8* iDataBuffer; |
|
140 |
|
141 /** |
|
142 * Maximum requested data items |
|
143 */ |
|
144 TInt iMaxCount; |
|
145 |
|
146 /** |
|
147 * Number of items in buffer |
|
148 */ |
|
149 TInt iDataCount; |
|
150 |
|
151 }; |
|
152 |
|
153 #endif // SSYREFERENCECHANNELDATAPROVIDER_H |