29#include "ocpn-nlohmann/json.hpp"
30#include "observable/observable.h"
37 auto impl =
dynamic_cast<Api122Impl*
>(wxTheApp);
38 assert(impl &&
"wxTheApp does not implement Api122Impl");
39 return std::make_unique<HostApi123>(
HostApi123(impl));
43 const std::string& plugin_name, std::function<
void(
EventType)> callback) {
44 auto impl =
dynamic_cast<Api122Impl*
>(wxTheApp);
45 assert(impl &&
"wxTheApp does not implement Api122Impl");
46 impl->RegisterApiEventCallback(plugin_name, callback);
50 auto msg = obs::UnpackEvtPointer<SignalkMsg>(ev);
52 root[
"Data"] = msg->raw_message;
53 root[
"Context"] = msg->context;
54 root[
"ContextSelf"] = msg->context_self;
std::unique_ptr< HostApi > GetHostApi()
HostApi factory,.
virtual const std::set< std::string > & GetActiveMessages()
Return currently known messages types flowing through system.
virtual void RegisterApiEventCallback(const std::string &plugin_name, std::function< void(EventType what)> callback)
Register a new callback invoked when an EventType event occurs.
virtual std::string GetSignalkPayload(ObservedEvt ev)
Get SignalK payload after receiving a message.
EventType
Reported events bitmask.
Unstable development API.
const std::set< std::string > & GetActiveMessages()
Return list of message types sent or received.
Custom event class for OpenCPN's notification system.
Raw, undecoded messages definitions.
Raw messages layer, supports sending and recieving navmsg messages.
PlugIn Object Definition/API.