diff --git a/Plugin.cmake b/Plugin.cmake index bb2fb3be..04927507 100644 --- a/Plugin.cmake +++ b/Plugin.cmake @@ -33,8 +33,8 @@ set(OCPN_RELEASE_REPO # ------- Plugin setup -------- # set(PKG_NAME radar_pi) -set(PKG_VERSION 5.5.4) -set(PKG_PRERELEASE "") # Empty, or a tag like 'beta' +set(PKG_VERSION 5.5.4730) +set(PKG_PRERELEASE "redhog") # Empty, or a tag like 'beta' set(DISPLAY_NAME radar) # Dialogs, installer artifacts, ... set(PLUGIN_API_NAME Radar) # As of GetCommonName() in plugin API diff --git a/README.md b/README.md index 9b7a8066..38775dec 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +Kahu-exporter +=================================== +This is a branch of `radar_pi` that writes all received radar spokes in msgpack format to a file (or named pipe), `radar-data.msgpack` in the current directory. + radar_pi - Radar Plugin for OpenCPN =================================== diff --git a/include/RadarInfo.h b/include/RadarInfo.h index 8baa0947..a9623361 100644 --- a/include/RadarInfo.h +++ b/include/RadarInfo.h @@ -37,6 +37,9 @@ #include "RadarReceive.h" #include "radar_pi.h" +#include +#include + PLUGIN_BEGIN_NAMESPACE class RadarDraw; @@ -225,6 +228,9 @@ class RadarInfo { time_t m_idle_standby; // When we will change to standby time_t m_idle_transmit; // When we will change to transmit + std::ofstream* radar_data; + msgpack::packer* radar_data_packer; + /* Methods */ RadarInfo(radar_pi* pi, int radar); diff --git a/src/RadarInfo.cpp b/src/RadarInfo.cpp index 1f56a3a1..c52e6648 100644 --- a/src/RadarInfo.cpp +++ b/src/RadarInfo.cpp @@ -143,6 +143,9 @@ RadarInfo::RadarInfo(radar_pi *pi, int radar) { for (size_t z = 0; z < GUARD_ZONES; z++) { m_guard_zone[z] = new GuardZone(m_pi, this, z); } + + radar_data = new std::ofstream("radar-data.msgpack", std::ios::binary); + radar_data_packer = new msgpack::packer(radar_data); } void RadarInfo::Shutdown() { @@ -218,6 +221,9 @@ RadarInfo::~RadarInfo() { delete m_polar_lookup; m_polar_lookup = 0; } + + delete radar_data_packer; + delete radar_data; } /** @@ -460,6 +466,18 @@ void RadarInfo::CalculateRotationSpeed(SpokeBearing angle) { */ void RadarInfo::ProcessRadarSpoke(SpokeBearing angle, SpokeBearing bearing, uint8_t *data, size_t len, int range_meters, wxLongLong time_rec) { + + msgpack::zone zone; + std::map spoke; + spoke["type"] = "spoke"; + spoke["angle"] = angle; + spoke["bearing"] = bearing; + spoke["data"] = msgpack::type::raw_ref((const char*) data, len); + spoke["data_len"] = len; + spoke["range_meters"] = range_meters; + spoke["time_rec"] = time_rec.GetValue(); + radar_data_packer->pack(spoke); + int orientation; int i;