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

Add commands for sound effects (siren, horn) #1

Open
zdila opened this issue Jan 24, 2022 · 9 comments
Open

Add commands for sound effects (siren, horn) #1

zdila opened this issue Jan 24, 2022 · 9 comments

Comments

@zdila
Copy link

zdila commented Jan 24, 2022

Hello,

Android application has buttons for sending various sound effects (horn, siren, ...). Please add sound effect commands also to the library or at least tell me what byte sequence should I send to characterstic 40c540d0-344c-4d0d-a1da-9cc260b82d43. I would like to implement it to https://github.com/zdila/node-intelino.

Thanks!

@petrusek
Copy link
Contributor

Hello, sorry for the delay.
Yes, we do plan to have commands for sound effects in the library. Unfortunately we didn't decide how the API should look like, so we are not ready for that step yet.

We understand this could make programming the train more fun, so here are some instructions how to use sounds (before we release it) with the low-level send_command function.

# horn 1
await train.send_command(0x24, [0x00, 0x16, 0x80, 0x00, 0x00])
await asyncio.sleep(2)
# bell
await train.send_command(0x24, [0x00, 0x17, 0x00, 0x00, 0x00])
await asyncio.sleep(2)
# horn 2
await train.send_command(0x24, [0x00, 0x17, 0x80, 0x00, 0x00])
await asyncio.sleep(2)
# police horn
await train.send_command(0x24, [0x00, 0x18, 0x00, 0x00, 0x00])
await asyncio.sleep(2)
# alarm
await train.send_command(0x24, [0x00, 0x18, 0x80, 0x00, 0x00])
await asyncio.sleep(2)

Since the sound is played back from the train without any feedback, the application needs to wait (some time) for the playback to finish. Without this wait the playback would be interrupted and only the last one would play.

Note: since you want to send raw bytes (and not use the library), don't forget to add the length byte (5) after the command byte (24h), e.g. [0x24, 0x05, 0x00, 0x16, 0x80, 0x00, 0x00]

@zdila
Copy link
Author

zdila commented Jan 29, 2022

Great. Thank you!

@zdila zdila closed this as completed Jan 29, 2022
@zdila
Copy link
Author

zdila commented Jan 29, 2022

(actually I shouldn't close it)

BTW: Are there other commands not implemented by the library yet? For example sound volume?

@zdila zdila reopened this Jan 29, 2022
@petrusek
Copy link
Contributor

Unfortunately the FW doesn't support setting volume yet.

The purpose of the library is not to implement all possible commands, but to provide a clean and stable API to interact with the train. If you would like to program something that our library doesn't support, please let us know.

@zdila
Copy link
Author

zdila commented Jan 30, 2022

If you would like to program something that our library doesn't support, please let us know.

I don't know everything what is possible ;-).

BTW I've already implemented playing sound in nodejs library.

@guoruicodes
Copy link

@zdila lol - nice ... slightly joking but I wonder if we could run node lambda functions in AWS with somehow a local bridge to BLE :) btw is FW update possible via app I assume?

@zdila
Copy link
Author

zdila commented Jan 30, 2022

@guoruicodes for FW update use Android app :-)

@guoruicodes
Copy link

@zdila apologies for cluttering this thread but it looks like AWS IOT blogs are using mobile apps as the bluetooth bridge to the device (arduinos in the blogs) - which makes a lot of sense. @petrusek putting support for this on your app backlog would be super - even in a 12-18 month timeline. If we have a cloud connection - then its "my train moves quicker when sentiment analysis about the local weather is good" ....

@petrusek
Copy link
Contributor

petrusek commented Feb 1, 2022

@guoruicodes - sounds great... also you've guessed the timeline pretty well 😂
I've started #2 to collect some more information/ideas on this topic. Feel free to add any resources (e.g. AWS IoT blog links) that are relevant and could be useful to enable this.

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

3 participants