Skip to content

Commit 9b76086

Browse files
Generated messages for LSTS/imc@a751178.
1 parent 1a8ea68 commit 9b76086

File tree

10 files changed

+915
-12
lines changed

10 files changed

+915
-12
lines changed

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 = 'f2ec6ab'
6+
gradle.ext.imcGitHubBranch = 'a751178'
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: 3 additions & 3 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 = "f2ec6ab595976f13ea74539df7f113a1a71b4c41";
35-
public static final String IMC_BRANCH = "f2ec6ab";
36-
public static final String IMC_COMMIT = "Paulo Dias ([email protected]), 2025-02-19T17:19:27Z, https://github.com/LSTS/imc/commit/f2ec6ab595976f13ea74539df7f113a1a71b4c41, Merge branch 'master' into system/caravel";
34+
public static final String IMC_SHA = "a751178768ff78009ab5ae3627342ebd537c7264";
35+
public static final String IMC_BRANCH = "a751178";
36+
public static final String IMC_COMMIT = "Paulo Dias ([email protected]), 2025-05-14T13:17:54Z, https://github.com/LSTS/imc/commit/a751178768ff78009ab5ae3627342ebd537c7264, Added new MessagePartControl to word in conjunction with MessagePart.\nIt is not mandatory to use. A timeout implementation should be used to clear both sides (sender and receiver) from a not completed backlog.";
3737

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

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,8 @@ private IMCMessage createTypedMessage(int mgid, IMCDefinition defs) {
646646
return new SoiState(defs);
647647
case MessagePart.ID_STATIC:
648648
return new MessagePart(defs);
649+
case MessagePartControl.ID_STATIC:
650+
return new MessagePartControl(defs);
649651
case NeptusBlob.ID_STATIC:
650652
return new NeptusBlob(defs);
651653
case Aborted.ID_STATIC:
@@ -706,6 +708,8 @@ private IMCMessage createTypedMessage(int mgid, IMCDefinition defs) {
706708
return new ADCPBeam(defs);
707709
case Frequency.ID_STATIC:
708710
return new Frequency(defs);
711+
case WaveSpectrumParameters.ID_STATIC:
712+
return new WaveSpectrumParameters(defs);
709713
case GpioState.ID_STATIC:
710714
return new GpioState(defs);
711715
case GpioStateGet.ID_STATIC:

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232

3333
/**
3434
* IMC Message Message Fragment (877)<br/>
35+
* This message is used to send a fragment of a message. The<br/>
36+
* fragments are sent in order, and the receiver must reassemble<br/>
37+
* them in the correct order.<br/>
38+
* The receiver can use the MessagePartControl message to inform the sender<br/>
39+
* of the status of the fragment transmission.<br/>
3540
*/
3641

3742
public class MessagePart extends IMCMessage {
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
/*
2+
* Below is the copyright agreement for IMCJava.
3+
*
4+
* Copyright (c) 2010-2025, Laboratório de Sistemas e Tecnologia Subaquática
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
* - Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* - Redistributions in binary form must reproduce the above copyright
12+
* notice, this list of conditions and the following disclaimer in the
13+
* documentation and/or other materials provided with the distribution.
14+
* - Neither the names of IMC, LSTS, IMCJava nor the names of its
15+
* contributors may be used to endorse or promote products derived from
16+
* this software without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL LABORATORIO DE SISTEMAS E TECNOLOGIA SUBAQUATICA
22+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27+
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*
29+
*/
30+
package pt.lsts.imc;
31+
32+
33+
/**
34+
* IMC Message Message Fragment Control (878)<br/>
35+
* This message is used by the receiver of MessageParts messages<br/>
36+
* to inform the sender of the status of the reception of a message<br/>
37+
* in fragments.<br/>
38+
* The sender can then use this information to determine which<br/>
39+
* fragments were received and which ones were not.<br/>
40+
* This message is sent in response to a MessagePart message.<br/>
41+
*/
42+
43+
public class MessagePartControl extends IMCMessage {
44+
45+
public enum OP {
46+
STATUS_RECEIVED(0),
47+
REQUEST_RETRANSMIT(1);
48+
49+
protected long value;
50+
51+
public long value() {
52+
return value;
53+
}
54+
55+
OP(long value) {
56+
this.value = value;
57+
}
58+
}
59+
60+
public static final int ID_STATIC = 878;
61+
62+
public MessagePartControl() {
63+
super(ID_STATIC);
64+
}
65+
66+
public MessagePartControl(IMCMessage msg) {
67+
super(ID_STATIC);
68+
try{
69+
copyFrom(msg);
70+
}
71+
catch (Exception e) {
72+
e.printStackTrace();
73+
}
74+
}
75+
76+
public MessagePartControl(IMCDefinition defs) {
77+
super(defs, ID_STATIC);
78+
}
79+
80+
public static MessagePartControl create(Object... values) {
81+
MessagePartControl m = new MessagePartControl();
82+
for (int i = 0; i < values.length-1; i+= 2)
83+
m.setValue(values[i].toString(), values[i+1]);
84+
return m;
85+
}
86+
87+
public static MessagePartControl clone(IMCMessage msg) throws Exception {
88+
89+
MessagePartControl m = new MessagePartControl();
90+
if (msg == null)
91+
return m;
92+
if(msg.definitions != m.definitions){
93+
msg = msg.cloneMessage();
94+
IMCUtil.updateMessage(msg, m.definitions);
95+
}
96+
else if (msg.getMgid()!=m.getMgid())
97+
throw new Exception("Argument "+msg.getAbbrev()+" is incompatible with message "+m.getAbbrev());
98+
99+
m.getHeader().values.putAll(msg.getHeader().values);
100+
m.values.putAll(msg.values);
101+
return m;
102+
}
103+
104+
public MessagePartControl(short uid, OP op, String frag_ids) {
105+
super(ID_STATIC);
106+
setUid(uid);
107+
setOp(op);
108+
if (frag_ids != null)
109+
setFragIds(frag_ids);
110+
}
111+
112+
/**
113+
* @return Transmission Unique Id - uint8_t
114+
*/
115+
public short getUid() {
116+
return (short) getInteger("uid");
117+
}
118+
119+
/**
120+
* @param uid Transmission Unique Id
121+
*/
122+
public MessagePartControl setUid(short uid) {
123+
values.put("uid", uid);
124+
return this;
125+
}
126+
127+
/**
128+
* @return Operation (enumerated) - uint8_t
129+
*/
130+
public OP getOp() {
131+
try {
132+
OP o = OP.valueOf(getMessageType().getFieldPossibleValues("op").get(getLong("op")));
133+
return o;
134+
}
135+
catch (Exception e) {
136+
return null;
137+
}
138+
}
139+
140+
public String getOpStr() {
141+
return getString("op");
142+
}
143+
144+
public short getOpVal() {
145+
return (short) getInteger("op");
146+
}
147+
148+
/**
149+
* @param op Operation (enumerated)
150+
*/
151+
public MessagePartControl setOp(OP op) {
152+
values.put("op", op.value());
153+
return this;
154+
}
155+
156+
/**
157+
* @param op Operation (as a String)
158+
*/
159+
public MessagePartControl setOpStr(String op) {
160+
setValue("op", op);
161+
return this;
162+
}
163+
164+
/**
165+
* @param op Operation (integer value)
166+
*/
167+
public MessagePartControl setOpVal(short op) {
168+
setValue("op", op);
169+
return this;
170+
}
171+
172+
/**
173+
* @return Fragments IDs - plaintext
174+
*/
175+
public String getFragIds() {
176+
return getString("frag_ids");
177+
}
178+
179+
/**
180+
* @param frag_ids Fragments IDs
181+
*/
182+
public MessagePartControl setFragIds(String frag_ids) {
183+
values.put("frag_ids", frag_ids);
184+
return this;
185+
}
186+
187+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public class RestartSystem extends IMCMessage {
3939

4040
public enum TYPE {
4141
DUNE(1),
42-
SYSTEM(2);
42+
SYSTEM(2),
43+
TASK(3);
4344

4445
protected long value;
4546

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ public TotalHeading(float value) {
8787
}
8888

8989
/**
90-
* @return Value (radians) - fp32_t
90+
* @return Value (rad) - fp32_t
9191
*/
9292
public double getValue() {
9393
return getDouble("value");
9494
}
9595

9696
/**
97-
* @param value Value (radians)
97+
* @param value Value (rad)
9898
*/
9999
public TotalHeading setValue(double value) {
100100
values.put("value", value);

0 commit comments

Comments
 (0)