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

Possible to have multiple, independent scpi session? #122

Closed
mammutserver opened this issue Mar 16, 2021 · 4 comments · Fixed by #127
Closed

Possible to have multiple, independent scpi session? #122

mammutserver opened this issue Mar 16, 2021 · 4 comments · Fixed by #127
Labels

Comments

@mammutserver
Copy link

Is it possible to have multiple clients connected to a STM32 where each client has his own scpi session?
In my case all clients get an error message if one client sends a wrong command

@j123b567
Copy link
Owner

It is not supported in the library itself, but you can have multiple scpi_t contexts. Each context has different input buffer, but they can share status nad commands.

Real implementation depends on the usage, connection types, number of sessions, dynamic memory allocation, etc.

@mammutserver
Copy link
Author

mammutserver commented Mar 17, 2021

So I assume I have to use a scpi_t context for each session and I have to run SCPI_Init for each context? And is there a way to detect a new client connection in scpi-parser?

@j123b567
Copy link
Owner

j123b567 commented Mar 17, 2021

It should be good start. You can share almost everything except input buffer, which you intentionally need separate for each session. You also can't share error_queue_data because of the way, how SCPI_Init works. You will probably loos all errors after you disconnect.

New client connection heavily depend on your communication scheme. E.g. if you are using TCP, then when you "accept" the connection, then it is the new session.

I don't know if SCPI was ever meant to be used by multiple masters at the same time. There are lot of global and local states which mix together. So in general, it will produce more problems outside this library - locking resources, ...

@mammutserver
Copy link
Author

Thank you @j123b567
Multiple SCPI sessions over network / TCP are working just fine. Two connections over USB don't seem to work which is understandable.

@j123b567 j123b567 linked a pull request Nov 8, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants