29#include "ocpn-nlohmann/json.hpp"
30#include "observable/observable.h"
36 auto impl =
dynamic_cast<Api122Impl*
>(wxTheApp);
37 assert(impl &&
"wxTheApp does not implement Api122Impl");
38 return std::make_unique<HostApi122>(
HostApi122(impl));
42 const std::string& plugin_name, std::function<
void(
EventType)> callback) {
43 auto impl =
dynamic_cast<Api122Impl*
>(wxTheApp);
44 assert(impl &&
"wxTheApp does not implement Api122Impl");
45 impl->RegisterApiEventCallback(plugin_name, callback);
49 auto msg = obs::UnpackEvtPointer<SignalkMsg>(ev);
51 root[
"Data"] = msg->raw_message;
52 root[
"Context"] = msg->context;
53 root[
"ContextSelf"] = msg->context_self;
std::unique_ptr< HostApi > GetHostApi()
HostApi factory,.
Unstable development API.
void RegisterApiEventCallback(const std::string &plugin_name, std::function< void(EventType what)> callback)
Register a new callback invoked when an EventType event occurs.
std::string GetSignalkPayload(ObservedEvt ev)
Get SignalK payload after receiving a message.
EventType
Reported events bitmask.
Custom event class for OpenCPN's notification system.
Raw, undecoded messages definitions.
PlugIn Object Definition/API.