|
1 /* |
|
2 * Copyright (c) 2005-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 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef BTGPSNMEABUFFER_H |
|
22 #define BTGPSNMEABUFFER_H |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <e32base.h> |
|
27 |
|
28 // CONSTANTS |
|
29 // Constants for NMEA buffer index, mean NMEA message |
|
30 // has not been received by the client; |
|
31 const TInt KBTGPSNmeaIndexNotSet = -1; |
|
32 |
|
33 |
|
34 // MACROS |
|
35 |
|
36 // DATA TYPES |
|
37 |
|
38 // FUNCTION PROTOTYPES |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * This class is used to send messages to connected BT device. |
|
46 * It doesn't garentee the message can be received from connected |
|
47 * BT device. The message are buffered if necessary to prevent |
|
48 * jams on BT connection. |
|
49 * |
|
50 */ |
|
51 class CBTGPSNmeaBuffer: public CBase |
|
52 { |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Two-phase construction. |
|
57 * @param aSize The size of NMEA buffer |
|
58 */ |
|
59 static CBTGPSNmeaBuffer * NewL(TInt aSize); |
|
60 |
|
61 /** |
|
62 * Destructor |
|
63 */ |
|
64 virtual ~CBTGPSNmeaBuffer(); |
|
65 |
|
66 /** |
|
67 * Add NMEA sentences to buffer |
|
68 */ |
|
69 void AddSentences(const TDesC8& aNmea); |
|
70 |
|
71 /** |
|
72 * Read NMEA sentences from buffer. |
|
73 * After the sentence is rturned, aBeginning |
|
74 * is updated to the new position. When |
|
75 * the reading reaches the end, aBeginning |
|
76 * will be set as KBTGPSNmeaIndexNotSet. |
|
77 * @return KErrNone if nmea sentences are successfully |
|
78 * retrieved. Otherwise, the end of the buffer |
|
79 * is met. |
|
80 */ |
|
81 TInt ReadSentences( |
|
82 TDes8& aDest, |
|
83 TInt& aBeginning) const; |
|
84 |
|
85 /** |
|
86 * Return current index |
|
87 */ |
|
88 TInt CurrentIndex() const; |
|
89 |
|
90 /** |
|
91 * Reset the buffer |
|
92 */ |
|
93 void ResetBuffer(); |
|
94 |
|
95 private: |
|
96 |
|
97 /** |
|
98 * Second phase of the construction |
|
99 */ |
|
100 void ConstructL(TInt aSize); |
|
101 |
|
102 /** |
|
103 * Private constructor |
|
104 */ |
|
105 CBTGPSNmeaBuffer(); |
|
106 |
|
107 private: |
|
108 //NMEA buffer |
|
109 TUint8* iBuffer; |
|
110 |
|
111 //Size of the buffer |
|
112 TInt iSize; |
|
113 |
|
114 //End of the FIFO buffer |
|
115 TInt iBottom; |
|
116 }; |
|
117 #endif |
|
118 // End of File |
|
119 |