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

Been trying to get BLE communication functioning with an ESP32 and an Oculus Quest through a Unity app. #187

Open
01GOD opened this issue Jul 5, 2023 · 13 comments

Comments

@01GOD
Copy link

01GOD commented Jul 5, 2023

Firstly, thanks for posting this library!

Been trying to get bi-directional BLE communication functioning with an ESP32 and an Oculus Quest through a Unity app.
Tried "Bluetooth LE for iOS, tvOS and Android" and that connected, but then the Unity app running on the quest couldn't find the BLE services.

So now looking at making it appear as a gamepad with BT serial with this library. Bi-directional communication is possible with this?

Thanks in advance for answering soon, if possible!

@LeeNX
Copy link

LeeNX commented Jul 6, 2023

Could look at using an idea of #111, but I think it's a hack and more than likely not going to work long run.

I think the correct way to do this is use the BLE feature/output. I was investigating this for Player LEDs and forcefeedback, but your application would need to use the HID directly, unless exposed in a standard way that is supported by host OS. Think like how the CAPSLock LED on keyboard works.

A test example has was made - #43 (comment).

Maybe it's a starting point. Still not use if the Host OS would expose this. I was thinking it might be easier to get support in SDL3 or maybe Linux.

@01GOD
Copy link
Author

01GOD commented Jul 7, 2023

Thanks! I tried doing a custom BLE, but although the Unity app could connect to the ESP32, it couldn't find the BLE services.

May try this or making it be a keyboard. Because those are fully allowed and that likely will continue to be that way. May use the caps lock light as a way to send an on signal to the emulated keyboard.

@LeeNX
Copy link

LeeNX commented Jul 9, 2023

Is there or do you have a public copy of the Unity App? I have seen, but never used the following - https://www.hackster.io/chuartdo/ble-haptic-dual-joystick-controller-31c2c2.

I think it's basic serial.

@01GOD
Copy link
Author

01GOD commented Jul 10, 2023

Saw now! Thanks for the recommendation! The Unity app is the example app in the Unity package called "bluetooth-le-for-ios-tvos-and-android". Talked with that software engineer and sent some code to him that should solve that, but the code it would be put into is inside of an android plugin that isn't exposed for editing. So he has to add it if using that, although sadly he said he has been too busy to do so.
https://assetstore.unity.com/packages/tools/network/bluetooth-le-for-ios-tvos-and-android-26661

@01GOD
Copy link
Author

01GOD commented Jul 10, 2023

PS: Did find a page that seemingly has a full Unity BLE solution for ESP32, but couldn't get it to function. Did try though. Maybe missed something small on the page that was necessary. Sadly the sw engineer wasn't easily contactable and there wasn't a github or similar. Main thing seemingly is the Android BLE bridge. So that is a java plugin that bridges Unity to Android BLE.
https://nagomi0132.hateblo.jp/entry/2022/01/10/223018

If that japanese plugin would function, then could add the code from the following page to that plugin to supposedly make it function reliably on a Quest. If any here are up for getting that functioning, that would be a GREAT Unity asset to make available to the community. (including if it was low cost commercial asset, as buying a reliable solution for 5 or 10 US DOLLARS to have a reliable solution for BLE on Quest seems tolerable)
https://communityforums.atmeta.com/t5/Quest-Development/Bluetooth-scan-and-permissions-BLE-and-the/m-p/970810/highlight/true#M4775

@LeeNX
Copy link

LeeNX commented Jul 10, 2023

Not use that the Oculus has BLE support - https://stackoverflow.com/questions/51320721/ble-and-bluetooth-gamepad-options-for-oculus

Looks like only Bluetooth v3, but can't confirm this. I was looking and thinking maybe you don't have admin/root access?

On Android I have used nRF Connect and BLE Scanner to investigate Services and Characteristic. This is how I did basic output/feedback into a test GamePad.

Best of luck

@01GOD
Copy link
Author

01GOD commented Jul 10, 2023

Thanks for explaining that. There definitely doesn't seem to be admin access on the Oculus Quest.

So the issue has been either because of that, or because of the Unity app's Android BLE plugin bridge (although maybe was because I wasn't emulating a gamepad with some specific gamepad ID that I don't know about and thus the permissions didn't allow it). I plan to try this and possibly making an ESP32 emulate a keyboard also though. Thanks again for posting the library!

@LeeNX
Copy link

LeeNX commented Jul 10, 2023

Testing with a BLE keyboard or mouse would be a good test.

@01GOD
Copy link
Author

01GOD commented Jul 10, 2023

Yes. I was thinking maybe there is a special UUID or similar that is reserved for BLE gamepads and keyboards and that maybe the Android OS on the Quest allows those, but not other BLE services. (or something such as that)

@LeeNX
Copy link

LeeNX commented Jul 10, 2023

I might be wrong about the Oculus. Have you seen #135 (comment)

@01GOD
Copy link
Author

01GOD commented Jul 11, 2023

Ah. Saw now. Maybe it's some industry standard UUID for the services or something?

@lemmingDev
Copy link
Owner

Might be something usable here
https://github.com/afpineda/Nus-NimBLE-Serial

@01GOD
Copy link
Author

01GOD commented Mar 7, 2024

Might be something usable here https://github.com/afpineda/Nus-NimBLE-Serial

Thanks for mentioning that. Saw that now. Don't know how I missed that comment. Excuse the delay.

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