OpenCPN Partial API docs
|
Implement various ocpn_plugin.h methods. More...
#include <memory>
#include <sstream>
#include <vector>
#include <wx/event.h>
#include <wx/jsonval.h>
#include <wx/jsonreader.h>
#include "model/base_platform.h"
#include "model/comm_appmsg.h"
#include "model/comm_drv_n0183_net.h"
#include "model/comm_drv_n0183_serial.h"
#include "model/comm_drv_n2k.h"
#include "model/comm_drv_registry.h"
#include "model/comm_navmsg_bus.h"
#include "ocpn_plugin.h"
Go to the source code of this file.
Functions | |
vector< uint8_t > | GetN2000Payload (NMEA2000Id id, ObservedEvt ev) |
Return N2K payload for a received n2000 message of type id in ev. More... | |
std::string | GetN2000Source (NMEA2000Id id, ObservedEvt ev) |
Return source identifier (iface) of a received n2000 message of type id in ev. | |
std::string | GetN0183Payload (NMEA0183Id id, ObservedEvt ev) |
Return payload in a received n0183 message of type id in ev. | |
std::string | GetPluginMsgPayload (PluginMsgId id, ObservedEvt ev) |
std::shared_ptr< void > | GetSignalkPayload (ObservedEvt ev) |
Get SignalK status payload after receiving a message. More... | |
shared_ptr< ObservableListener > | GetListener (NMEA2000Id id, wxEventType et, wxEvtHandler *eh) |
std::shared_ptr< ObservableListener > | GetListener (NMEA0183Id id, wxEventType et, wxEvtHandler *eh) |
shared_ptr< ObservableListener > | GetListener (SignalkId id, wxEventType et, wxEvtHandler *eh) |
shared_ptr< ObservableListener > | GetListener (NavDataId id, wxEventType et, wxEvtHandler *eh) |
std::shared_ptr< ObservableListener > | GetListener (PluginMsgId id, wxEventType et, wxEvtHandler *eh) |
PluginNavdata | GetEventNavdata (ObservedEvt ev) |
Return BasicNavDataMsg decoded data available in ev. | |
std::vector< DriverHandle > | GetActiveDrivers () |
Comm port plugin TX support methods More... | |
const std::unordered_map< std::string, std::string > | GetAttributes (DriverHandle handle) |
Query a specific driver for attributes More... | |
CommDriverResult | WriteCommDriver (DriverHandle handle, const std::shared_ptr< std::vector< uint8_t >> &payload) |
CommDriverResult | WriteCommDriverN2K (DriverHandle handle, int PGN, int destinationCANAddress, int priority, const std::shared_ptr< std::vector< uint8_t >> &payload) |
Send a PGN message to an NMEA2000 address. More... | |
CommDriverResult | RegisterTXPGNs (DriverHandle handle, std::vector< int > &pgn_list) |
Special NMEA2000 requirements NMEA2000 bus protocol device management requires that devices writing on the bus must inform all bus listeners of the specific PGNs that may be transmitted by this device. More... | |
wxString * | GetpPrivateApplicationDataLocation (void) |
Implement various ocpn_plugin.h methods.
Definition in file plugin_api.cpp.
std::vector<DriverHandle> GetActiveDrivers | ( | ) |
Comm port plugin TX support methods
Query OCPN core for a list of active drivers
Definition at line 136 of file plugin_api.cpp.
const std::unordered_map<std::string, std::string> GetAttributes | ( | DriverHandle | handle | ) |
Query a specific driver for attributes
Query driver attributes
Definition at line 148 of file plugin_api.cpp.
vector<uint8_t> GetN2000Payload | ( | NMEA2000Id | id, |
ObservedEvt | ev | ||
) |
Return N2K payload for a received n2000 message of type id in ev.
The vector returned is described in the following example
[147,19, // Header bytes, unused 3, // N2K priority 16,240,1, // example pgn 126992 encoded little endian 255, // N2K destination address 1, // N2K origin address 255,255,255,255, // timestamp, unused 8, // count of following NMEA2000 data 13,240,207,76,208,3,94,40, // NMEA2000 data 85 // CRC byte, unused,not included in count ];
Definition at line 47 of file plugin_api.cpp.
std::shared_ptr<void> GetSignalkPayload | ( | ObservedEvt | ev | ) |
Get SignalK status payload after receiving a message.
auto ptr = GetSignalkPayload(ev); const auto msg = *std::static_pointer_cast<const wxJSONValue>(payload);The map contains the following entries:
Definition at line 68 of file plugin_api.cpp.
CommDriverResult RegisterTXPGNs | ( | DriverHandle | handle, |
std::vector< int > & | pgn_list | ||
) |
Special NMEA2000 requirements NMEA2000 bus protocol device management requires that devices writing on the bus must inform all bus listeners of the specific PGNs that may be transmitted by this device.
Once configured, this bus management process will be handled transparently by the OCPN core drivers. It is only necessary for plugins wishing to write to the NMEA2000 bus to register the specific PGNs that they anticipate using, with the selected driver.
Definition at line 220 of file plugin_api.cpp.
CommDriverResult WriteCommDriverN2K | ( | DriverHandle | handle, |
int | PGN, | ||
int | destinationCANAddress, | ||
int | priority, | ||
const std::shared_ptr< std::vector< uint8_t >> & | payload | ||
) |