From 408f7bc14f6d7e8a1b09e3beb33e15430ba7f370 Mon Sep 17 00:00:00 2001 From: Andrey Skvortsov Date: Sun, 14 Apr 2019 18:40:26 +0300 Subject: [PATCH 1/8] sys: add Note component to comment user application Signed-off-by: Andrey Skvortsov --- src/kits/sys/Note.sedona | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/kits/sys/Note.sedona diff --git a/src/kits/sys/Note.sedona b/src/kits/sys/Note.sedona new file mode 100644 index 0000000..31e1551 --- /dev/null +++ b/src/kits/sys/Note.sedona @@ -0,0 +1,14 @@ +// +// Copyright (c) 2016 Andrey Skvortsov +// Licensed under the Academic Free License version 3.0 +// + +** +** Note is a component used to comment user application +** +class Note + extends Component +{ + @asStr @summary=true @multiLine=true + @config property Buf(128) comment; +} From 49611f9ca6a1c959115d2e501c9c9e0b714d0503 Mon Sep 17 00:00:00 2001 From: Andrey Skvortsov Date: Sun, 14 Apr 2019 18:47:14 +0300 Subject: [PATCH 2/8] sys: don't show Component in palette Signed-off-by: Andrey Skvortsov --- src/kits/sys/Component.sedona | 1 + 1 file changed, 1 insertion(+) diff --git a/src/kits/sys/Component.sedona b/src/kits/sys/Component.sedona index edf3081..4f0f6cc 100644 --- a/src/kits/sys/Component.sedona +++ b/src/kits/sys/Component.sedona @@ -9,6 +9,7 @@ ** ** Component is the base class for all Sedona component classes. ** +@palette=false class Component extends Virtual { From d700e82c3ce8862b7a284b86f75c5be847c8c79b Mon Sep 17 00:00:00 2001 From: Andrey Skvortsov Date: Sun, 14 Apr 2019 18:49:13 +0300 Subject: [PATCH 3/8] sys: increase Component's name from 7 to 31 character It's hard to fit any useful encoding scheme or other information into 7 charaters. SOX protocol doesn't set any limitation on name length. CPT, Niagara 3.8 show long names without a problem, but on changing name it is truncated to 7 characters. EasyIO tool and devices support 31 length for component's name. Signed-off-by: Andrey Skvortsov --- src/kits/sys/Component.sedona | 4 ++-- src/sedona/src/sedona/Component.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kits/sys/Component.sedona b/src/kits/sys/Component.sedona index 4f0f6cc..5b58e91 100644 --- a/src/kits/sys/Component.sedona +++ b/src/kits/sys/Component.sedona @@ -418,7 +418,7 @@ class Component int loadAppComp(InStream in) { // meta - if (!in.readStr(name, 8)) return Err.nameTooLong + if (!in.readStr(name, nameLen)) return Err.nameTooLong parent = in.readU2() children = in.readU2() nextSibling = in.readU2() @@ -509,7 +509,7 @@ class Component ** Human name for this component which is unique ** within its parent (do not modify directly) - define int nameLen = 8 + define int nameLen = 32 inline Str(nameLen) name ** Parent id or nullId if root App or unmounted (do not modify directly) diff --git a/src/sedona/src/sedona/Component.java b/src/sedona/src/sedona/Component.java index 44343ad..14edede 100644 --- a/src/sedona/src/sedona/Component.java +++ b/src/sedona/src/sedona/Component.java @@ -292,7 +292,7 @@ public static void assertName(String name) */ public static String checkName(String name) { - if (name.length() > 7) return "nameTooLong"; + if (name.length() > 31) return "nameTooLong"; if (name.length() == 0) return "nameEmpty"; for (int i=0; i Date: Tue, 7 May 2019 00:09:02 +0300 Subject: [PATCH 4/8] sedona: don't abort communication on receiving unknown field in DASP message Backtrace example: java.lang.IllegalStateException: Unknown field id: 61 at sedona.dasp.DaspMsg.doDecode(DaspMsg.java:153) at sedona.dasp.DaspMsg.(DaspMsg.java:92) at sedona.dasp.DaspMessage.(DaspMessage.java:27) at sedona.dasp.DaspSocket.dispatch(DaspSocket.java:337) at sedona.dasp.DaspSocketInterface$Receiver.run(DaspSocketInterface.java:166) --- src/sedona/src/sedona/dasp/DaspMsg.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sedona/src/sedona/dasp/DaspMsg.java b/src/sedona/src/sedona/dasp/DaspMsg.java index 8bfac55..17887c3 100644 --- a/src/sedona/src/sedona/dasp/DaspMsg.java +++ b/src/sedona/src/sedona/dasp/DaspMsg.java @@ -150,7 +150,7 @@ protected void doDecode(byte[] buf, final int length) throws UnsupportedEncoding case RECEIVE_TIMEOUT: receiveTimeout = u2 * 1000L; break; case ERROR_CODE: errorCode = u2; break; case PLATFORM_ID: platformId = str; break; - default: throw new IllegalStateException("Unknown field id: " + id); + default: System.out.println("WARNING: Unknown field id: " + id); } } From d6740973bedd32574555189a91c957bbee0cd86a Mon Sep 17 00:00:00 2001 From: Vincent Wang Date: Tue, 30 Apr 2019 08:55:56 +0800 Subject: [PATCH 5/8] add header for max length of comp's name since we enlarge component's name from 7 chars to 31 chars, we need a way to tell programming tools to know what size is used in a sedona app so that the tool can support it easily based on sedona app --- doc/dasp.html | 1 + src/kits/sox/Dasp.sedona | 1 + src/kits/sox/SoxSession.sedona | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/dasp.html b/doc/dasp.html index 6f21bed..97bc61a 100644 --- a/doc/dasp.html +++ b/doc/dasp.html @@ -245,6 +245,7 @@

