Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firmware tool #125

Merged
merged 11 commits into from
Oct 8, 2024
785 changes: 767 additions & 18 deletions protocol/cpp/include/solarxr_protocol/generated/all_generated.h

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions protocol/java/src/solarxr_protocol/datatypes/DeviceIdTable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// automatically generated by the FlatBuffers compiler, do not modify

package solarxr_protocol.datatypes;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;

/**
* To be used inside unions
*/
@SuppressWarnings("unused")
public final class DeviceIdTable extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_22_10_26(); }
public static DeviceIdTable getRootAsDeviceIdTable(ByteBuffer _bb) { return getRootAsDeviceIdTable(_bb, new DeviceIdTable()); }
public static DeviceIdTable getRootAsDeviceIdTable(ByteBuffer _bb, DeviceIdTable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
public DeviceIdTable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

public solarxr_protocol.datatypes.DeviceId id() { return id(new solarxr_protocol.datatypes.DeviceId()); }
public solarxr_protocol.datatypes.DeviceId id(solarxr_protocol.datatypes.DeviceId obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }

public static void startDeviceIdTable(FlatBufferBuilder builder) { builder.startTable(1); }
public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addStruct(0, idOffset, 0); }
public static int endDeviceIdTable(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
}

public static final class Vector extends BaseVector {
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }

public DeviceIdTable get(int j) { return get(new DeviceIdTable(), j); }
public DeviceIdTable get(DeviceIdTable obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
public DeviceIdTableT unpack() {
DeviceIdTableT _o = new DeviceIdTableT();
unpackTo(_o);
return _o;
}
public void unpackTo(DeviceIdTableT _o) {
if (id() != null) id().unpackTo(_o.getId());
else _o.setId(null);
}
public static int pack(FlatBufferBuilder builder, DeviceIdTableT _o) {
if (_o == null) return 0;
startDeviceIdTable(builder);
addId(builder, solarxr_protocol.datatypes.DeviceId.pack(builder, _o.getId()));
return endDeviceIdTable(builder);
}
}

22 changes: 22 additions & 0 deletions protocol/java/src/solarxr_protocol/datatypes/DeviceIdTableT.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// automatically generated by the FlatBuffers compiler, do not modify

package solarxr_protocol.datatypes;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;

public class DeviceIdTableT {
private solarxr_protocol.datatypes.DeviceIdT id;

public solarxr_protocol.datatypes.DeviceIdT getId() { return id; }

public void setId(solarxr_protocol.datatypes.DeviceIdT id) { this.id = id; }


public DeviceIdTableT() {
this.id = new solarxr_protocol.datatypes.DeviceIdT();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// automatically generated by the FlatBuffers compiler, do not modify

package solarxr_protocol.datatypes.hardware_info;

@SuppressWarnings("unused")
public final class BoardType {
private BoardType() { }
public static final int UNKNOWN = 0;
public static final int SLIMEVR_LEGACY = 1;
public static final int SLIMEVR_DEV = 2;
public static final int NODEMCU = 3;
public static final int CUSTOM = 4;
public static final int WROOM32 = 5;
public static final int WEMOSD1MINI = 6;
public static final int TTGO_TBASE = 7;
public static final int ESP01 = 8;
public static final int SLIMEVR = 9;
public static final int LOLIN_C3_MINI = 10;
public static final int BEETLE32C32 = 11;
public static final int ES32C3DEVKITM1 = 12;

public static final String[] names = { "UNKNOWN", "SLIMEVR_LEGACY", "SLIMEVR_DEV", "NODEMCU", "CUSTOM", "WROOM32", "WEMOSD1MINI", "TTGO_TBASE", "ESP01", "SLIMEVR", "LOLIN_C3_MINI", "BEETLE32C32", "ES32C3DEVKITM1", };

public static String name(int e) { return names[e]; }
}

Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,16 @@ public final class HardwareInfo extends Table {
public solarxr_protocol.datatypes.hardware_info.HardwareAddress hardwareAddress(solarxr_protocol.datatypes.hardware_info.HardwareAddress obj) { int o = __offset(16); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
public solarxr_protocol.datatypes.Ipv4Address ipAddress() { return ipAddress(new solarxr_protocol.datatypes.Ipv4Address()); }
public solarxr_protocol.datatypes.Ipv4Address ipAddress(solarxr_protocol.datatypes.Ipv4Address obj) { int o = __offset(18); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
public String boardType() { int o = __offset(20); return o != 0 ? __string(o + bb_pos) : null; }
public ByteBuffer boardTypeAsByteBuffer() { return __vector_as_bytebuffer(20, 1); }
public ByteBuffer boardTypeInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 20, 1); }
public int boardTypeId() { int o = __offset(22); return o != 0 ? bb.getShort(o + bb_pos) & 0xFFFF : 0; }
/**
* A unique identifier for the device. Depending on the type of device it can be the MAC address,
* the IP address, or some other unique identifier like what USB device it is.
*/
public String hardwareIdentifier() { int o = __offset(22); return o != 0 ? __string(o + bb_pos) : null; }
public ByteBuffer hardwareIdentifierAsByteBuffer() { return __vector_as_bytebuffer(22, 1); }
public ByteBuffer hardwareIdentifierInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 22, 1); }
public String hardwareIdentifier() { int o = __offset(24); return o != 0 ? __string(o + bb_pos) : null; }
public ByteBuffer hardwareIdentifierAsByteBuffer() { return __vector_as_bytebuffer(24, 1); }
public ByteBuffer hardwareIdentifierInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 24, 1); }

