OpenCPN Partial API docs
Loading...
Searching...
No Matches
comm_navmsg_bus.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: Raw messages layer, supports sending and recieving navmsg
5 * messages. This is the second layer in the three tier model
6 * drivers, raw messages and application messages.
7 * Author: David Register, Alec Leamas
8 *
9 ***************************************************************************
10 * Copyright (C) 2022 by David Register, Alec Leamas *
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 * This program is distributed in the hope that it will be useful, *
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20 * GNU General Public License for more details. *
21 * *
22 * You should have received a copy of the GNU General Public License *
23 * along with this program; if not, write to the *
24 * Free Software Foundation, Inc., *
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
26 **************************************************************************/
27
28/* API handling raw partially decoded messages. */
29
30#ifndef _NAVMSG_BUS_H__
31#define _NAVMSG_BUS_H__
32
33#include <memory>
34#include <vector>
35
36#include <wx/event.h>
37#include <wx/jsonreader.h>
38
39#include "comm_driver.h"
40
41
43class NavMsgBus : public DriverListener {
44public:
45 /* Singleton implementation. */
46 static NavMsgBus& GetInstance();
47
48 NavMsgBus& operator=(NavMsgBus&) = delete;
49 NavMsgBus(const NavMsgBus&) = delete;
50
51 void SendMessage(std::shared_ptr<const NavMsg> message,
52 std::shared_ptr<const NavAddr> address);
53
54 void Notify(std::shared_ptr<const NavMsg> message);
55
56 /* DriverListener implementation: */
57 void Notify(const AbstractCommDriver& driver);
58
59private:
60 NavMsgBus() = default;
61};
62
63#endif // NAVMSG_BUS_H
Common interface for all drivers.
Definition: comm_driver.h:58
Interface implemented by transport layer and possible other parties like test code which should handl...
Definition: comm_driver.h:47
The raw message layer, a singleton.
void Notify(std::shared_ptr< const NavMsg > message)
Handle a received message.