31#include <unordered_map>
33#include "observable.h"
40enum class CommStatus { Ok, NotImplemented, NotSupported, NameInUse };
51 virtual void Notify(std::shared_ptr<const NavMsg> message) = 0;
64 virtual bool SendMessage(std::shared_ptr<const NavMsg> msg,
65 std::shared_ptr<const NavAddr> addr) = 0;
80 virtual std::pair<CommStatus, std::string>
Clone() {
82 return std::pair<CommStatus, std::string>(CommStatus::NotImplemented,
"");
85 std::string Key()
const {
return NavAddr::BusToString(bus) +
"!@!" +
iface; }
87 const NavAddr::Bus bus;
91 virtual std::unordered_map<std::string, std::string> GetAttributes()
const {
95 std::unordered_map<std::string, std::string> attributes;
99 attributes[
"protocol"] = NavAddr::BusToString(bus);
102 attributes[
"protocol"] = NavAddr::BusToString(bus);
Common interface for all drivers.
virtual void SetListener(DriverListener &l)
Set the entity which will receive incoming data.
const std::string iface
Physical device for 0183, else a unique string.
virtual std::pair< CommStatus, std::string > Clone()
Create a new virtual interface using a new instance of this driver.
Interface implemented by transport layer and possible other parties like test code which should handl...
virtual void Notify(std::shared_ptr< const NavMsg > message)=0
Handle a received message.
virtual void Notify(const AbstractCommDriver &driver)=0
Handle driver status change.
Raw, undecoded messages definitions.