Hi!
I'm new here - I actually just joined to participate in this thread - and I'm having some problems with my attempts to connect to the PUP devices.
I want to automate our track layout and train controls, so I thought about the following setup: A Raspberry Pi with a BT dongle talks to the trains, the switch motors and the remotes. Some features of the software would be to automatically connect everything automatically by knowing all involved MAC addresses, limit a trains' speed so it will not fly off the track, run two motors from one remote, or, to be more precise, run both trains from the "train remote", while the "switch remotes" run the switches.
Now despite following this thread and reading other sources of documentation, I still cannot properly communicate with the remote control. Maybe someone here can tell me which kind of stupid mistake I made...
#!/bin/bash
gatttool -b 00:81:f9:e4:b2:0d --char-write-req --handle=0x0f --value=0100
gatttool -b 00:81:f9:e4:b2:0d --char-write-req --handle=0x0e --value=0a00400000100000001 --listen
I expected this "test balloon" to give me some readings, but I get the message "invalid handle" on both. Nonetheless, the LED on the remote indicates that it is connected until I end the gatttool.
I got the strings for "value" from some posts in this thread, but they didn't mention which handle to use - that I copied off BoostRevenge, but obwiously I didn't do it correctly. So which channels would I need to address to be able to read the buttons on the PUB remote controller, or did I do something fundamentally wrong?
EDIT: I think I got it... I made two mistakes: a) I had the wrong handles, and b) my value was lacking a digit.
After some research I am now here:
#!/bin/bash
gatttool -b 00:81:f9:e4:b2:0d --char-write-req --handle=0x0c --value=0100
gatttool -b 00:81:f9:e4:b2:0d --char-write-req --handle=0x0b --value=0a004100000100000001
gatttool -b 00:81:f9:e4:b2:0d --char-write-req --handle=0x0b --value=0a004101000100000001 --listen
The first gatttool call enables notifications, the second enables the left keys, the third one the right keys.
This gives me results like:
Notification handle = 0x000b value: 05 00 45 00 ff
Notification handle = 0x000b value: 05 00 45 00 00
Notification handle = 0x000b value: 05 00 45 00 7f
Notification handle = 0x000b value: 05 00 45 00 00
Notification handle = 0x000b value: 05 00 45 00 01
Notification handle = 0x000b value: 05 00 45 00 00
Notification handle = 0x000b value: 05 00 45 01 01
Notification handle = 0x000b value: 05 00 45 01 00
Notification handle = 0x000b value: 05 00 45 01 7f
Notification handle = 0x000b value: 05 00 45 01 00
Notification handle = 0x000b value: 05 00 45 01 ff
Notification handle = 0x000b value: 05 00 45 01 7f
Notification handle = 0x000b value: 05 00 45 01 00
05 00 45 <PORT> <VALUE>
PORT 00 Left keys, PORT 01 Right keys
VALUE 00 No Key, VALUE 01 Plus Key, VALUE 7F Red Key, Value FF Minus Key
It also gives me a
Notification handle = 0x000b value: 0a 00 47 01 00 01 00 00 00 01
which I have not yet understood.