Skip to content

Commit 06bca89

Browse files
Generated messages for LSTS/imc@39ddea1.
1 parent bf32f7a commit 06bca89

11 files changed

Lines changed: 1628 additions & 7 deletions

File tree

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 = 'addc044'
6+
gradle.ext.imcGitHubBranch = '39ddea1'
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
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
* Below is the copyright agreement for IMCJava.
3+
*
4+
* Copyright (c) 2010-2026, 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 Battery Detailed Info (2035)<br/>
35+
* Deprecated: use QueryBmsData/BmsData instead. Used to debug the state of a BMS.<br/>
36+
*/
37+
38+
public class BDI extends IMCMessage {
39+
40+
public static final int ID_STATIC = 2035;
41+
42+
public BDI() {
43+
super(ID_STATIC);
44+
}
45+
46+
public BDI(IMCMessage msg) {
47+
super(ID_STATIC);
48+
try{
49+
copyFrom(msg);
50+
}
51+
catch (Exception e) {
52+
e.printStackTrace();
53+
}
54+
}
55+
56+
public BDI(IMCDefinition defs) {
57+
super(defs, ID_STATIC);
58+
}
59+
60+
public static BDI create(Object... values) {
61+
BDI m = new BDI();
62+
for (int i = 0; i < values.length-1; i+= 2)
63+
m.setValue(values[i].toString(), values[i+1]);
64+
return m;
65+
}
66+
67+
public static BDI clone(IMCMessage msg) throws Exception {
68+
69+
BDI m = new BDI();
70+
if (msg == null)
71+
return m;
72+
if(msg.definitions != m.definitions){
73+
msg = msg.cloneMessage();
74+
IMCUtil.updateMessage(msg, m.definitions);
75+
}
76+
else if (msg.getMgid()!=m.getMgid())
77+
throw new Exception("Argument "+msg.getAbbrev()+" is incompatible with message "+m.getAbbrev());
78+
79+
m.getHeader().values.putAll(msg.getHeader().values);
80+
m.values.putAll(msg.values);
81+
return m;
82+
}
83+
84+
public BDI(short soh) {
85+
super(ID_STATIC);
86+
setSoh(soh);
87+
}
88+
89+
/**
90+
* @return State of Health (%) - int16_t
91+
*/
92+
public short getSoh() {
93+
return (short) getInteger("soh");
94+
}
95+
96+
/**
97+
* @param soh State of Health (%)
98+
*/
99+
public BDI setSoh(short soh) {
100+
values.put("soh", soh);
101+
return this;
102+
}
103+
104+
}
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/*
2+
* Below is the copyright agreement for IMCJava.
3+
*
4+
* Copyright (c) 2010-2026, 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 BMS Cell Voltage (2043)<br/>
35+
* Voltage of a single battery cell, used as a sub-message inside BmsData.<br/>
36+
*/
37+
38+
public class BmsCellVoltage extends IMCMessage {
39+
40+
public static final int ID_STATIC = 2043;
41+
42+
public BmsCellVoltage() {
43+
super(ID_STATIC);
44+
}
45+
46+
public BmsCellVoltage(IMCMessage msg) {
47+
super(ID_STATIC);
48+
try{
49+
copyFrom(msg);
50+
}
51+
catch (Exception e) {
52+
e.printStackTrace();
53+
}
54+
}
55+
56+
public BmsCellVoltage(IMCDefinition defs) {
57+
super(defs, ID_STATIC);
58+
}
59+
60+
public static BmsCellVoltage create(Object... values) {
61+
BmsCellVoltage m = new BmsCellVoltage();
62+
for (int i = 0; i < values.length-1; i+= 2)
63+
m.setValue(values[i].toString(), values[i+1]);
64+
return m;
65+
}
66+
67+
public static BmsCellVoltage clone(IMCMessage msg) throws Exception {
68+
69+
BmsCellVoltage m = new BmsCellVoltage();
70+
if (msg == null)
71+
return m;
72+
if(msg.definitions != m.definitions){
73+
msg = msg.cloneMessage();
74+
IMCUtil.updateMessage(msg, m.definitions);
75+
}
76+
else if (msg.getMgid()!=m.getMgid())
77+
throw new Exception("Argument "+msg.getAbbrev()+" is incompatible with message "+m.getAbbrev());
78+
79+
m.getHeader().values.putAll(msg.getHeader().values);
80+
m.values.putAll(msg.values);
81+
return m;
82+
}
83+
84+
public BmsCellVoltage(short cell_number, float voltage) {
85+
super(ID_STATIC);
86+
setCellNumber(cell_number);
87+
setVoltage(voltage);
88+
}
89+
90+
/**
91+
* @return Cell Number - uint8_t
92+
*/
93+
public short getCellNumber() {
94+
return (short) getInteger("cell_number");
95+
}
96+
97+
/**
98+
* @param cell_number Cell Number
99+
*/
100+
public BmsCellVoltage setCellNumber(short cell_number) {
101+
values.put("cell_number", cell_number);
102+
return this;
103+
}
104+
105+
/**
106+
* @return Voltage (V) - fp32_t
107+
*/
108+
public double getVoltage() {
109+
return getDouble("voltage");
110+
}
111+
112+
/**
113+
* @param voltage Voltage (V)
114+
*/
115+
public BmsCellVoltage setVoltage(double voltage) {
116+
values.put("voltage", voltage);
117+
return this;
118+
}
119+
120+
}

0 commit comments

Comments
 (0)