Skip to content
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

[pick-brains][omron-fins.mspec] Regarding the message body #1979

Closed
rooterWzs opened this issue Jan 19, 2025 · 2 comments
Closed

[pick-brains][omron-fins.mspec] Regarding the message body #1979

rooterWzs opened this issue Jan 19, 2025 · 2 comments

Comments

@rooterWzs
Copy link

I have a question to ask you: Should I encapsulate it into one message body or multiple message bodies?
example one body:
// FINS Message
[discriminatedType FINSMessage
[const uint 32 protocolId 0x46494E53] // FINS协议标识符
[implicit uint 32 length 'lengthInBytes'] // 数据包长度,自动计算
[discriminator uint 32 command]
[const unit 32 errorCode 0x00000000]
[typeSwitch command
['0x00000000' FINSHandshakeRequest
]
['0x00000001' FINSReadRequest
]
['0x00000002' FINSWriteRequest
]
]
[optional FINSParameter ('command')]
]

example multiple message bodies:

// FINSRequestMessage
[discriminatedType FINSRequestMessage
.........
]

// FINSResponseMessage
[discriminatedType FINSResponseMessage
.........
]

@chrisdutz
Copy link
Contributor

One ask, that I have for you: Could you please update your comments to english?

But to your question: Your first option looks absolutely standard. It's also exactly the use case we built the discriminated types for. I would definitely reccommend doing that.

Also we recently added the ability of nested typeSwitches. In the past you couldn't nest these and you needed to add additional intermediate types. Now you could even have for examples multiple types of FINSReadRequests which share some common properties.

If the protocol doesn't provide the information needed to decide between request and response, you can also pass in arguments from the driver (Have a look in the Modbus Protocol).

PS: I think it would most probably be best to not open issues for this type of discussion, but to open a discussion in the discussion section.

@rooterWzs
Copy link
Author

Firstly, thank you very much for giving me direction. I will continue to improve.
Okay, I will translate the annotations into English.
I once tried to send an email to [email protected] But I haven't received a reply, why is that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants