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
777 changes: 771 additions & 6 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,25 @@ 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; }
/**
* A board type string that can be used to name a board. if possible you should use official board type
*/
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); }
/**
* An enum listing all the board types supported by the firmware
*/
public int officialBoardType() { 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 @@ -74,7 +81,8 @@ public final class HardwareInfo extends Table {
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 addOfficialBoardType(FlatBufferBuilder builder, int officialBoardType) { builder.addShort(9, (short) officialBoardType, (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 @@ -110,6 +118,8 @@ public void unpackTo(HardwareInfoT _o) {
else _o.setIpAddress(null);
String _oBoardType = boardType();
_o.setBoardType(_oBoardType);
int _oOfficialBoardType = officialBoardType();
_o.setOfficialBoardType(_oOfficialBoardType);
String _oHardwareIdentifier = hardwareIdentifier();
_o.setHardwareIdentifier(_oHardwareIdentifier);
}
Expand All @@ -132,6 +142,7 @@ public static int pack(FlatBufferBuilder builder, HardwareInfoT _o) {
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);
addOfficialBoardType(builder, _o.getOfficialBoardType());
addHardwareIdentifier(builder, _hardwareIdentifier);
return endHardwareInfo(builder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class HardwareInfoT {
private solarxr_protocol.datatypes.hardware_info.HardwareAddressT hardwareAddress;
private solarxr_protocol.datatypes.Ipv4AddressT ipAddress;
private String boardType;
private int officialBoardType;
private String hardwareIdentifier;

public int getMcuId() { return mcuId; }
Expand Down Expand Up @@ -55,6 +56,10 @@ public class HardwareInfoT {

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

public int getOfficialBoardType() { return officialBoardType; }

public void setOfficialBoardType(int officialBoardType) { this.officialBoardType = officialBoardType; }

public String getHardwareIdentifier() { return hardwareIdentifier; }

public void setHardwareIdentifier(String hardwareIdentifier) { this.hardwareIdentifier = hardwareIdentifier; }
Expand All @@ -70,6 +75,7 @@ public HardwareInfoT() {
this.hardwareAddress = new solarxr_protocol.datatypes.hardware_info.HardwareAddressT();
this.ipAddress = new solarxr_protocol.datatypes.Ipv4AddressT();
this.boardType = null;
this.officialBoardType = 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.

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());
}
}

28 changes: 28 additions & 0 deletions protocol/java/src/solarxr_protocol/rpc/FirmwarePartT.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// 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.*;

public class FirmwarePartT {
private String url;
private long offset;

public String getUrl() { return url; }

public void setUrl(String url) { this.url = url; }

public long getOffset() { return offset; }

public void setOffset(long offset) { this.offset = offset; }


public FirmwarePartT() {
this.url = null;
this.offset = 0L;
}
}

16 changes: 16 additions & 0 deletions protocol/java/src/solarxr_protocol/rpc/FirmwareUpdateDeviceId.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 FirmwareUpdateDeviceId {
private FirmwareUpdateDeviceId() { }
public static final byte NONE = 0;
public static final byte solarxr_protocol_datatypes_DeviceIdTable = 1;
public static final byte SerialDevicePort = 2;

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

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

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 FirmwareUpdateDeviceIdUnion {
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 FirmwareUpdateDeviceIdUnion() {
this.type = FirmwareUpdateDeviceId.NONE;
this.value = null;
}

public solarxr_protocol.datatypes.DeviceIdTableT assolarxr_protocol_datatypes_DeviceIdTable() { return (solarxr_protocol.datatypes.DeviceIdTableT) value; }
public solarxr_protocol.rpc.SerialDevicePortT asSerialDevicePort() { return (solarxr_protocol.rpc.SerialDevicePortT) value; }

public static int pack(FlatBufferBuilder builder, FirmwareUpdateDeviceIdUnion _o) {
switch (_o.type) {
case FirmwareUpdateDeviceId.solarxr_protocol_datatypes_DeviceIdTable: return solarxr_protocol.datatypes.DeviceIdTable.pack(builder, _o.assolarxr_protocol_datatypes_DeviceIdTable());
case FirmwareUpdateDeviceId.SerialDevicePort: return solarxr_protocol.rpc.SerialDevicePort.pack(builder, _o.asSerialDevicePort());
default: return 0;
}
}
}

Loading