From c606cce812e3b2e335c3ba135d7b4ef670dba359 Mon Sep 17 00:00:00 2001 From: susanw1 Date: Wed, 11 Oct 2023 13:01:58 +0100 Subject: [PATCH] [#118] Updated model statuses to use name/description. Added status categories too. --- .../core/StandardCommandGrapher.java | 18 +- .../java/net/zscript/model/ZscriptModel.java | 5 +- .../model/datamodel/IntrinsicsDataModel.java | 23 +- .../model/datamodel/ZscriptDataModel.java | 17 +- .../zscript-datamodel/intrinsics.yaml | 356 +++++++++++------- .../00xx-base-modules/000x-core.yaml | 12 +- .../00xx-base-modules/001x-outercore.yaml | 12 +- .../00xx-base-modules/002x-scriptspace.yaml | 8 +- .../00xx-base-modules/005x-i2c.yaml | 34 +- .../01xx-networking-modules/010x-ip.yaml | 4 +- .../01xx-networking-modules/011x-udp.yaml | 40 +- .../01xx-networking-modules/012x-tcp.yaml | 36 +- .../main/templates/JavaZscriptStatus.mustache | 4 +- .../main/templates/CppZscriptStatus.mustache | 4 +- 14 files changed, 332 insertions(+), 241 deletions(-) diff --git a/clients/java-client-lib-alternate/client-core/src/main/java/net/zscript/javaclient/core/StandardCommandGrapher.java b/clients/java-client-lib-alternate/client-core/src/main/java/net/zscript/javaclient/core/StandardCommandGrapher.java index 746af03f5..c64994f4f 100644 --- a/clients/java-client-lib-alternate/client-core/src/main/java/net/zscript/javaclient/core/StandardCommandGrapher.java +++ b/clients/java-client-lib-alternate/client-core/src/main/java/net/zscript/javaclient/core/StandardCommandGrapher.java @@ -2,19 +2,17 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; -import net.zscript.ascii.AnsiCharacterStylePrinter; import net.zscript.ascii.AsciiFrame; import net.zscript.ascii.CharacterStyle; import net.zscript.ascii.TextBox; -import net.zscript.ascii.TextCanvas; import net.zscript.ascii.TextColor; import net.zscript.model.ZscriptModel; import net.zscript.model.components.Zchars; +import net.zscript.model.datamodel.IntrinsicsDataModel.StatusModel; import net.zscript.model.datamodel.ZscriptDataModel; public class StandardCommandGrapher implements CommandGrapher { @@ -182,9 +180,9 @@ private void explainStatus(ZscriptModel model, CommandPrintSettings settings, Zs box.append("0x"); box.appendHex(value, 1); box.append(" ("); - Optional optStatus = model.getStatus(value); + Optional optStatus = model.getStatus(value); if (optStatus.isPresent()) { - box.append(upperFirst(optStatus.get().getCode())); + box.append(upperFirst(optStatus.get().getName())); } else { box.append("Unknown"); } @@ -195,16 +193,16 @@ private void explainStatus(ZscriptModel model, CommandPrintSettings settings, Zs box.startNewLine(3); boolean hasSpecificDesc = false; if (value != -1) { - Optional optStatus = model.getStatus(value); + Optional optStatus = model.getStatus(value); if (optStatus.isPresent()) { - for (ZscriptDataModel.StatusModel specific : command.getStatus()) { - if (specific.getCode().equals(optStatus.get().getCode())) { + for (ZscriptDataModel.CommandStatusModel specific : command.getStatus()) { + if (specific.getName().equals(optStatus.get().getName())) { hasSpecificDesc = true; - box.append(toSentence(specific.getMeaning())); + box.append(toSentence(specific.getDescription())); } } if (!hasSpecificDesc) { - box.append(toSentence(optStatus.get().getMeaning())); + box.append(toSentence(optStatus.get().getDescription())); hasSpecificDesc = true; } } diff --git a/model/schema/src/main/java/net/zscript/model/ZscriptModel.java b/model/schema/src/main/java/net/zscript/model/ZscriptModel.java index 76b513506..edf288207 100644 --- a/model/schema/src/main/java/net/zscript/model/ZscriptModel.java +++ b/model/schema/src/main/java/net/zscript/model/ZscriptModel.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import net.zscript.model.datamodel.IntrinsicsDataModel.Intrinsics; +import net.zscript.model.datamodel.IntrinsicsDataModel.StatusModel; import net.zscript.model.datamodel.ModelValidator; import net.zscript.model.datamodel.ZscriptDataModel; import net.zscript.model.datamodel.ZscriptDataModel.ModuleModel; @@ -98,9 +99,9 @@ public Optional getNotification(int id) { .flatMap(m -> m.getNotificationById((id & 0xF))); } - public Optional getStatus(int value) { + public Optional getStatus(int value) { Intrinsics intrinsics = getIntrinsics(); - for (ZscriptDataModel.StatusModel status : intrinsics.getStatus()) { + for (StatusModel status : intrinsics.getStatus()) { if (status.getId() == value) { return Optional.of(status); } else if (status.getId() > value) { diff --git a/model/schema/src/main/java/net/zscript/model/datamodel/IntrinsicsDataModel.java b/model/schema/src/main/java/net/zscript/model/datamodel/IntrinsicsDataModel.java index 4ee37984a..3e3641d0f 100644 --- a/model/schema/src/main/java/net/zscript/model/datamodel/IntrinsicsDataModel.java +++ b/model/schema/src/main/java/net/zscript/model/datamodel/IntrinsicsDataModel.java @@ -2,9 +2,11 @@ import java.util.List; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + import net.zscript.model.datamodel.ZscriptDataModel.RequestFieldModel; import net.zscript.model.datamodel.ZscriptDataModel.ResponseFieldModel; -import net.zscript.model.datamodel.ZscriptDataModel.StatusModel; public interface IntrinsicsDataModel { Intrinsics getIntrinsics(); @@ -17,11 +19,11 @@ interface Intrinsics { List getZchars(); List getStatus(); - } - interface ZcharDefs { - String getName(); + List getStatusCategories(); + } + interface ZcharDefs extends ZscriptDataModel.ModelComponent { char getCh(); default String getChEscapedAsC() { @@ -39,8 +41,6 @@ default String getChEscapedAsC() { return String.valueOf(ch); } - String getDescription(); - boolean isSeparator(); boolean isMustEscape(); @@ -53,4 +53,15 @@ default String getChEscapedAsC() { boolean isBigField(); } + + @JsonIdentityInfo(generator = ObjectIdGenerators.StringIdGenerator.class) + interface StatusCategoryModel extends ZscriptDataModel.ModelComponent { + int getBaseId(); + } + + interface StatusModel extends ZscriptDataModel.ModelComponent { + int getId(); + + StatusCategoryModel getCategory(); + } } diff --git a/model/schema/src/main/java/net/zscript/model/datamodel/ZscriptDataModel.java b/model/schema/src/main/java/net/zscript/model/datamodel/ZscriptDataModel.java index 13c35e5c2..899c1e0f4 100644 --- a/model/schema/src/main/java/net/zscript/model/datamodel/ZscriptDataModel.java +++ b/model/schema/src/main/java/net/zscript/model/datamodel/ZscriptDataModel.java @@ -16,7 +16,9 @@ public interface ZscriptDataModel { - /** */ + /** + * Most components of the Model have a name/description/longDescription - this defines them in one place. + */ interface ModelComponent { @JsonProperty(required = true) String getName(); @@ -122,7 +124,7 @@ default String getCommandName() { List getResponseFields(); @JsonManagedReference - List getStatus(); + List getStatus(); default int getFullCommand() { return getModule().getModuleBank().getId() << 8 | getModule().getId() << 4 | (getCommand() & 0xf); @@ -326,14 +328,11 @@ interface NotificationFieldModel extends GenericField { NotificationSectionModel getNotificationSection(); } - interface StatusModel { + /** + * Specifically a Status object that is associated with a Command, as opposed to an intrinsic one + */ + interface CommandStatusModel extends IntrinsicsDataModel.StatusModel { @JsonBackReference CommandModel getCommand(); - - String getCode(); - - int getId(); - - String getMeaning(); } } diff --git a/model/schema/src/main/resources/zscript-datamodel/intrinsics.yaml b/model/schema/src/main/resources/zscript-datamodel/intrinsics.yaml index d667249ca..f3198eb32 100644 --- a/model/schema/src/main/resources/zscript-datamodel/intrinsics.yaml +++ b/model/schema/src/main/resources/zscript-datamodel/intrinsics.yaml @@ -14,6 +14,9 @@ intrinsics: '@type': number required: yes + ### ------------------------------ + # Defines the names, characters and purpose of all the magic syntactic chars in Zscript + # This allows client libraries to use code-generation to produce complete constant definitions with correct comments zchars: - name: cmd ch: "Z" @@ -100,144 +103,223 @@ intrinsics: description: "may be used to make commands and responses more readable, ignored outside of text fields" ignoreInCode: true + ### ------------------------------ + statusCategories: + - &statusCategory_success + name: success + description: command completed successfully wither failure or error + baseId: 0x00 + + - &statusCategory_failure + name: failure + description: command indicates non-success, allowing a skip to a failure handler + baseId: 0x01 + + - &statusCategory_generalError + name: generalError + description: command processing is interrupted due to a bad internal state + baseId: 0x10 + + - &statusCategory_syntaxError + name: syntaxError + description: command syntax rules have been broken + baseId: 0x20 + + - &statusCategory_sequenceStructureError + name: sequenceStructureError + description: + baseId: 0x30 + + - &statusCategory_sequenceElementError + name: sequenceElementError + description: + baseId: 0x40 + + - &statusCategory_commandFieldError + name: commandFieldError + description: + baseId: 0x50 + + - &statusCategory_executionError + name: executionError + description: command execution is no longer possible without intervention + baseId: 0x80 + + - &statusCategory_peripheralError + name: peripheralError + description: peripheral device or comms interface is in an unusable state and needs intervention + baseId: 0x90 - status: - - code: success - id: 0 - meaning: command success - - - - - code: commandFail - id: 1 - meaning: command failure - - - code: commandFailControl - id: 2 - meaning: command failed in order to control the program flow - - - code: commandNoTarget - id: 3 - meaning: target of command either non-existent or not responding - - - code: commandTargetDoesNotSupport - id: 4 - meaning: target of command does not support the requested functionality - - - - code: commandDataNotTransmitted - id: 8 - meaning: data transmission not successful - may have failed or only been partial - - - code: commandDataNotReceived - id: 9 - meaning: data reception not successful - may have failed or only been partial - - - - - code: bufferOvrError - id: 16 - meaning: buffer overflow - - - code: internalError - id: 17 - meaning: impossible condition hit - - - code: notActivated - id: 18 - meaning: channel not activated for non-core command - - - code: commandErrorControl - id: 19 - meaning: command error in order to control the program flow - - - - code: fieldTooLong - id: 32 - meaning: numeric field too long - - - code: oddLength - id: 33 - meaning: odd length big field - - - code: unterminatedString - id: 34 - meaning: missing end quote - - - code: escapingError - id: 35 - meaning: string escaping invalid - - code: illegalKey - id: 36 - meaning: illegal character given as token key - - - - code: invalidLocks - id: 48 - meaning: locks field too long or repeated - - - code: invalidEcho - id: 49 - meaning: echo field too long or repeated - - - code: invalidComment - id: 50 - meaning: comment with non-comment fields found - - - - code: repeatedKey - id: 64 - meaning: two fields (in the same command) with the same key found - - - code: invalidKey - id: 65 - meaning: field not valid in this position - - - code: commandNotFound - id: 66 - meaning: given command does not exist or not specified - - - code: addressNotFound - id: 67 - meaning: given address does not exist or cannot be addressed - - - - code: missingKey - id: 80 - meaning: a required field was not given - - - code: valueOutOfRange - id: 81 - meaning: a field or big field was given with a value which is not supported - - - code: dataTooLong - id: 82 - meaning: data transmission/reception exceeds maximum transmission length - - - - - code: executionError - id: 128 - meaning: generic failure mid-execution - - - - code: peripheralError - id: 144 - meaning: a peripheral required for the command has failed fatally - - - code: peripheralJam - id: 145 - meaning: a peripheral required for the command is in a state it cannot exit (and may require rebooting) - - - code: peripheralDisabled - id: 146 - meaning: a peripheral required for the command is not currently enabled (and may require other commands or activity to enable) + status: + - name: success + id: 0x00 + description: command success + category: *statusCategory_success + + + - name: commandFail + id: 0x01 + description: command failure + category: *statusCategory_failure + + - name: commandFailControl + id: 0x02 + description: command failed in order to control the program flow + category: *statusCategory_failure + + - name: commandNoTarget + id: 0x03 + description: target of command either non-existent or not responding + category: *statusCategory_failure + + - name: commandTargetDoesNotSupport + id: 0x04 + description: target of command does not support the requested functionality + category: *statusCategory_failure + + - name: commandDataNotTransmitted + id: 0x08 + description: data transmission not successful - may have failed or only been partial + category: *statusCategory_failure + + - name: commandDataNotReceived + id: 0x09 + description: data reception not successful - may have failed or only been partial + category: *statusCategory_failure + + + - name: bufferOvrError + id: 0x10 + description: buffer overflow + category: *statusCategory_generalError + + - name: internalError + id: 0x11 + description: impossible condition hit + category: *statusCategory_generalError - - code: peripheralDisconnected - id: 147 - meaning: a peripheral required for the command is not attached (and may require physical intervention to attach) + - name: notActivated + id: 0x12 + description: channel not activated for non-core command + category: *statusCategory_generalError + + - name: commandErrorControl + id: 0x13 + description: command raised error condition in order to control the program flow + longDescription: > + Any command may raise this explicitly in order to abort the command sequence. It should imply a failed assert condition. + Commands should use this sparingly. + category: *statusCategory_generalError + + + - name: fieldTooLong + id: 0x20 + description: numeric field too long + category: *statusCategory_syntaxError + + - name: oddLength + id: 0x21 + description: odd length big field + category: *statusCategory_syntaxError + + - name: unterminatedString + id: 0x22 + description: missing end quote + category: *statusCategory_syntaxError + + - name: escapingError + id: 0x23 + description: string escaping invalid + category: *statusCategory_syntaxError + + - name: illegalKey + id: 0x24 + description: illegal character given as token key + category: *statusCategory_syntaxError + + + - name: invalidLocks + id: 0x30 + description: locks field too long or repeated + category: *statusCategory_sequenceStructureError + + - name: invalidEcho + id: 0x31 + description: echo field too long or repeated + category: *statusCategory_sequenceStructureError + + - name: invalidComment + id: 0x32 + description: comment with non-comment fields found + category: *statusCategory_sequenceStructureError + + + - name: repeatedKey + id: 0x40 + description: two fields (in the same command) with the same key found + category: *statusCategory_sequenceElementError + + - name: invalidKey + id: 0x41 + description: field not valid in this position + category: *statusCategory_sequenceElementError + + - name: commandNotFound + id: 0x42 + description: given command does not exist or not specified + category: *statusCategory_sequenceElementError + + - name: addressNotFound + id: 0x43 + description: given address does not exist or cannot be addressed + category: *statusCategory_sequenceElementError + + + - name: missingKey + id: 0x50 + description: a required field was not given + category: *statusCategory_commandFieldError + + - name: valueOutOfRange + id: 0x51 + description: a field or big field was given with a value which is not supported + category: *statusCategory_commandFieldError + + - name: dataTooLong + id: 0x52 + description: data transmission/reception exceeds maximum transmission length + category: *statusCategory_commandFieldError + + + + - name: executionError + id: 0x80 + description: generic failure mid-execution + category: *statusCategory_executionError + + + - name: peripheralError + id: 0x90 + description: a peripheral required for the command has failed fatally + category: *statusCategory_peripheralError + + - name: peripheralJam + id: 0x91 + description: a peripheral required for the command is in a state it cannot exit (and may require rebooting) + category: *statusCategory_peripheralError - - code: peripheralBroken - id: 148 - meaning: a peripheral required for the command has sustained permanent damage (and may require replacement) + - name: peripheralDisabled + id: 0x92 + description: a peripheral required for the command is not currently enabled (and may require other commands or activity to enable) + category: *statusCategory_peripheralError + + - name: peripheralDisconnected + id: 0x93 + description: a peripheral required for the command is not attached (and may require physical intervention to attach) + category: *statusCategory_peripheralError + + - name: peripheralBroken + id: 0x94 + description: a peripheral required for the command has sustained permanent damage (and may require replacement) + category: *statusCategory_peripheralError diff --git a/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/000x-core.yaml b/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/000x-core.yaml index 162bdd4db..7db72e428 100644 --- a/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/000x-core.yaml +++ b/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/000x-core.yaml @@ -109,8 +109,8 @@ commands: '@type': number required: no status: - - code: commandFail - meaning: challenge failure + - name: commandFail + description: challenge failure, no matching value supplied - name: cryptographicChallenge command: 3 @@ -167,8 +167,8 @@ commands: '@type': bytes required: no status: - - code: commandFail - meaning: fail flag set but ids did not match + - name: commandFail + description: fail flag set but IDs did not match - name: makeCode command: 5 @@ -215,8 +215,8 @@ commands: required: yes extension: channel status: - - code: valueOutOfRange - meaning: channel out of range + - name: valueOutOfRange + description: channel out of range - name: userDefined command: 15 diff --git a/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/001x-outercore.yaml b/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/001x-outercore.yaml index c1ac68cca..da7937ced 100644 --- a/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/001x-outercore.yaml +++ b/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/001x-outercore.yaml @@ -78,8 +78,8 @@ commands: requestFields: [ ] responseFields: [ ] status: - - code: commandFail - meaning: reset failed + - name: commandFail + description: reset failed - name: writeGuid command: 4 @@ -94,8 +94,8 @@ commands: required: yes responseFields: [ ] status: - - code: valueOutOfRange - meaning: GUID must be 16 bytes + - name: valueOutOfRange + description: GUID must be 16 bytes - name: channelSetup @@ -130,8 +130,8 @@ commands: responseFields: [ ] extension: channel status: - - code: valueOutOfRange - meaning: channel out of range + - name: valueOutOfRange + description: channel out of range - name: userDefined diff --git a/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/002x-scriptspace.yaml b/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/002x-scriptspace.yaml index 205212023..267c7208a 100644 --- a/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/002x-scriptspace.yaml +++ b/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/002x-scriptspace.yaml @@ -102,10 +102,10 @@ commands: '@type': number required: yes status: - - code: FAIL - meaning: The script space is running - - code: ERROR - meaning: The write would exceed the boundaries of the space + - name: commandFail + description: The script space is running + - name: ERROR + description: The write would exceed the boundaries of the space - name: sleep command: 8 diff --git a/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/005x-i2c.yaml b/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/005x-i2c.yaml index 462eaeddb..47f3ac5ae 100644 --- a/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/005x-i2c.yaml +++ b/model/standard-module-definitions/src/main/resources/zscript-datamodel/00xx-base-modules/005x-i2c.yaml @@ -100,8 +100,8 @@ commands: '@type': number required: no status: - - code: BAD_PARAM - meaning: port or frequency out of range + - name: valueOutOfRange + description: port or frequency out of range - name: i2cSend command: 2 @@ -158,10 +158,10 @@ commands: '@type': number required: yes status: - - code: commandFail - meaning: write failed in benign way - - code: executionError - meaning: write failed in bad way - serious error + - name: commandFail + description: write failed in benign way + - name: executionError + description: write failed in bad way - serious error - name: i2cReceive command: 3 @@ -219,17 +219,17 @@ commands: required: yes - key: + name: data - description: the data that was receive + description: the data that was received typeDefinition: '@type': bytes required: no status: - - code: tooBig - meaning: the length requested exceeded the buffer size - - code: commandFail - meaning: write failed in benign way - - code: executionError - meaning: write failed in bad way - serious error + - name: dataTooLong + description: the length requested exceeded the buffer size + - name: commandDataNotTransmitted + description: write failed in benign way + - name: peripheralError + description: write failed in bad way - serious error - name: i2cSendReceive command: 4 @@ -298,10 +298,10 @@ commands: '@type': bytes required: no status: - - code: CMD_FAIL - meaning: write failed in benign way - - code: CMD_ERROR - meaning: write failed in bad way - serious error + - name: commandDataNotTransmitted + description: write failed in benign way + - name: peripheralError + description: write failed in bad way - serious error - name: channelInfo diff --git a/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/010x-ip.yaml b/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/010x-ip.yaml index 400d90110..d7b38fa5f 100644 --- a/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/010x-ip.yaml +++ b/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/010x-ip.yaml @@ -239,7 +239,7 @@ commands: required: yes responseFields: [ ] status: - - code: commandFail - meaning: packet lost (no response) + - name: commandFail + description: packet lost (no response) notifications: [ ] diff --git a/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/011x-udp.yaml b/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/011x-udp.yaml index 0f3b68004..00cabcf76 100644 --- a/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/011x-udp.yaml +++ b/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/011x-udp.yaml @@ -72,8 +72,8 @@ commands: '@type': number required: no status: - - code: executionError - meaning: UDP descriptor already in use + - name: executionError + description: UDP descriptor already in use - name: udpInfo command: 2 @@ -126,8 +126,8 @@ commands: required: yes responseFields: [ ] status: - - code: peripheralDisabled - meaning: UDP descriptor not in use + - name: peripheralDisabled + description: UDP descriptor not in use - name: udpConnect command: 4 @@ -172,12 +172,12 @@ commands: '@type': number required: yes status: - - code: peripheralDisabled - meaning: UDP descriptor not in use - - code: executionError - meaning: socket descriptor already in use - - code: commandNoTarget - meaning: hostname could not be resolved + - name: peripheralDisabled + description: UDP descriptor not in use + - name: executionError + description: socket descriptor already in use + - name: commandNoTarget + description: hostname could not be resolved - name: udpSocketInfo command: 5 @@ -248,8 +248,8 @@ commands: required: yes responseFields: [ ] status: - - code: peripheralDisabled - meaning: socket descriptor not in use + - name: peripheralDisabled + description: socket descriptor not in use #- name: udpClose # command: 7 @@ -264,8 +264,8 @@ commands: # required: yes # responseFields: [ ] # status: -# - code: peripheralDisabled -# meaning: socket descriptor not in use +# - name: peripheralDisabled +# description: socket descriptor not in use - name: udpReadPacket command: 8 @@ -304,8 +304,8 @@ commands: '@type': bytes required: no status: - - code: peripheralDisabled - meaning: UDP descriptor not in use + - name: peripheralDisabled + description: UDP descriptor not in use - name: udpReadPacketData command: 9 @@ -338,8 +338,8 @@ commands: '@type': bytes required: yes status: - - code: commandDataNotReceived - meaning: no packet has been received to read from + - name: commandDataNotReceived + description: no packet has been received to read from - name: udpSkipPacketData command: 10 @@ -366,8 +366,8 @@ commands: '@type': number required: yes status: - - code: commandDataNotReceived - meaning: no packet has been received to read from + - name: commandDataNotReceived + description: no packet has been received to read from - name: channelInfo command: 12 diff --git a/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/012x-tcp.yaml b/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/012x-tcp.yaml index cd656a408..401687cac 100644 --- a/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/012x-tcp.yaml +++ b/model/standard-module-definitions/src/main/resources/zscript-datamodel/01xx-networking-modules/012x-tcp.yaml @@ -66,8 +66,8 @@ commands: '@type': number required: no status: - - code: executionError - meaning: UDP descriptor already in use + - name: executionError + description: UDP descriptor already in use - name: tcpServerInfo command: 2 @@ -120,8 +120,8 @@ commands: required: yes responseFields: [ ] status: - - code: peripheralDisabled - meaning: TCP server descriptor not in use + - name: peripheralDisabled + description: TCP server descriptor not in use - name: tcpServerListen @@ -161,10 +161,10 @@ commands: '@type': number required: no status: - - code: peripheralDisabled - meaning: TCP server descriptor not in use - - code: executionError - meaning: socket descriptor already in use + - name: peripheralDisabled + description: TCP server descriptor not in use + - name: executionError + description: socket descriptor already in use - name: tcpClientSocket command: 5 @@ -221,10 +221,10 @@ commands: '@type': number required: yes status: - - code: executionError - meaning: socket descriptor already in use - - code: commandNoTarget - meaning: hostname could not be resolved + - name: executionError + description: socket descriptor already in use + - name: commandNoTarget + description: hostname could not be resolved - name: tcpSocketInfo command: 8 @@ -301,8 +301,8 @@ commands: required: yes responseFields: [ ] status: - - code: peripheralDisabled - meaning: TCP socket not in use + - name: peripheralDisabled + description: TCP socket not in use - name: socketReceive command: 10 @@ -335,10 +335,10 @@ commands: '@type': bytes required: yes status: - - code: peripheralDisabled - meaning: TCP socket not in use - - code: commandDataNotReceived - meaning: no data has been received to read + - name: peripheralDisabled + description: TCP socket not in use + - name: commandDataNotReceived + description: no data has been received to read - name: socketSkip command: 11 diff --git a/receivers/jvm/java-model-components/src/main/templates/JavaZscriptStatus.mustache b/receivers/jvm/java-model-components/src/main/templates/JavaZscriptStatus.mustache index 758e212d7..36edd832f 100644 --- a/receivers/jvm/java-model-components/src/main/templates/JavaZscriptStatus.mustache +++ b/receivers/jvm/java-model-components/src/main/templates/JavaZscriptStatus.mustache @@ -26,8 +26,8 @@ public class ZscriptStatus { public static final int BITMASK_ERROR = ~0xf; {{#status}} - /** {{meaning}} */ - public static final byte {{#upperUnderscore}}{{code}}{{/upperUnderscore}} = (byte) 0x{{#toHex}}{{id}}{{/toHex}}; + /** {{description}} */ + public static final byte {{#upperUnderscore}}{{name}}{{/upperUnderscore}} = (byte) 0x{{#toHex}}{{id}}{{/toHex}}; {{/status}} public static boolean isSuccess(final int code) { diff --git a/receivers/native/cpp-model-components/src/main/templates/CppZscriptStatus.mustache b/receivers/native/cpp-model-components/src/main/templates/CppZscriptStatus.mustache index 2ab9123dd..9dfea768b 100644 --- a/receivers/native/cpp-model-components/src/main/templates/CppZscriptStatus.mustache +++ b/receivers/native/cpp-model-components/src/main/templates/CppZscriptStatus.mustache @@ -26,8 +26,8 @@ namespace Zscript { */ enum ResponseStatus { {{#status}} - /** {{meaning}} */ - {{#upperUnderscore}}{{code}}{{/upperUnderscore}} = 0x{{#toHex}}{{id}}{{/toHex}}, + /** {{description}} */ + {{#upperUnderscore}}{{name}}{{/upperUnderscore}} = 0x{{#toHex}}{{id}}{{/toHex}}, {{/status}} };