Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions protocol/cpp/include/solarxr_protocol/generated/all_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -3626,7 +3626,10 @@ struct HardwareStatus FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VT_MCU_TEMP = 12,
VT_BATTERY_VOLTAGE = 14,
VT_BATTERY_PCT_ESTIMATE = 16,
VT_LOG_DATA = 18
VT_LOG_DATA = 18,
VT_PACKET_LOSS = 20,
VT_PACKETS_LOST = 22,
VT_PACKETS_RECEIVED = 24
};
flatbuffers::Optional<solarxr_protocol::datatypes::FirmwareErrorCode> error_status() const {
return GetOptional<uint8_t, solarxr_protocol::datatypes::FirmwareErrorCode>(VT_ERROR_STATUS);
Expand All @@ -3651,6 +3654,15 @@ struct HardwareStatus FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const solarxr_protocol::datatypes::LogData *log_data() const {
return GetPointer<const solarxr_protocol::datatypes::LogData *>(VT_LOG_DATA);
}
flatbuffers::Optional<float> packet_loss() const {
return GetOptional<float, float>(VT_PACKET_LOSS);
}
flatbuffers::Optional<int32_t> packets_lost() const {
return GetOptional<int32_t, int32_t>(VT_PACKETS_LOST);
}
flatbuffers::Optional<int32_t> packets_received() const {
return GetOptional<int32_t, int32_t>(VT_PACKETS_RECEIVED);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint8_t>(verifier, VT_ERROR_STATUS, 1) &&
Expand All @@ -3661,6 +3673,9 @@ struct HardwareStatus FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VerifyField<uint8_t>(verifier, VT_BATTERY_PCT_ESTIMATE, 1) &&
VerifyOffset(verifier, VT_LOG_DATA) &&
verifier.VerifyTable(log_data()) &&
VerifyField<float>(verifier, VT_PACKET_LOSS, 4) &&
VerifyField<int32_t>(verifier, VT_PACKETS_LOST, 4) &&
VerifyField<int32_t>(verifier, VT_PACKETS_RECEIVED, 4) &&
verifier.EndTable();
}
};
Expand Down Expand Up @@ -3690,6 +3705,15 @@ struct HardwareStatusBuilder {
void add_log_data(flatbuffers::Offset<solarxr_protocol::datatypes::LogData> log_data) {
fbb_.AddOffset(HardwareStatus::VT_LOG_DATA, log_data);
}
void add_packet_loss(float packet_loss) {
fbb_.AddElement<float>(HardwareStatus::VT_PACKET_LOSS, packet_loss);
}
void add_packets_lost(int32_t packets_lost) {
fbb_.AddElement<int32_t>(HardwareStatus::VT_PACKETS_LOST, packets_lost);
}
void add_packets_received(int32_t packets_received) {
fbb_.AddElement<int32_t>(HardwareStatus::VT_PACKETS_RECEIVED, packets_received);
}
explicit HardwareStatusBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
Expand All @@ -3709,8 +3733,14 @@ inline flatbuffers::Offset<HardwareStatus> CreateHardwareStatus(
flatbuffers::Optional<float> mcu_temp = flatbuffers::nullopt,
flatbuffers::Optional<float> battery_voltage = flatbuffers::nullopt,
flatbuffers::Optional<uint8_t> battery_pct_estimate = flatbuffers::nullopt,
flatbuffers::Offset<solarxr_protocol::datatypes::LogData> log_data = 0) {
flatbuffers::Offset<solarxr_protocol::datatypes::LogData> log_data = 0,
flatbuffers::Optional<float> packet_loss = flatbuffers::nullopt,
flatbuffers::Optional<int32_t> packets_lost = flatbuffers::nullopt,
flatbuffers::Optional<int32_t> packets_received = flatbuffers::nullopt) {
HardwareStatusBuilder builder_(_fbb);
if(packets_received) { builder_.add_packets_received(*packets_received); }
if(packets_lost) { builder_.add_packets_lost(*packets_lost); }
if(packet_loss) { builder_.add_packet_loss(*packet_loss); }
builder_.add_log_data(log_data);
if(battery_voltage) { builder_.add_battery_voltage(*battery_voltage); }
if(mcu_temp) { builder_.add_mcu_temp(*mcu_temp); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public final class HardwareStatus extends Table {
public int batteryPctEstimate() { int o = __offset(16); return o != 0 ? bb.get(o + bb_pos) & 0xFF : 0; }
public solarxr_protocol.datatypes.LogData logData() { return logData(new solarxr_protocol.datatypes.LogData()); }
public solarxr_protocol.datatypes.LogData logData(solarxr_protocol.datatypes.LogData obj) { int o = __offset(18); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
public boolean hasPacketLoss() { return 0 != __offset(20); }
public float packetLoss() { int o = __offset(20); return o != 0 ? bb.getFloat(o + bb_pos) : 0f; }
public boolean hasPacketsLost() { return 0 != __offset(22); }
public int packetsLost() { int o = __offset(22); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
public boolean hasPacketsReceived() { return 0 != __offset(24); }
public int packetsReceived() { int o = __offset(24); return o != 0 ? bb.getInt(o + bb_pos) : 0; }

public static int createHardwareStatus(FlatBufferBuilder builder,
int errorStatus,
Expand All @@ -46,8 +52,14 @@ public static int createHardwareStatus(FlatBufferBuilder builder,
float mcuTemp,
float batteryVoltage,
int batteryPctEstimate,
int logDataOffset) {
builder.startTable(8);
int logDataOffset,
float packetLoss,
int packetsLost,
int packetsReceived) {
builder.startTable(11);
HardwareStatus.addPacketsReceived(builder, packetsReceived);
HardwareStatus.addPacketsLost(builder, packetsLost);
HardwareStatus.addPacketLoss(builder, packetLoss);
HardwareStatus.addLogData(builder, logDataOffset);
HardwareStatus.addBatteryVoltage(builder, batteryVoltage);
HardwareStatus.addMcuTemp(builder, mcuTemp);
Expand All @@ -58,14 +70,17 @@ public static int createHardwareStatus(FlatBufferBuilder builder,
return HardwareStatus.endHardwareStatus(builder);
}

public static void startHardwareStatus(FlatBufferBuilder builder) { builder.startTable(8); }
public static void startHardwareStatus(FlatBufferBuilder builder) { builder.startTable(11); }
public static void addErrorStatus(FlatBufferBuilder builder, int errorStatus) { builder.addByte(0, (byte) errorStatus, (byte) 0); }
public static void addPing(FlatBufferBuilder builder, int ping) { builder.addShort(2, (short) ping, (short) 0); }
public static void addRssi(FlatBufferBuilder builder, short rssi) { builder.addShort(3, rssi, 0); }
public static void addMcuTemp(FlatBufferBuilder builder, float mcuTemp) { builder.addFloat(4, mcuTemp, 0f); }
public static void addBatteryVoltage(FlatBufferBuilder builder, float batteryVoltage) { builder.addFloat(5, batteryVoltage, 0f); }
public static void addBatteryPctEstimate(FlatBufferBuilder builder, int batteryPctEstimate) { builder.addByte(6, (byte) batteryPctEstimate, (byte) 0); }
public static void addLogData(FlatBufferBuilder builder, int logDataOffset) { builder.addOffset(7, logDataOffset, 0); }
public static void addPacketLoss(FlatBufferBuilder builder, float packetLoss) { builder.addFloat(8, packetLoss, 0f); }
public static void addPacketsLost(FlatBufferBuilder builder, int packetsLost) { builder.addInt(9, packetsLost, 0); }
public static void addPacketsReceived(FlatBufferBuilder builder, int packetsReceived) { builder.addInt(10, packetsReceived, 0); }
public static int endHardwareStatus(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
Expand Down Expand Up @@ -97,6 +112,12 @@ public void unpackTo(HardwareStatusT _o) {
_o.setBatteryPctEstimate(_oBatteryPctEstimate);
if (logData() != null) _o.setLogData(logData().unpack());
else _o.setLogData(null);
Float _oPacketLoss = hasPacketLoss() ? packetLoss() : null;
_o.setPacketLoss(_oPacketLoss);
Integer _oPacketsLost = hasPacketsLost() ? packetsLost() : null;
_o.setPacketsLost(_oPacketsLost);
Integer _oPacketsReceived = hasPacketsReceived() ? packetsReceived() : null;
_o.setPacketsReceived(_oPacketsReceived);
}
public static int pack(FlatBufferBuilder builder, HardwareStatusT _o) {
if (_o == null) return 0;
Expand All @@ -109,7 +130,10 @@ public static int pack(FlatBufferBuilder builder, HardwareStatusT _o) {
_o.getMcuTemp(),
_o.getBatteryVoltage(),
_o.getBatteryPctEstimate(),
_logData);
_logData,
_o.getPacketLoss(),
_o.getPacketsLost(),
_o.getPacketsReceived());
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class HardwareStatusT {
private Float batteryVoltage;
private Integer batteryPctEstimate;
private solarxr_protocol.datatypes.LogDataT logData;
private Float packetLoss;
private Integer packetsLost;
private Integer packetsReceived;

public Integer getErrorStatus() { return errorStatus; }

Expand Down Expand Up @@ -44,6 +47,18 @@ public class HardwareStatusT {

public void setLogData(solarxr_protocol.datatypes.LogDataT logData) { this.logData = logData; }

public Float getPacketLoss() { return packetLoss; }

public void setPacketLoss(Float packetLoss) { this.packetLoss = packetLoss; }

public Integer getPacketsLost() { return packetsLost; }

public void setPacketsLost(Integer packetsLost) { this.packetsLost = packetsLost; }

public Integer getPacketsReceived() { return packetsReceived; }

public void setPacketsReceived(Integer packetsReceived) { this.packetsReceived = packetsReceived; }


public HardwareStatusT() {
this.errorStatus = null;
Expand All @@ -53,6 +68,9 @@ public HardwareStatusT() {
this.batteryVoltage = null;
this.batteryPctEstimate = null;
this.logData = null;
this.packetLoss = null;
this.packetsLost = null;
this.packetsReceived = null;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@ class HardwareStatus : Table() {
null
}
}
val packetLoss : Float?
get() {
val o = __offset(20)
return if(o != 0) bb.getFloat(o + bb_pos) else null
}
val packetsLost : Int?
get() {
val o = __offset(22)
return if(o != 0) bb.getInt(o + bb_pos) else null
}
val packetsReceived : Int?
get() {
val o = __offset(24)
return if(o != 0) bb.getInt(o + bb_pos) else null
}
companion object {
@JvmStatic
fun validateVersion() = Constants.FLATBUFFERS_22_10_26()
Expand All @@ -75,8 +90,11 @@ class HardwareStatus : Table() {
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
}
@JvmStatic
fun createHardwareStatus(builder: FlatBufferBuilder, errorStatus: UByte?, ping: UShort?, rssi: Short?, mcuTemp: Float?, batteryVoltage: Float?, batteryPctEstimate: UByte?, logDataOffset: Int) : Int {
builder.startTable(8)
fun createHardwareStatus(builder: FlatBufferBuilder, errorStatus: UByte?, ping: UShort?, rssi: Short?, mcuTemp: Float?, batteryVoltage: Float?, batteryPctEstimate: UByte?, logDataOffset: Int, packetLoss: Float?, packetsLost: Int?, packetsReceived: Int?) : Int {
builder.startTable(11)
packetsReceived?.run { addPacketsReceived(builder, packetsReceived) }
packetsLost?.run { addPacketsLost(builder, packetsLost) }
packetLoss?.run { addPacketLoss(builder, packetLoss) }
addLogData(builder, logDataOffset)
batteryVoltage?.run { addBatteryVoltage(builder, batteryVoltage) }
mcuTemp?.run { addMcuTemp(builder, mcuTemp) }
Expand All @@ -87,7 +105,7 @@ class HardwareStatus : Table() {
return endHardwareStatus(builder)
}
@JvmStatic
fun startHardwareStatus(builder: FlatBufferBuilder) = builder.startTable(8)
fun startHardwareStatus(builder: FlatBufferBuilder) = builder.startTable(11)
@JvmStatic
fun addErrorStatus(builder: FlatBufferBuilder, errorStatus: UByte) = builder.addByte(0, errorStatus.toByte(), 0)
@JvmStatic
Expand All @@ -103,6 +121,12 @@ class HardwareStatus : Table() {
@JvmStatic
fun addLogData(builder: FlatBufferBuilder, logData: Int) = builder.addOffset(7, logData, 0)
@JvmStatic
fun addPacketLoss(builder: FlatBufferBuilder, packetLoss: Float) = builder.addFloat(8, packetLoss, 0.0)
@JvmStatic
fun addPacketsLost(builder: FlatBufferBuilder, packetsLost: Int) = builder.addInt(9, packetsLost, 0)
@JvmStatic
fun addPacketsReceived(builder: FlatBufferBuilder, packetsReceived: Int) = builder.addInt(10, packetsReceived, 0)
@JvmStatic
fun endHardwareStatus(builder: FlatBufferBuilder) : Int {
val o = builder.endTable()
return o
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ impl<'a> HardwareStatus<'a> {
pub const VT_BATTERY_VOLTAGE: flatbuffers::VOffsetT = 14;
pub const VT_BATTERY_PCT_ESTIMATE: flatbuffers::VOffsetT = 16;
pub const VT_LOG_DATA: flatbuffers::VOffsetT = 18;
pub const VT_PACKET_LOSS: flatbuffers::VOffsetT = 20;
pub const VT_PACKETS_LOST: flatbuffers::VOffsetT = 22;
pub const VT_PACKETS_RECEIVED: flatbuffers::VOffsetT = 24;

#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Expand All @@ -44,6 +47,9 @@ impl<'a> HardwareStatus<'a> {
args: &'args HardwareStatusArgs<'args>
) -> flatbuffers::WIPOffset<HardwareStatus<'bldr>> {
let mut builder = HardwareStatusBuilder::new(_fbb);
if let Some(x) = args.packets_received { builder.add_packets_received(x); }
if let Some(x) = args.packets_lost { builder.add_packets_lost(x); }
if let Some(x) = args.packet_loss { builder.add_packet_loss(x); }
if let Some(x) = args.log_data { builder.add_log_data(x); }
if let Some(x) = args.battery_voltage { builder.add_battery_voltage(x); }
if let Some(x) = args.mcu_temp { builder.add_mcu_temp(x); }
Expand Down Expand Up @@ -106,6 +112,27 @@ impl<'a> HardwareStatus<'a> {
// which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<super::LogData>>(HardwareStatus::VT_LOG_DATA, None)}
}
#[inline]
pub fn packet_loss(&self) -> Option<f32> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<f32>(HardwareStatus::VT_PACKET_LOSS, None)}
}
#[inline]
pub fn packets_lost(&self) -> Option<i32> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<i32>(HardwareStatus::VT_PACKETS_LOST, None)}
}
#[inline]
pub fn packets_received(&self) -> Option<i32> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<i32>(HardwareStatus::VT_PACKETS_RECEIVED, None)}
}
}

impl flatbuffers::Verifiable for HardwareStatus<'_> {
Expand All @@ -122,6 +149,9 @@ impl flatbuffers::Verifiable for HardwareStatus<'_> {
.visit_field::<f32>("battery_voltage", Self::VT_BATTERY_VOLTAGE, false)?
.visit_field::<u8>("battery_pct_estimate", Self::VT_BATTERY_PCT_ESTIMATE, false)?
.visit_field::<flatbuffers::ForwardsUOffset<super::LogData>>("log_data", Self::VT_LOG_DATA, false)?
.visit_field::<f32>("packet_loss", Self::VT_PACKET_LOSS, false)?
.visit_field::<i32>("packets_lost", Self::VT_PACKETS_LOST, false)?
.visit_field::<i32>("packets_received", Self::VT_PACKETS_RECEIVED, false)?
.finish();
Ok(())
}
Expand All @@ -134,6 +164,9 @@ pub struct HardwareStatusArgs<'a> {
pub battery_voltage: Option<f32>,
pub battery_pct_estimate: Option<u8>,
pub log_data: Option<flatbuffers::WIPOffset<super::LogData<'a>>>,
pub packet_loss: Option<f32>,
pub packets_lost: Option<i32>,
pub packets_received: Option<i32>,
}
impl<'a> Default for HardwareStatusArgs<'a> {
#[inline]
Expand All @@ -146,6 +179,9 @@ impl<'a> Default for HardwareStatusArgs<'a> {
battery_voltage: None,
battery_pct_estimate: None,
log_data: None,
packet_loss: None,
packets_lost: None,
packets_received: None,
}
}
}
Expand Down Expand Up @@ -184,6 +220,18 @@ impl<'a: 'b, 'b> HardwareStatusBuilder<'a, 'b> {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<super::LogData>>(HardwareStatus::VT_LOG_DATA, log_data);
}
#[inline]
pub fn add_packet_loss(&mut self, packet_loss: f32) {
self.fbb_.push_slot_always::<f32>(HardwareStatus::VT_PACKET_LOSS, packet_loss);
}
#[inline]
pub fn add_packets_lost(&mut self, packets_lost: i32) {
self.fbb_.push_slot_always::<i32>(HardwareStatus::VT_PACKETS_LOST, packets_lost);
}
#[inline]
pub fn add_packets_received(&mut self, packets_received: i32) {
self.fbb_.push_slot_always::<i32>(HardwareStatus::VT_PACKETS_RECEIVED, packets_received);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> HardwareStatusBuilder<'a, 'b> {
let start = _fbb.start_table();
HardwareStatusBuilder {
Expand All @@ -208,6 +256,9 @@ impl core::fmt::Debug for HardwareStatus<'_> {
ds.field("battery_voltage", &self.battery_voltage());
ds.field("battery_pct_estimate", &self.battery_pct_estimate());
ds.field("log_data", &self.log_data());
ds.field("packet_loss", &self.packet_loss());
ds.field("packets_lost", &self.packets_lost());
ds.field("packets_received", &self.packets_received());
ds.finish()
}
}
Loading