Tezzeret  1
Tezzeret
GmMQTT.hpp
1 /*
2  * GmMQTT.hpp
3  *
4  * Created on: Jun 6, 2016
5  * Author: rcram
6  */
7 
8 #ifndef GMMQTT_HPP_
9 #define GMMQTT_HPP_
10 
11 #if GEO_MQTT == GEO_TRUE
12 
13 #if GEO_NET_NDK == GEO_TRUE
14 #include <netmain.h>
15 #endif
16 //#if GEO_NET_3100 == GEO_TRUE
17 //#include "../GeometricsEthernet/http-port/usertype.h"
18 //#include <simplelink.h>
19 //#else
20 //#include <socket.h>
21 //#endif
22 
23 #include <GmStorage.hpp>
25 
26 
27 namespace Geometrics
28 {
29 
30 extern "C" int StartupMQTT (void);
31 
32 #define GEO_MAX_TOPICS 20
33 #define GEO_MAX_TOPIC_NAME_LENGTH 20
34 
35 class GmMqttPublisher : public GmStorage
36 {
37 
38 public:
39  GmMqttPublisher ();
40  GmMqttPublisher (int iBufferSize);
41 
42  ~GmMqttPublisher ();
43  int CheckInitialized (char *szServerName,
44  char *szPortNumberAsString,
45  char *szClientName,
46  Bool bIsKnownIp);
47  int ConnectToBroker (const char *brokerAddress);
48  int Subscribe (const char *szTopicName);
49  int Shutdown ();
50  int PrepTopic (char *szTopicName,
51  UInt32 iDataSize,
52  int iBufferCount);
53  int Close (int iFileIndex) { return 0;};
54  int WriteData (const char* pcData,
55  unsigned int iDataSize,
56  UInt32 uiTopic);
57  int SetTopicString (UInt32 iTopicId,
58  char *strTopic);
59  int PushData (const char *pData,
60  const int iDataSize);
61  int StartPushData ();
62  int StopPushData ();
63  int PublishSelf (const char *szTopic,
64  const char *pcData,
65  int iDataSize);
66  static bool sDaemonsHaveBeenSetUp;
67 
68 private:
69  Bool m_bInitialized,
70  m_bFailed;
71  int m_iLastBuffer,
72  m_iBufferMax,
73  m_iItemSize,
74  m_iTotalSerialized;
75  UInt32 m_iBufferSize;
76  char m_aacTopicIdToStringMap[GEO_MAX_TOPICS][GEO_MAX_TOPIC_NAME_LENGTH+1];
77 };
78 
79 } // End geometrics namespace
80 
81 #endif
82 #endif /* GMMQTT_HPP_ */
Definition: GmMQTT.hpp:36
Definition: GmStorage.hpp:81
GmApp/GmLoggingApp.hpp>
Definition: Analogs.hpp:47