Header Fields

0x31 (c, 1)receiveTimeoutu2Receive timeout in seconds (30sec) 0x35 (d,1)errorCodeu2One of the predefined error codes 0x3a (e,2)platformIdstrDevice's platform ID string +0x3d (f,1)compNameLenu2Max length of component's name

diff --git a/src/kits/sox/Dasp.sedona b/src/kits/sox/Dasp.sedona index 4424c34..8188ff5 100644 --- a/src/kits/sox/Dasp.sedona +++ b/src/kits/sox/Dasp.sedona @@ -71,6 +71,7 @@ class Dasp define int RECEIVE_TIMEOUT = 0x0c // 0x31 (c,1) define int ERROR_CODE = 0x0d // 0x35 (d,1) define int PLATFORM_ID = 0x0e // 0x3a (e,2) + define int COMP_NAME_LEN = 0x0f // 0x3d (f,1) //////////////////////////////////////////////////////////////// // Error Codes diff --git a/src/kits/sox/SoxSession.sedona b/src/kits/sox/SoxSession.sedona index 782aa5c..460b03c 100644 --- a/src/kits/sox/SoxSession.sedona +++ b/src/kits/sox/SoxSession.sedona @@ -161,7 +161,10 @@ class SoxSession out.writeI2(service.receiveMax) out.write(Dasp.RECEIVE_TIMEOUT << 2 | Dasp.U2) out.writeI2(receiveTimeout) - service.packet.bytes[4] |= 3 // header count + out.write(Dasp.COMP_NAME_LEN << 2 | Dasp.U2) + out.writeI2(Component.nameLen-1) + + service.packet.bytes[4] |= 4 // header count service.send(this) } From a762a63e1b58c0e45cfb0c57c0a5d77d501c0e99 Mon Sep 17 00:00:00 2001 From: Andrey Skvortsov Date: Tue, 7 May 2019 00:19:18 +0300 Subject: [PATCH 6/8] sedona: DaspMsg: add support of compNameLenMax header --- src/sedona/src/sedona/dasp/DaspConst.java | 1 + src/sedona/src/sedona/dasp/DaspMsg.java | 26 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/sedona/src/sedona/dasp/DaspConst.java b/src/sedona/src/sedona/dasp/DaspConst.java index 5eab5f8..cd44fb4 100644 --- a/src/sedona/src/sedona/dasp/DaspConst.java +++ b/src/sedona/src/sedona/dasp/DaspConst.java @@ -80,6 +80,7 @@ public interface DaspConst public static final int RECEIVE_TIMEOUT = 0x31; // (c,1) public static final int ERROR_CODE = 0x35; // (d,1) public static final int PLATFORM_ID = 0x3a; // (e,2) + public static final int COMP_NAME_LEN = 0x3d; // (f,1) //////////////////////////////////////////////////////////////// // Error Codes diff --git a/src/sedona/src/sedona/dasp/DaspMsg.java b/src/sedona/src/sedona/dasp/DaspMsg.java index 17887c3..db28a6e 100644 --- a/src/sedona/src/sedona/dasp/DaspMsg.java +++ b/src/sedona/src/sedona/dasp/DaspMsg.java @@ -150,6 +150,7 @@ protected void doDecode(byte[] buf, final int length) throws UnsupportedEncoding case RECEIVE_TIMEOUT: receiveTimeout = u2 * 1000L; break; case ERROR_CODE: errorCode = u2; break; case PLATFORM_ID: platformId = str; break; + case COMP_NAME_LEN: compNameLenMax = u2; break; default: System.out.println("WARNING: Unknown field id: " + id); } } @@ -644,7 +645,30 @@ public final void setPlatformId(String platformId) this.platformId = platformId; } + /** + * Get compNameLenMax header field. + * + * @return the maximum length for component name, + * or -1 if the header is not set. + */ + public final int compNameLenMax() + { + return compNameLenMax; + } + /** + * Set the compNameLenMax header field. + * + * @param errorCode + * maximum length for component name. + Use a negative value to clear this header. + */ + public final void setCompNameLenMax(final int compNameLenMax) + { + this.compNameLenMax + = Math.max(-1, compNameLenMax); + } + //////////////////////////////////////////////////////////////// //Debug //////////////////////////////////////////////////////////////// @@ -669,6 +693,7 @@ public void dump(PrintWriter out) if (receiveTimeout > -1) out.println(" receiveTimeout = " + receiveTimeout); if (errorCode > -1) out.println(" errorCode = " + errorCode); if (platformId != null) out.println(" platformId = " + platformId); + if (compNameLenMax > -1) out.println(" compNameLenMax = " + compNameLenMax); out.flush(); } @@ -708,6 +733,7 @@ static String toString(byte[] buf, int len) protected long receiveTimeout = -1; protected int errorCode = -1; protected String platformId; + protected int compNameLenMax = -1; // payload bytes protected byte[] payload = noBytes; From 4dbc876ff6156631c988a333eeb23452ce1ec3b0 Mon Sep 17 00:00:00 2001 From: Vincent Wang Date: Fri, 10 May 2019 23:57:54 +0800 Subject: [PATCH 7/8] Revert "sedona: DaspMsg: add support of compNameLenMax header" This reverts commit a762a63e1b58c0e45cfb0c57c0a5d77d501c0e99. --- src/sedona/src/sedona/dasp/DaspConst.java | 1 - src/sedona/src/sedona/dasp/DaspMsg.java | 26 ----------------------- 2 files changed, 27 deletions(-) diff --git a/src/sedona/src/sedona/dasp/DaspConst.java b/src/sedona/src/sedona/dasp/DaspConst.java index cd44fb4..5eab5f8 100644 --- a/src/sedona/src/sedona/dasp/DaspConst.java +++ b/src/sedona/src/sedona/dasp/DaspConst.java @@ -80,7 +80,6 @@ public interface DaspConst public static final int RECEIVE_TIMEOUT = 0x31; // (c,1) public static final int ERROR_CODE = 0x35; // (d,1) public static final int PLATFORM_ID = 0x3a; // (e,2) - public static final int COMP_NAME_LEN = 0x3d; // (f,1) //////////////////////////////////////////////////////////////// // Error Codes diff --git a/src/sedona/src/sedona/dasp/DaspMsg.java b/src/sedona/src/sedona/dasp/DaspMsg.java index db28a6e..17887c3 100644 --- a/src/sedona/src/sedona/dasp/DaspMsg.java +++ b/src/sedona/src/sedona/dasp/DaspMsg.java @@ -150,7 +150,6 @@ protected void doDecode(byte[] buf, final int length) throws UnsupportedEncoding case RECEIVE_TIMEOUT: receiveTimeout = u2 * 1000L; break; case ERROR_CODE: errorCode = u2; break; case PLATFORM_ID: platformId = str; break; - case COMP_NAME_LEN: compNameLenMax = u2; break; default: System.out.println("WARNING: Unknown field id: " + id); } } @@ -645,30 +644,7 @@ public final void setPlatformId(String platformId) this.platformId = platformId; } - /** - * Get compNameLenMax header field. - * - * @return the maximum length for component name, - * or -1 if the header is not set. - */ - public final int compNameLenMax() - { - return compNameLenMax; - } - /** - * Set the compNameLenMax header field. - * - * @param errorCode - * maximum length for component name. - Use a negative value to clear this header. - */ - public final void setCompNameLenMax(final int compNameLenMax) - { - this.compNameLenMax - = Math.max(-1, compNameLenMax); - } - //////////////////////////////////////////////////////////////// //Debug //////////////////////////////////////////////////////////////// @@ -693,7 +669,6 @@ public void dump(PrintWriter out) if (receiveTimeout > -1) out.println(" receiveTimeout = " + receiveTimeout); if (errorCode > -1) out.println(" errorCode = " + errorCode); if (platformId != null) out.println(" platformId = " + platformId); - if (compNameLenMax > -1) out.println(" compNameLenMax = " + compNameLenMax); out.flush(); } @@ -733,7 +708,6 @@ static String toString(byte[] buf, int len) protected long receiveTimeout = -1; protected int errorCode = -1; protected String platformId; - protected int compNameLenMax = -1; // payload bytes protected byte[] payload = noBytes; From 5ac86926d9295c4ee143b287bdf22d098921db69 Mon Sep 17 00:00:00 2001 From: Vincent Wang Date: Fri, 10 May 2019 23:58:07 +0800 Subject: [PATCH 8/8] Revert "add header for max length of comp's name" This reverts commit d6740973bedd32574555189a91c957bbee0cd86a. --- doc/dasp.html | 1 - src/kits/sox/Dasp.sedona | 1 - src/kits/sox/SoxSession.sedona | 5 +---- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/doc/dasp.html b/doc/dasp.html index 97bc61a..6f21bed 100644 --- a/doc/dasp.html +++ b/doc/dasp.html @@ -245,7 +245,6 @@