public static void startHardwareInfo(FlatBufferBuilder builder) { builder.startTable(10); }
public static void startHardwareInfo(FlatBufferBuilder builder) { builder.startTable(11); }
public static void addMcuId(FlatBufferBuilder builder, int mcuId) { builder.addShort(0, (short) mcuId, (short) 0); }
public static void addDisplayName(FlatBufferBuilder builder, int displayNameOffset) { builder.addOffset(1, displayNameOffset, 0); }
public static void addModel(FlatBufferBuilder builder, int modelOffset) { builder.addOffset(2, modelOffset, 0); }
Expand All @@ -73,8 +71,8 @@ public final class HardwareInfo extends Table {
public static void addFirmwareVersion(FlatBufferBuilder builder, int firmwareVersionOffset) { builder.addOffset(5, firmwareVersionOffset, 0); }
public static void addHardwareAddress(FlatBufferBuilder builder, int hardwareAddressOffset) { builder.addStruct(6, hardwareAddressOffset, 0); }
public static void addIpAddress(FlatBufferBuilder builder, int ipAddressOffset) { builder.addStruct(7, ipAddressOffset, 0); }
public static void addBoardType(FlatBufferBuilder builder, int boardTypeOffset) { builder.addOffset(8, boardTypeOffset, 0); }
public static void addHardwareIdentifier(FlatBufferBuilder builder, int hardwareIdentifierOffset) { builder.addOffset(9, hardwareIdentifierOffset, 0); }
public static void addBoardTypeId(FlatBufferBuilder builder, int boardTypeId) { builder.addShort(9, (short) boardTypeId, (short) 0); }
public static void addHardwareIdentifier(FlatBufferBuilder builder, int hardwareIdentifierOffset) { builder.addOffset(10, hardwareIdentifierOffset, 0); }
public static int endHardwareInfo(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
Expand Down Expand Up @@ -108,8 +106,8 @@ public void unpackTo(HardwareInfoT _o) {
else _o.setHardwareAddress(null);
if (ipAddress() != null) ipAddress().unpackTo(_o.getIpAddress());
else _o.setIpAddress(null);
String _oBoardType = boardType();
_o.setBoardType(_oBoardType);
int _oBoardTypeId = boardTypeId();
_o.setBoardTypeId(_oBoardTypeId);
String _oHardwareIdentifier = hardwareIdentifier();
_o.setHardwareIdentifier(_oHardwareIdentifier);
}
Expand All @@ -120,7 +118,6 @@ public static int pack(FlatBufferBuilder builder, HardwareInfoT _o) {
int _manufacturer = _o.getManufacturer() == null ? 0 : builder.createString(_o.getManufacturer());
int _hardwareRevision = _o.getHardwareRevision() == null ? 0 : builder.createString(_o.getHardwareRevision());
int _firmwareVersion = _o.getFirmwareVersion() == null ? 0 : builder.createString(_o.getFirmwareVersion());
int _boardType = _o.getBoardType() == null ? 0 : builder.createString(_o.getBoardType());
int _hardwareIdentifier = _o.getHardwareIdentifier() == null ? 0 : builder.createString(_o.getHardwareIdentifier());
startHardwareInfo(builder);
addMcuId(builder, _o.getMcuId());
Expand All @@ -131,7 +128,7 @@ public static int pack(FlatBufferBuilder builder, HardwareInfoT _o) {
addFirmwareVersion(builder, _firmwareVersion);
addHardwareAddress(builder, solarxr_protocol.datatypes.hardware_info.HardwareAddress.pack(builder, _o.getHardwareAddress()));
addIpAddress(builder, solarxr_protocol.datatypes.Ipv4Address.pack(builder, _o.getIpAddress()));
addBoardType(builder, _boardType);
addBoardTypeId(builder, _o.getBoardTypeId());
addHardwareIdentifier(builder, _hardwareIdentifier);
return endHardwareInfo(builder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class HardwareInfoT {
private String firmwareVersion;
private solarxr_protocol.datatypes.hardware_info.HardwareAddressT hardwareAddress;
private solarxr_protocol.datatypes.Ipv4AddressT ipAddress;
private String boardType;
private int boardTypeId;
private String hardwareIdentifier;

public int getMcuId() { return mcuId; }
Expand Down Expand Up @@ -51,9 +51,9 @@ public class HardwareInfoT {

public void setIpAddress(solarxr_protocol.datatypes.Ipv4AddressT ipAddress) { this.ipAddress = ipAddress; }

public String getBoardType() { return boardType; }
public int getBoardTypeId() { return boardTypeId; }

public void setBoardType(String boardType) { this.boardType = boardType; }
public void setBoardTypeId(int boardTypeId) { this.boardTypeId = boardTypeId; }

public String getHardwareIdentifier() { return hardwareIdentifier; }

Expand All @@ -69,7 +69,7 @@ public HardwareInfoT() {
this.firmwareVersion = null;
this.hardwareAddress = new solarxr_protocol.datatypes.hardware_info.HardwareAddressT();
this.ipAddress = new solarxr_protocol.datatypes.Ipv4AddressT();
this.boardType = null;
this.boardTypeId = 0;
this.hardwareIdentifier = null;
}
}
Expand Down
26 changes: 0 additions & 26 deletions protocol/java/src/solarxr_protocol/rpc/ArmsResetMode.java

This file was deleted.

25 changes: 0 additions & 25 deletions protocol/java/src/solarxr_protocol/rpc/ArmsResetType.java

This file was deleted.

16 changes: 16 additions & 0 deletions protocol/java/src/solarxr_protocol/rpc/FirmwareDeviceId.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// automatically generated by the FlatBuffers compiler, do not modify

package solarxr_protocol.rpc;

@SuppressWarnings("unused")
public final class FirmwareDeviceId {
private FirmwareDeviceId() { }
public static final byte NONE = 0;
public static final byte solarxr_protocol_datatypes_DeviceIdTable = 1;
public static final byte SerialDeviceId = 2;

public static final String[] names = { "NONE", "solarxr_protocol_datatypes_DeviceIdTable", "SerialDeviceId", };

public static String name(int e) { return names[e]; }
}

35 changes: 35 additions & 0 deletions protocol/java/src/solarxr_protocol/rpc/FirmwareDeviceIdUnion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// automatically generated by the FlatBuffers compiler, do not modify

package solarxr_protocol.rpc;

import com.google.flatbuffers.FlatBufferBuilder;

public class FirmwareDeviceIdUnion {
private byte type;
private Object value;

public byte getType() { return type; }

public void setType(byte type) { this.type = type; }

public Object getValue() { return value; }

public void setValue(Object value) { this.value = value; }

public FirmwareDeviceIdUnion() {
this.type = FirmwareDeviceId.NONE;
this.value = null;
}

public solarxr_protocol.datatypes.DeviceIdTableT assolarxr_protocol_datatypes_DeviceIdTable() { return (solarxr_protocol.datatypes.DeviceIdTableT) value; }
public solarxr_protocol.rpc.SerialDeviceIdT asSerialDeviceId() { return (solarxr_protocol.rpc.SerialDeviceIdT) value; }

public static int pack(FlatBufferBuilder builder, FirmwareDeviceIdUnion _o) {
switch (_o.type) {
case FirmwareDeviceId.solarxr_protocol_datatypes_DeviceIdTable: return solarxr_protocol.datatypes.DeviceIdTable.pack(builder, _o.assolarxr_protocol_datatypes_DeviceIdTable());
case FirmwareDeviceId.SerialDeviceId: return solarxr_protocol.rpc.SerialDeviceId.pack(builder, _o.asSerialDeviceId());
default: return 0;
}
}
}

73 changes: 73 additions & 0 deletions protocol/java/src/solarxr_protocol/rpc/FirmwarePart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// automatically generated by the FlatBuffers compiler, do not modify

package solarxr_protocol.rpc;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;

@SuppressWarnings("unused")
public final class FirmwarePart extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_22_10_26(); }
public static FirmwarePart getRootAsFirmwarePart(ByteBuffer _bb) { return getRootAsFirmwarePart(_bb, new FirmwarePart()); }
public static FirmwarePart getRootAsFirmwarePart(ByteBuffer _bb, FirmwarePart obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
public FirmwarePart __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

/**
* Url of the firmware bin to download
*/
public String url() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
public ByteBuffer urlAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
public ByteBuffer urlInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
/**
* Offset of the firmware, used when flashing to the mcu, it indicates where to write this file in memory
* Will be ignored in the case of OTA flashing
*/
public long offset() { int o = __offset(6); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }

public static int createFirmwarePart(FlatBufferBuilder builder,
int urlOffset,
long offset) {
builder.startTable(2);
FirmwarePart.addOffset(builder, offset);
FirmwarePart.addUrl(builder, urlOffset);
return FirmwarePart.endFirmwarePart(builder);
}

public static void startFirmwarePart(FlatBufferBuilder builder) { builder.startTable(2); }
public static void addUrl(FlatBufferBuilder builder, int urlOffset) { builder.addOffset(0, urlOffset, 0); }
public static void addOffset(FlatBufferBuilder builder, long offset) { builder.addInt(1, (int) offset, (int) 0L); }
public static int endFirmwarePart(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
}

public static final class Vector extends BaseVector {
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }

public FirmwarePart get(int j) { return get(new FirmwarePart(), j); }
public FirmwarePart get(FirmwarePart obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
public FirmwarePartT unpack() {
FirmwarePartT _o = new FirmwarePartT();
unpackTo(_o);
return _o;
}
public void unpackTo(FirmwarePartT _o) {
String _oUrl = url();
_o.setUrl(_oUrl);
long _oOffset = offset();
_o.setOffset(_oOffset);
}
public static int pack(FlatBufferBuilder builder, FirmwarePartT _o) {
if (_o == null) return 0;
int _url = _o.getUrl() == null ? 0 : builder.createString(_o.getUrl());
return createFirmwarePart(
builder,
_url,
_o.getOffset());
}
}

Loading