Tezzeret  1
Tezzeret
GmUartLineSensor.hpp
1 /*
2  * GmTivaGpsUart.hpp
3  *
4  * Created on: May 10, 2016
5  * Author: rcram
6  */
7 
8 
9 #ifndef GM_UART_LINE_SENSOR_HPP_
10 #define GM_UART_LINE_SENSOR_HPP_
11 
12 /* RTOS Driver Header files */
13 #include <ti/drivers/UART.h>
14 #include <ti/drivers/GPIO.h>
15 
16 #include <GmBufferedSensor.hpp>
17 
18 #ifndef GMMFAMDATA_HPP_
19 #include <GmMfamData.hpp>
20 #endif
21 #include <GmError.hpp>
22 #include <GmGenericData.hpp>
23 
24 #include <GmRingBuffer.hpp>
25 #include <GmManagedRingBuffer.hpp>
26 #include <GmChildRingBuffer.hpp>
27 #include <GmStorage.hpp>
28 
29 namespace Geometrics
30 {
32  {
33  public:
34  GmUartLineSensor (UInt8 iSubject,
35  int iLineLength,
36  int iMaxBuffered,
38  GmUartLineSensor (UInt8 iSubject,
39  int iLineLength,
40  int iMaxBuffered,
41  int iCustomRecordSize,
43  GmUartLineSensor (UInt8 iSubject,
44  int iLineLength,
45  int iMaxBuffered,
46  int iCustomRecordSize,
47  UInt8 *puiBuffer,
48  UInt32 uiBufferSize,
50 
51 
52  virtual int Initialize (int iBoardID) = 0;
53 
54  //TODO RHC verify OK to leave to base class.
55  // int DeleteNextRecord ();
56  int Start ();
57  Void UartReadLoop ();
58 
59 
60  int WriteData (const char* pcData,
61  unsigned int iDataSize,
62  UInt32 ui32Topic);
63  Bool m_bPing,
64  m_bCustomRecord;
65  UART_Handle m_uhUartHandle;
66 
67 
68  protected:
69  /* When sending commands and reading responses, the read function may need to be
70  * used by the command functions. PauseRead and UnpauseRead for this purpose. */
71  void PauseRead ();
72  void UnpauseRead ();
73 
74  Task_Handle m_thTask;
75  bool m_boolInitialized;
76  bool m_bReadPaused;
77  int m_iLineLength,
78  m_iPrefixLength,
79  m_iCustomRecordSize;
80  virtual Void OnPreProcessUartString (char *pscString) {};
81  virtual int ConvertToCustomRecord (UInt8 *pscUartData,
82  UInt8 *pcCustomRecordBuffer) { return -1;};
83  protected:
84  GeoIndexedStringWithHeader *m_pgiswhBuffer;
85  int m_iIndexThisUart;
86  UInt8 *m_caCustomRecordBuffer;
87  public:
88  /************************************************************************/
89  /* The application must call InitUarts before creating or starting any */
90  /* uart sensors. InitUarts creates the table that dispatches the */
91  /* uart polling tasks to the correct individual sensor. */
92  /************************************************************************/
93  static int InitUarts (int iMaxUarts),
94  m_static_iMaxUarts,
95  m_static_iNextUart;
96  static GmUartLineSensor **m_static_aulsUarts;
97  };
98 
99 } // End namespace Geometrics
100 
101 #endif
Definition: GmGenericData.hpp:94
The class from which event sources and sensors that post events to the application's main event queue...
Definition: GmBufferedSensor.hpp:18
Definition: GmStorage.hpp:81
Definition: GmUartLineSensor.hpp:32
GmApp/GmLoggingApp.hpp>
Definition: Analogs.hpp:47