Header Fields

0x31 (c, 1)receiveTimeoutu2Receive timeout in seconds (30sec) 0x35 (d,1)errorCodeu2One of the predefined error codes 0x3a (e,2)platformIdstrDevice's platform ID string -0x3d (f,1)compNameLenu2Max length of component's name

diff --git a/src/kits/sox/Dasp.sedona b/src/kits/sox/Dasp.sedona index 8188ff5..4424c34 100644 --- a/src/kits/sox/Dasp.sedona +++ b/src/kits/sox/Dasp.sedona @@ -71,7 +71,6 @@ class Dasp define int RECEIVE_TIMEOUT = 0x0c // 0x31 (c,1) define int ERROR_CODE = 0x0d // 0x35 (d,1) define int PLATFORM_ID = 0x0e // 0x3a (e,2) - define int COMP_NAME_LEN = 0x0f // 0x3d (f,1) //////////////////////////////////////////////////////////////// // Error Codes diff --git a/src/kits/sox/SoxSession.sedona b/src/kits/sox/SoxSession.sedona index 460b03c..782aa5c 100644 --- a/src/kits/sox/SoxSession.sedona +++ b/src/kits/sox/SoxSession.sedona @@ -161,10 +161,7 @@ class SoxSession out.writeI2(service.receiveMax) out.write(Dasp.RECEIVE_TIMEOUT << 2 | Dasp.U2) out.writeI2(receiveTimeout) - out.write(Dasp.COMP_NAME_LEN << 2 | Dasp.U2) - out.writeI2(Component.nameLen-1) - - service.packet.bytes[4] |= 4 // header count + service.packet.bytes[4] |= 3 // header count service.send(this) }