-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathDeviceData.java
127 lines (119 loc) · 8.48 KB
/
DeviceData.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// automatically generated by the FlatBuffers compiler, do not modify
package solarxr_protocol.data_feed.device_data;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
/**
* Describes all possible information about a hardware device. For example, a
* vive tracker is a single hardware device, and a slime tracker with two
* extensions is a single hardware device but two trackers.
*/
@SuppressWarnings("unused")
public final class DeviceData extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_22_10_26(); }
public static DeviceData getRootAsDeviceData(ByteBuffer _bb) { return getRootAsDeviceData(_bb, new DeviceData()); }
public static DeviceData getRootAsDeviceData(ByteBuffer _bb, DeviceData 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 DeviceData __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; }
/**
* The dynamically changeable name of the device. This might be set by the
* user to help them remember which tracker is which.
*/
public String customName() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; }
public ByteBuffer customNameAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
public ByteBuffer customNameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
/**
* Mostly-static info about the device hardware
*/
public solarxr_protocol.datatypes.hardware_info.HardwareInfo hardwareInfo() { return hardwareInfo(new solarxr_protocol.datatypes.hardware_info.HardwareInfo()); }
public solarxr_protocol.datatypes.hardware_info.HardwareInfo hardwareInfo(solarxr_protocol.datatypes.hardware_info.HardwareInfo obj) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
/**
* General info about the status of the device
*/
public solarxr_protocol.datatypes.hardware_info.HardwareStatus hardwareStatus() { return hardwareStatus(new solarxr_protocol.datatypes.hardware_info.HardwareStatus()); }
public solarxr_protocol.datatypes.hardware_info.HardwareStatus hardwareStatus(solarxr_protocol.datatypes.hardware_info.HardwareStatus obj) { int o = __offset(10); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
/**
* Info about all trackers attached to this device
*/
public solarxr_protocol.data_feed.tracker.TrackerData trackers(int j) { return trackers(new solarxr_protocol.data_feed.tracker.TrackerData(), j); }
public solarxr_protocol.data_feed.tracker.TrackerData trackers(solarxr_protocol.data_feed.tracker.TrackerData obj, int j) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
public int trackersLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; }
public solarxr_protocol.data_feed.tracker.TrackerData.Vector trackersVector() { return trackersVector(new solarxr_protocol.data_feed.tracker.TrackerData.Vector()); }
public solarxr_protocol.data_feed.tracker.TrackerData.Vector trackersVector(solarxr_protocol.data_feed.tracker.TrackerData.Vector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
public String logMessages(int j) { int o = __offset(14); return o != 0 ? __string(__vector(o) + j * 4) : null; }
public int logMessagesLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; }
public StringVector logMessagesVector() { return logMessagesVector(new StringVector()); }
public StringVector logMessagesVector(StringVector obj) { int o = __offset(14); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
public static void startDeviceData(FlatBufferBuilder builder) { builder.startTable(6); }
public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addStruct(0, idOffset, 0); }
public static void addCustomName(FlatBufferBuilder builder, int customNameOffset) { builder.addOffset(1, customNameOffset, 0); }
public static void addHardwareInfo(FlatBufferBuilder builder, int hardwareInfoOffset) { builder.addOffset(2, hardwareInfoOffset, 0); }
public static void addHardwareStatus(FlatBufferBuilder builder, int hardwareStatusOffset) { builder.addOffset(3, hardwareStatusOffset, 0); }
public static void addTrackers(FlatBufferBuilder builder, int trackersOffset) { builder.addOffset(4, trackersOffset, 0); }
public static int createTrackersVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
public static void startTrackersVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static void addLogMessages(FlatBufferBuilder builder, int logMessagesOffset) { builder.addOffset(5, logMessagesOffset, 0); }
public static int createLogMessagesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
public static void startLogMessagesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
public static int endDeviceData(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 DeviceData get(int j) { return get(new DeviceData(), j); }
public DeviceData get(DeviceData obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
public DeviceDataT unpack() {
DeviceDataT _o = new DeviceDataT();
unpackTo(_o);
return _o;
}
public void unpackTo(DeviceDataT _o) {
if (id() != null) id().unpackTo(_o.getId());
else _o.setId(null);
String _oCustomName = customName();
_o.setCustomName(_oCustomName);
if (hardwareInfo() != null) _o.setHardwareInfo(hardwareInfo().unpack());
else _o.setHardwareInfo(null);
if (hardwareStatus() != null) _o.setHardwareStatus(hardwareStatus().unpack());
else _o.setHardwareStatus(null);
solarxr_protocol.data_feed.tracker.TrackerDataT[] _oTrackers = new solarxr_protocol.data_feed.tracker.TrackerDataT[trackersLength()];
for (int _j = 0; _j < trackersLength(); ++_j) {_oTrackers[_j] = (trackers(_j) != null ? trackers(_j).unpack() : null);}
_o.setTrackers(_oTrackers);
String[] _oLogMessages = new String[logMessagesLength()];
for (int _j = 0; _j < logMessagesLength(); ++_j) {_oLogMessages[_j] = logMessages(_j);}
_o.setLogMessages(_oLogMessages);
}
public static int pack(FlatBufferBuilder builder, DeviceDataT _o) {
if (_o == null) return 0;
int _customName = _o.getCustomName() == null ? 0 : builder.createString(_o.getCustomName());
int _hardwareInfo = _o.getHardwareInfo() == null ? 0 : solarxr_protocol.datatypes.hardware_info.HardwareInfo.pack(builder, _o.getHardwareInfo());
int _hardwareStatus = _o.getHardwareStatus() == null ? 0 : solarxr_protocol.datatypes.hardware_info.HardwareStatus.pack(builder, _o.getHardwareStatus());
int _trackers = 0;
if (_o.getTrackers() != null) {
int[] __trackers = new int[_o.getTrackers().length];
int _j = 0;
for (solarxr_protocol.data_feed.tracker.TrackerDataT _e : _o.getTrackers()) { __trackers[_j] = solarxr_protocol.data_feed.tracker.TrackerData.pack(builder, _e); _j++;}
_trackers = createTrackersVector(builder, __trackers);
}
int _logMessages = 0;
if (_o.getLogMessages() != null) {
int[] __logMessages = new int[_o.getLogMessages().length];
int _j = 0;
for (String _e : _o.getLogMessages()) { __logMessages[_j] = builder.createString(_e); _j++;}
_logMessages = createLogMessagesVector(builder, __logMessages);
}
startDeviceData(builder);
addId(builder, solarxr_protocol.datatypes.DeviceId.pack(builder, _o.getId()));
addCustomName(builder, _customName);
addHardwareInfo(builder, _hardwareInfo);
addHardwareStatus(builder, _hardwareStatus);
addTrackers(builder, _trackers);
addLogMessages(builder, _logMessages);
return endDeviceData(builder);
}
}