26 #ifndef _COMMDRIVERN0183NET_H
27 #define _COMMDRIVERN0183NET_H
32 #include <wx/wxprec.h>
38 #include <wx/datetime.h>
39 #include <wx/string.h>
47 #define GSocket GlibGSocket
48 #include <wx/socket.h>
51 #include <wx/socket.h>
55 #include <sys/socket.h>
56 #include <netinet/in.h>
59 #include "model/comm_drv_n0183.h"
60 #include "model/conn_params.h"
61 #include "observable.h"
77 bool SetOutputSocketOptions(wxSocketBase* tsock);
78 bool SendSentenceNetwork(
const wxString& payload);
79 void OnServerSocketEvent(wxSocketEvent& event);
80 void OnTimerSocket(wxTimerEvent& event) { OnTimerSocket(); }
83 void OpenNetworkGPSD();
84 void OpenNetworkTCP(
unsigned int addr);
85 void OpenNetworkUDP(
unsigned int addr);
86 void OnSocketReadWatchdogTimer(wxTimerEvent& event);
89 bool SendMessage(std::shared_ptr<const NavMsg> msg,
90 std::shared_ptr<const NavAddr> addr)
override;
91 wxSocketBase* GetSock()
const {
return m_sock; }
98 wxString GetNetPort()
const {
return m_net_port; }
99 wxIPV4address GetAddr()
const {
return m_addr; }
100 wxTimer* GetSocketThreadWatchdogTimer() {
101 return &m_socketread_watchdog_timer;
103 wxTimer* GetSocketTimer() {
return &m_socket_timer; }
104 void SetSock(wxSocketBase* sock) { m_sock = sock; }
105 void SetTSock(wxSocketBase* sock) { m_tsock = sock; }
106 wxSocketBase* GetTSock()
const {
return m_tsock; }
107 void SetSockServer(wxSocketServer* sock) { m_socket_server = sock; }
108 wxSocketServer* GetSockServer()
const {
return m_socket_server; }
109 void SetMulticast(
bool multicast) { m_is_multicast = multicast; }
110 bool GetMulticast()
const {
return m_is_multicast; }
112 NetworkProtocol GetProtocol() {
return m_net_protocol; }
113 void SetBrxConnectEvent(
bool event) { m_brx_connect_event = event; }
114 bool GetBrxConnectEvent() {
return m_brx_connect_event; }
116 void SetConnectTime(wxDateTime time) { m_connect_time = time; }
117 wxDateTime GetConnectTime() {
return m_connect_time; }
119 dsPortType GetPortType()
const {
return m_io_select; }
120 wxString GetPort()
const {
return m_portstring; }
122 ConnectionType GetConnectionType()
const {
return m_connection_type; }
124 bool ChecksumOK(
const std::string& sentence);
125 void SetOk(
bool ok) { m_bok = ok; };
128 NetworkProtocol m_net_protocol;
129 wxIPV4address m_addr;
130 wxSocketBase* m_sock;
131 wxSocketBase* m_tsock;
132 wxSocketServer* m_socket_server;
138 std::string m_sock_buffer;
139 wxString m_portstring;
140 dsPortType m_io_select;
141 wxDateTime m_connect_time;
142 bool m_brx_connect_event;
143 bool m_bchecksumCheck;
144 ConnectionType m_connection_type;
146 wxTimer m_socket_timer;
147 wxTimer m_socketread_watchdog_timer;
153 DECLARE_EVENT_TABLE()
void OnSocketEvent(wxSocketEvent &event)
Interface implemented by transport layer and possible other parties like test code which should handl...
Define an action to be performed when a KeyProvider is notified.