Skip to content

Commit e975867

Browse files
Merge branch 'feature/big-lsfindex'
2 parents a687053 + 238d943 commit e975867

File tree

8 files changed

+419
-89
lines changed

8 files changed

+419
-89
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ext {
1414
}
1515

1616
allprojects {
17-
version = '5.90.8'
17+
version = '5.91.0'
1818
repositories {
1919
mavenCentral()
2020
}

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Set this for the GitHub IMC definition repo
44
gradle.ext.imcGitHubRepo = 'LSTS/imc'
55
// Set this for the branch of the GitHub IMC definition repo
6-
gradle.ext.imcGitHubBranch = 'd4e6ca2'
6+
gradle.ext.imcGitHubBranch = 'f218468'
77
// Set if you want to use the IMC_Addresses.xml or not
88
gradle.ext.imcDownloadIMCAddresses = 'true'
99
// Set this for the folder IMC definition repo

src-generated/java/pt/lsts/imc/ImcStringDefs.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131

3232
public class ImcStringDefs {
3333

34-
public static final String IMC_SHA = "d4e6ca252e8825d7beeafba491b40c4152d75816";
34+
public static final String IMC_SHA = "f218468c26c439e03217d7179aa27c159ef08516";
3535
public static final String IMC_BRANCH = "master";
36-
public static final String IMC_COMMIT = "Paulo Dias (paulo.sousa.dias@gmail.com), 2026-01-06T13:05:29Z, https://github.com/LSTS/imc/commit/d4e6ca252e8825d7beeafba491b40c4152d75816, Fix typo on message group.";
36+
public static final String IMC_COMMIT = "Bernardo Gabriel (bernardo.gabriel@lsts.pt), 2026-01-06T16:45:21Z, https://github.com/LSTS/imc/commit/f218468c26c439e03217d7179aa27c159ef08516, Change 'id' to 'name' in Operation field enumeration descriptions and increase max value to 7.";
3737

3838
public static java.util.Map<String, Integer> IMC_ADDRESSES = new java.util.LinkedHashMap<String, Integer>();
3939

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
d4e6ca252e8825d7beeafba491b40c4152d75816
2-
d4e6ca2
3-
url: https://api.github.com/repos/LSTS/imc/commits/d4e6ca2
1+
f218468c26c439e03217d7179aa27c159ef08516
2+
f218468
3+
url: https://api.github.com/repos/LSTS/imc/commits/f218468

src-generated/resources/xml/IMC.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4024,52 +4024,52 @@
40244024
The name of the power channel.
40254025
</description>
40264026
</field>
4027-
<field name="Operation" abbrev="op" type="uint8_t" unit="Enumerated" max="6" prefix="PCC_OP">
4027+
<field name="Operation" abbrev="op" type="uint8_t" unit="Enumerated" max="7" prefix="PCC_OP">
40284028
<description>
40294029
Operation to perform.
40304030
</description>
40314031
<value id="0" name="Turn Off" abbrev="TURN_OFF">
40324032
<description>
4033-
Turn off power channel specified in field 'id'.
4033+
Turn off power channel specified in field 'name'.
40344034
</description>
40354035
</value>
40364036
<value id="1" name="Turn On" abbrev="TURN_ON">
40374037
<description>
4038-
Turn on power channel specified in field 'id'.
4038+
Turn on power channel specified in field 'name'.
40394039
</description>
40404040
</value>
40414041
<value id="2" name="Toggle" abbrev="TOGGLE">
40424042
<description>
4043-
Toggle power channel specified in field 'id'.
4043+
Toggle power channel specified in field 'name'.
40444044
</description>
40454045
</value>
40464046
<value id="3" name="Schedule Turn On" abbrev="SCHED_ON">
40474047
<description>
4048-
Turn on power channel specified in field 'id' in
4048+
Turn on power channel specified in field 'name' in
40494049
'sched_time' seconds.
40504050
</description>
40514051
</value>
40524052
<value id="4" name="Schedule Turn Off" abbrev="SCHED_OFF">
40534053
<description>
4054-
Turn off power channel specified in field 'id' in
4054+
Turn off power channel specified in field 'name' in
40554055
'sched_time' seconds.
40564056
</description>
40574057
</value>
40584058
<value id="5" name="Reset Schedules" abbrev="SCHED_RESET">
40594059
<description>
40604060
Reset all scheduled operations for the channel specified in
4061-
field 'id'.
4061+
field 'name'.
40624062
</description>
40634063
</value>
40644064
<value id="6" name="Save Current State" abbrev="SAVE">
40654065
<description>
4066-
Save the current state of the channel 'id' to persistent
4066+
Save the current state of the channel 'name' to persistent
40674067
storage.
40684068
</description>
40694069
</value>
40704070
<value id="7" name="Restart" abbrev="RESTART">
40714071
<description>
4072-
Restart power channel specified in field 'id'.
4072+
Restart power channel specified in field 'name'.
40734073
</description>
40744074
</value>
40754075
</field>

src/java/pt/lsts/imc/IMCDefinition.java

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import pt.lsts.imc.def.ProtocolDefinition;
5959
import pt.lsts.imc.def.ValueDescriptor;
6060
import pt.lsts.imc.gz.MultiMemberGZIPInputStream;
61+
import pt.lsts.imc.lsf.BigByteBuffer;
6162
import pt.lsts.neptus.messages.IMessageProtocol;
6263

6364
/**
@@ -443,6 +444,62 @@ else if (sync == syncWord)
443444
}
444445
}
445446

447+
public IMCMessage nextMessage(BigByteBuffer buff) throws Exception {
448+
IMCMessage msg;
449+
do {
450+
msg = nextMessageWorkerNonRecursive(buff);
451+
} while (msg == null);
452+
return msg;
453+
}
454+
455+
public IMCMessage nextMessageWorkerNonRecursive(BigByteBuffer buff) throws Exception {
456+
Header header = createHeader();
457+
long sync = buff.getShort() & 0xFFFF;
458+
if (sync == swappedWord)
459+
buff.order(ByteOrder.LITTLE_ENDIAN);
460+
else if (sync == syncWord)
461+
header.setValue("sync", syncWord);
462+
else {
463+
System.err.printf(
464+
"Found a message with invalid sync (%X) was skipped\n",
465+
sync);
466+
byte[] tmp = new byte[header.getInteger("size") + 2];
467+
buff.get(tmp);
468+
return null; //nextMessage(buff);
469+
}
470+
471+
byte[] tmp = new byte[header.getMessageType().getComputedLength() - 2];
472+
buff.get(tmp);
473+
ByteBuffer byteBuffer = ByteBuffer.wrap(tmp);
474+
byteBuffer.order(buff.order());
475+
476+
deserializeAllFieldsBut(header, byteBuffer, "sync");
477+
478+
// get the remainer of the message
479+
tmp = new byte[header.getInteger("size") + 2];
480+
buff.get(tmp);
481+
byteBuffer = ByteBuffer.wrap(tmp);
482+
byteBuffer.order(buff.order());
483+
484+
IMCMessageType type = getType(getMessageName(header.get_mgid()));
485+
if (type != null) {
486+
IMCMessage message = MessageFactory
487+
.getInstance()
488+
.createTypedMessage(getMessageName(header.get_mgid()), this);
489+
message.setHeader(header);
490+
message.setType(type);
491+
deserializeFields(message, byteBuffer);
492+
deserialize(IMCFieldType.TYPE_UINT16, byteBuffer); // footer
493+
return message;
494+
} else {
495+
System.err.println("Unknown message type was skipped: "
496+
+ header.getInteger("mgid"));
497+
// byte[] tmp = new byte[header.getInteger("size") + 2];
498+
// buff.get(tmp);
499+
return null; //nextMessage(buff);
500+
}
501+
}
502+
446503
/**
447504
* Read a message header from the given IMCInputStream
448505
*

0 commit comments

Comments
 (0)