Closed fcoury closed 6 years ago
You should be able to use Noble to communicate to the keyboard. I unfortunately do not have documentation of the protocol as this project was put together over a week.
I hate to say this but you will need to read the code to understand the protocol (see the bottom of this comment for most relevant parts). If you find the code is rather indecipherable then please do not hesitate contact me over email.
The relevant files which you should check is: https://github.com/kprinssu/anne-keyboard-windows/blob/master/AnneProKeyboard/KeyboardWriter.cs (writes the set of bytes representing the data to the keyboard; the keyboard expects the data to be sent in certain sizes) https://github.com/kprinssu/anne-keyboard-windows/blob/master/AnneProKeyboard/CRC16.cs (CRC checksum that is used by the keyboard; should be easy to port to JavaScript) https://github.com/kprinssu/anne-keyboard-windows/blob/master/AnneProKeyboard/MainPage.xaml.cs#L37 (the GUIDs for the BLE attributes) https://github.com/kprinssu/anne-keyboard-windows/blob/e5f120746c565fde4d5ac8b976ac172829821b68/AnneProKeyboard/KeyboardProfileItem.cs#L138 (Generates the bytes array)
Please let me know if you have any trouble understanding the code. I apologise again the lack of documentation.
@kprinssu this is AWESOME. I am somewhat familiar with C#, completed a few projects using it so it shouldn't be a huge problem.
I'll keep you posted on the progress of the project and maybe nag you a bit here and there if I have any questions.
Thanks!
Sur, please keep me updated on your progress. It’s nice to see more projects being created for such a niche keyboard.
@fcoury If you're going to make an electron version of this app, I'd be interested in helping out
@ethanmsmith your help will be very welcome. I put together a skeleton with basic (and ugly) keyboard rendering here: https://github.com/fcoury/electron-anne-pro.
My keyboard arrives Thursday and I plan on writing a separate npm module with a high level bluetooth communication library that can be reused by any node.js application.
@fcoury I suggest you don’t rewrite the Noble Bluetooth library. It should already have the proper communication methods for Bluetooth.
The Anne Pro keyboard is rather peculiar (in regards in data being sent in chunks) but it communicates over standard Bluetooth protocol.
Easier said than done @kprinssu. The plan was to use Noble but it doesn’t even recognize the keyboard in its current state:
https://github.com/sandeepmistry/noble/issues/736
This issue has been open for quite some time and it seems nobody care, so unfortunately I had to do it myself.
@kprinssu I even created a reusable library that uses BluetoothCore and IOBluetooth on macOS to work around noble - https://github.com/fcoury/node-anne-pro
That is quite unfortunate, noble is a pretty good library. I’ll take a look at your node library and see if I can extend it to Linux.
The code is based on my fork of this library:
https://github.com/fcoury/node-core-bluetooth
I will see if I find time to help with linux at some point.
Closing this issue since it's not bug or a feature request for the app/.
Thank you so much for all the insight you shared here though, it was really helpful!
Just closing the issue as a general cleanup. Feel free to ask questions.
Not really an issue but I wanted to check the feasibility of porting the communication part of this application to Node.js / Electron using something like the https://github.com/sandeepmistry/noble library.
Do you have any documentation (or links to parts of the code) on the protocol you used to communicate with the keyboard?
Thanks!