commsdsl icon indicating copy to clipboard operation
commsdsl copied to clipboard

Variable message id length without lenght field

Open mathisloge opened this issue 2 months ago • 1 comments

Hi Alex,

sorry, I need to ask one more question as I can't really figure that out. The visca protocol has message Ids that can have variable long message ids, without a size or lenght field. I wanted to use it like that:

<enum name="ReturnId" type="uint32" length="3" availableLengthLimit="true" semanticType="messageId">
            <validValue name="Ack" val="0x41" />
            <validValue name="Completion" val="0x51" />
            <validValue name="SyntaxError" val="0x6002" />
            <validValue name="CommandNotExecutable" val="0x6141" />
            <validValue name="PanTiltPosInq" val="0x50" />
</enum>
...
 <frame name="CameraFrame">
        <layers>
            <value name="CameraId" interfaces="CommandInterface">
                <interfaceFieldName value="CameraId" />
                <field>
                    <int reuse="CameraId" serOffset="0x8F" />
                </field>
            </value>
            <id name="ReturnCommand" field="ReturnId" />
            <payload name="Command" />
            <checksum name="FrameEnd" alg="custom" algName="EnforceFrameEnd" from="CameraId">
                <int name="FrameEndField" type="uint8" />
            </checksum>
        </layers>
    </frame>

With that it will correctly create the expected byte sequence, however the deserialization to the message object fails. Do you have an idea on how to do that?

mathisloge avatar Nov 18 '25 13:11 mathisloge

Hi Mathis, I don't really know anything about VISCA protocol and it would have been nice if you could attach or provide a link to the protocol specification you're using. I found this one online. I must say the specification is very confusing. If I were you I would use single (0x6Z) byte indicating error message while having type of error to be an <enum> field in the message payload.

<enum name="ReturnId" type="uint8"  semanticType="messageId">
            ...
            <validValue name="ErrorSock0" val="0x60" />
            <validValue name="ErrorSock1" val="0x61" />
            ...
</enum>

<enum name="ErrorType" type="uint8">
    <validValue name="LengthError" val="0x01" />
    <validValue name="SyntaxError" val="0x02" />
    ...
</enum>

<message name="ErrorSock0" id="ReturnId.ErrorSock0">
    <ref field="ErrorType">
</message>

<message name="ErrorSock1" id="ReturnId.ErrorSock1" copyFieldsFrom="ErrorSock0" />

Hope it helps and works for you.

arobenko avatar Nov 19 '25 03:11 arobenko