Here's the incantation I made at the Raspberry Pi end, using the proposed encoding of an Object Net URL:
hcitool -i hci0 cmd 0x08 0x0008 1f 02 01 1a 1b ff 4c 00 02 16 c0 a8 00 12 1f 92 c0 93 a9 08 a9 d8 f1 c1 00 00 00 00 00 00 00 00
The first bold numbers are the IP address in hex (192.168.0.18), the next two numbers are the port number (8082) and the following bold numbers are the UID.
Here's the Android log output, partly from my own code:
I/bt-hci (12892): BLE HCI(id=62) event = 0x02)
I/bt-hci (12892): btu_ble_process_adv_pkt
D/BtGatt.btif(12892): btif_gattc_upstreams_evt: Event 4096
D/BtGatt.GattService(12892): onScanResult() - address=00:02:72:C6:F1:B3, rssi=-61
D/BluetoothAdapter(18229): onScanResult() - Device=00:02:72:C6:F1:B3 RSSI=-61
I/System.out(18229): ---Cyrus---Thread[Binder_3,5,main]--- 172712,1285
I/System.out(18229): xxxxxxx BLE device: :: 00:02:72:C6:F1:B3 :: -61 :: 02 01 1a 1b ff 4c 00 02 16 c0 a8 00 12 1f 92 c0 93 a9 08 a9 d8 f1 c1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
I/System.out(18229): ---Cyrus---Thread[Binder_3,5,main]--- 172713,1
I/System.out(18229): xxxxxxx URL :: http://192.168.0.18:8082/o/uid-c093-a908-a9d8-f1c1.json
There's my URL reconstructed via a simple String.format. The -61 is the signal strength (RSSI) that we'll need later.
Next step is to get the lifecycle, threading and polling of this BLE scanning all sorted out in the Android app so that I can get this to the user quickly and reliably, in the form of a list of URLs to nearby Things ordered by signal strength. They can then choose a link in order to view and interact with it in 3D.
You'll need screenshots, obviously.
No comments:
Post a Comment