-
Notifications
You must be signed in to change notification settings - Fork 36
Remove length field from OBJECT_DATAGRAM #625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The length is inferred from the transport datagram. Add a new datagram type for conveying an Object Status. This saves 1-2 bytes per datagram. Fixes: #552
conveys an Object Status and has no payload. | ||
|
||
~~~ | ||
OBJECT_DATAGRAM_STATUS Message { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if there is a needed for explicit message for reporting status. Can't we just use the status in the original message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@suhasHere The current DATAGRAM message has a status field that is present when length is 0. Since this PR removes the length field, the only thing I could see was either 1) include the status in every datagram, wasting space in the common case, or 2) define a special datagram message that carries only the status.
Do you have an alternative encoding to what is here that is unambiguous and compact?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an alternate with a "single" message (single in scare quotes because there are technically 5 code points):
OBJECT_DATAGRAM Message {
TypeAndStatus(i) 0x00..0x04
Track Alias (i),
Group ID (i),
Object ID (i),
Publisher Priority (8),
[Payload(..)]
}
The first varint in the datagram is TypeAndStatus. Values 0-4 convey an Object. If TypeAndStatus is 0, the Status is Normal and a Payload exists to the remainder of the datagram. It is an error if the payload is empty. TypeAndStatus 1-4 indicate the given object status and have no payload. It is an error if the datagram has bytes beyond Publisher Priority. TypeAndStatus > 4 are undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wonder if we can define the encoding in a way that we don't need 2 messages.
The length is inferred from the transport datagram. Add a new datagram type for conveying an Object Status. This saves 1-2 bytes per datagram.
Fixes: #552