opendroneid / receiver-android

Example Android receiver application for unmanned aircraft Remote ID
Apache License 2.0
204 stars 62 forks source link

Bluetooth beacon transponder? #7

Closed kjkrout closed 4 years ago

kjkrout commented 4 years ago

Is anyone aware of any bluetooth beacon transponder application I could use to test the android receiver application? I'm using beacon simulator and added the UUID but nothing is showing up as a drone. Is there a setting that I'm not setting correctly for the receiver-android app?

Thanks, Kevin

friissoren commented 4 years ago

I am unfortunately not aware of any freely available Bluetooth transmitter implementation. We have modified the firmware for a TI CC2640 chip but due to the SW license agreement from TI, we are unable to share that implementation as open source.

The scanner is setup to filter away all Bluetooth signals that doesn't correspond to the identifiers defined in the ASTM remote ID standard: https://github.com/opendroneid/receiver-android/blob/master/Android/app/src/main/java/org/opendroneid/android/bluetooth/BluetoothScanner.java#L124

To help debug this, you could try to first disable that scan filter in the app and see if your beacon then shows up. If yes, you then need to modify your beacon data so that it will show up also when the scan filter is in place.

gabrielcox commented 4 years ago

@kjkrout What Beacon simulator are you using? Can you paste the sample frame (hex?) you are building?

kjkrout commented 4 years ago

@friissoren

I was able to disable the filter and that helped.

I just made the call to bluetoothLeScanner.startScan(scanCallback); thank you

Now to change the beacon data? I am also am working with the TI CC260 chip and trying to use the simple_broadcaster example. I tried setting the UUID in the simple_broadcaster.c but that did help. I thought that was what it was filtering on.

0x00, // UUID - Variable based on different use cases/applications line 224 0x00, // UUID 0xff, // UUID 0xfa, // UUID 0x00, // UUID 0x00, // UUID 0x10, // UUID 0x00, // UUID 0x80, // UUID 0x00, // UUID 0x00, // UUID 0x80, // UUID 0x5f, // UUID 0x9b, // UUID 0x34, // UUID 0xfb, // UUID

also I am trying to change the advertData[] to match drone information without success.

Thank you for the help

kjkrout commented 4 years ago

@gabrielcox

I am using the TI CC260 chip and trying to use the simple_broadcaster example. I haven't done much to the code other than setting the UUID in the simple_broadcaster.c but that did help.

0x00, // UUID - Variable based on different use cases/applications line 224 0x00, // UUID 0xff, // UUID 0xfa, // UUID 0x00, // UUID 0x00, // UUID 0x10, // UUID 0x00, // UUID 0x80, // UUID 0x00, // UUID 0x00, // UUID 0x80, // UUID 0x5f, // UUID 0x9b, // UUID 0x34, // UUID 0xfb, // UUID

friissoren commented 4 years ago

Here is a byte string printed from the app from a working transmitter: 1E 16 FA FF 0D 25 00 12 53 53 45 56 54 46 47 39 34 32 30 30 30 39 34 00 00 00 00 00 00 00 00

From the CC2640 code, I have:

// Service Data - 16-bit UUID

define GAP_ADTYPE_SERVICE_DATA 0x16

static uint8 advertiseHeader[] = { 0x00, // length of the data excluding this field GAP_ADTYPE_SERVICE_DATA, // Service Data - 16-bit UUID. https://www.bluetooth.com/specifications/assigned-numbers/generic-access-profile/ 0xFA, // SDO ID - Little Endian. ASTM International. ASTM Remote ID. https://www.bluetooth.com/specifications/assigned-numbers/16-bit-uuids-for-sdos/ 0xFF, // SDO ID - Little Endian 0x0D, // Data Type - Fixed in the OpenDroneID standard. Application Code: 0x0D = Open Drone ID 0x00, // Advertisement Data Counter };

You need to put an actual value in the length field instead of zero.

Side note: Make also sure you are working against the final specification. See https://github.com/opendroneid/specs/issues/3

kjkrout commented 4 years ago

@friissoren Thanks for your help. I am still trying to figure out the beacon data code. Below is what I changed in the advertData[]. Is that the same as your advertiseHeader[]?

changes made: GAP_ADTYPE_SERVICE_DATA, Length of data and Data Type and UUID

I'm not sure which values are for the little endian? 0xFA, // SDO ID - Little Endian. ASTM International. ASTM Remote ID. 0xFF, // SDO ID - Little Endian

static uint8 advertData[] = { // Flags; this sets the device to use limited discoverable // mode (advertises for 30 seconds at a time) instead of general // discoverable mode (advertises indefinitely) 0x02, // length of this data GAP_ADTYPE_FLAGS, GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,

ifndef BEACON_FEATURE

// three-byte broadcast of the data "1 2 3" 0x04, // length of this data including the data type byte GAP_ADTYPE_SERVICE_DATA, // manufacturer specific adv data type 1, 2, 3

else

// 25 byte beacon advertisement data // Preamble: Company ID - 0x000D for TI, refer to https://www.bluetooth.org/en-us/specification/assigned-numbers/company-identifiers // Data type: Beacon (0x02) // Data length: 0x15 // UUID: 00000000-0000-0000-0000-000000000000 (null beacon) // Major: 1 (0x0001) // Minor: 1 (0x0001) // Measured Power: -59 (0xc5) 0x1A, // length of this data including the data type byte GAP_ADTYPE_SERVICE_DATA, // manufacturer specific adv data type 0x0D, // Company ID - Fixed 0x00, // Company ID - Fixed 0x0D, // Data Type - Fixed 0x15, // Data Length - Fixed 0x00, // UUID - Variable based on different use cases/applications line 224 0x00, // UUID 0xff, // UUID 0xfa, // UUID 0x00, // UUID 0x00, // UUID 0x10, // UUID 0x00, // UUID 0x80, // UUID 0x00, // UUID 0x00, // UUID 0x80, // UUID 0x5f, // UUID 0x9b, // UUID 0x34, // UUID 0xfb, // UUID 0x00, // Major 0x01, // Major 0x00, // Minor 0x01, // Minor 0xc5 // Power - The 2's complement of the calibrated Tx Power

endif // !BEACON_FEATURE

};

friissoren commented 4 years ago

Try to just use the byte string that I gave earlier: 1E 16 FA FF 0D 25 00 12 53 53 45 56 54 46 47 39 34 32 30 30 30 39 34 00 00 00 00 00 00 00 00

1E is the length byte, 16 the GAP_ADTYPE_SERVICE_DATA and so on.

kjkrout commented 4 years ago

@friissoren

Thank you so much. I am making some headway. To add the location data would that also be added to the adverData[]? is that added onto the end?

Thanks, Kevin :)

friissoren commented 4 years ago

I would recommend that you get a copy of the final version of the ASTM specification: https://www.astm.org/Standards/F3411.htm

There are some early versions available here but keep in mind that some details have changed in the final version compared to those: https://github.com/opendroneid/specs

You can use the code from opendroneid-core-c to generate "compressed" message data that you insert in the last part of the advertising data. The last 25 bytes in the example above is the message data. https://github.com/opendroneid/opendroneid-core-c