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

what board am I API endpoint #131

Open
BLuedtke opened this issue Jan 23, 2024 · 7 comments
Open

what board am I API endpoint #131

BLuedtke opened this issue Jan 23, 2024 · 7 comments
Assignees

Comments

@BLuedtke
Copy link
Collaborator

BLuedtke commented Jan 23, 2024

Add an endpoint that returns the name of the model railway (e.g., swtbahn-full), here called "board" or "platform". Not to be confused with a "bidib board" or a platform in the sense of a station platform.

This name is currently not defined in the config files; one workaround could be to use the name of the folder the config files are located in.

@BLuedtke BLuedtke self-assigned this Jan 23, 2024
@BLuedtke
Copy link
Collaborator Author

Once this is done, open a new issue for adjusting the "game" client accordingly.

@BLuedtke
Copy link
Collaborator Author

This also has implications for the experimental-point-control branch/map controller, as that is currently hardcoded to swtbahn-full -> can be made more flexible.

@BLuedtke
Copy link
Collaborator Author

The config.bahn file actually has the info we want - it starts with module <name>, where <name> is (by convention) the name of the board/platform, e.g., SWTbahnFull as can be seen here.

However, this name of the "module" in the BahnDSL config is not included by the BahnDSL compiler/generator in any of the other files, except for in form of a comment in the first line of a file (see this for example).

One option would be to parse the comment of one (or more?) of the yaml config files, before starting the parser for the actual yaml contents. But this is pretty fragile and relies on the comment being there; a user (e.g., a new hiwi) would not expect that changing a comment in a yaml file could change how the system behaves.

I can see two valid options: Either the name of the model railway being "served" has to be provided as a command line parameter when starting the server, or we must change BahnDSL to include the module name, in e.g., the extras_config.yml. However, I'm not sure how much work this would cause in BahnDSL, as I'm not too familiar with that codebase. I'll have a look and then decide.

@BLuedtke
Copy link
Collaborator Author

BLuedtke commented Oct 31, 2024

I got BahnDSL dev environment set up, and prototyped a little. Its pretty easy to add the name of the module defined in config.bahn in any of the yaml outputs. For the prototype, I put it into the extras_config.yaml like modulename: SWTbahnFull in the first line after the comment. This could be parsed by the parser in the swtbahn cli and made accessible with reasonable effort.

The problem: I'm not a maintainer for BahnDSL (thats Tri and Eugene only) and I have no idea how to do these releases and so on. Will ask Eugene how we want to resolve that.

@eyip002
Copy link
Member

eyip002 commented Oct 31, 2024

You can make a pull request over in https://github.com/trinnguyen/bahndsl and let @trinnguyen or I merge it into master. I'm only a contributor so @trinnguyen has to give you permission to do releases.

@trinnguyen
Copy link
Contributor

Hey @BLuedtke, I've invited you to collaborate on the BahnDSL repository. Please check your email. It would allow you to push the code and release a new version. If you need help reviewing the code before merging as a double check, send me or @eyip002 a PR.

@BLuedtke
Copy link
Collaborator Author

BLuedtke commented Nov 1, 2024

Thanks a lot!

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

When branches are created from issues, their pull requests are automatically linked.

3 participants