Skip to content

Commit 8e9f0cf

Browse files
committed
PluggableDiscovery: added a 'port' field in json messages
The new format of 'add' and 'remove' actions is changed from: { "eventType": "add", "address": "/dev/ttyACM0", "label": "/dev/ttyACM0", "prefs": { "vendorId": "0x2341" "productId": "0x0043", "serialNumber": "85235353137351018160", }, "identificationPrefs": { "vid": "0x2341" "pid": "0x0043", }, "protocol": "serial", "protocolLabel": "Serial Port" } to: { "eventType": "add", "port": { "address": "/dev/ttyACM0", "label": "/dev/ttyACM0", "prefs": { "vendorId": "0x2341" "productId": "0x0043", "serialNumber": "85235353137351018160", }, "identificationPrefs": { "vid": "0x2341" "pid": "0x0043", }, "protocol": "serial", "protocolLabel": "Serial Port" } }
1 parent 7186213 commit 8e9f0cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arduino-core/src/cc/arduino/packages/discoverers/PluggableDiscovery.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private void processJsonNode(ObjectMapper mapper, JsonNode node) {
156156

157157
case "add":
158158
try {
159-
BoardPort port = mapper.treeToValue(node, BoardPort.class);
159+
BoardPort port = mapper.treeToValue(node.get("port"), BoardPort.class);
160160
port.searchMatchingBoard();
161161
addOrUpdate(port);
162162
} catch (JsonProcessingException e) {
@@ -167,7 +167,7 @@ private void processJsonNode(ObjectMapper mapper, JsonNode node) {
167167

168168
case "remove":
169169
try {
170-
BoardPort port = mapper.treeToValue(node, BoardPort.class);
170+
BoardPort port = mapper.treeToValue(node.get("port"), BoardPort.class);
171171
remove(port);
172172
} catch (JsonProcessingException e) {
173173
System.err.println(format("{0}: Invalid BoardPort message", discoveryName));

0 commit comments

Comments
 (0)