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

samples: bluetooth: OpenDroneID #84565

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sumitbatra-nxp
Copy link
Contributor

This application demonstrates ODID Message transmission over Bluetooth in GAP Broadcaster role. Currently this program supports transmitting static drone data via Bluetooth Beacon.

OpendroneID application can be used with the SoC and the Board support added in
PR #82034

@zephyrbot zephyrbot added area: Bluetooth area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Samples Samples labels Jan 26, 2025
This application demonstrates ODID Message transmission over Bluetooth
in GAP Broadcaster role. Currently this program supports transmitting
static drone data via Bluetooth Beacon.

Co-authored-by: Mayank Mahajan <[email protected]>
Signed-off-by: Sumit Batra <[email protected]>
*
* @param data (non encoded/packed) structure
*/
void odid_initLocationData(ODID_Location_data *data)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snake case required

Comment on lines +130 to +132
static struct ODID_UAS_Data uasData;
static union ODID_Message_encoded encoded;
static uint8_t msg_counters[ODID_MSG_COUNTER_AMOUNT];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

declare at top of file, in snake case


uasData->BasicID[BASIC_ID_POS_ONE].UAType = ODID_UATYPE_HELICOPTER_OR_MULTIROTOR;
uasData->BasicID[BASIC_ID_POS_ONE].IDType = ODID_IDTYPE_SPECIFIC_SESSION_ID;
char uas_caa_id[] = "FD3454B778E565C24B70";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

declare variables at top

@rugeGerritsen
Copy link
Collaborator

I'm wondering if this code belongs in the folder bluetooth/samples According to its definition: "A sample is a concise Zephyr application that provides an accessible overview of one or more features, subsystems, or modules. "
This looks more like a user application implementing a protocol on top of existing Bluetooth APIs

@sumitbatra-nxp
Copy link
Contributor Author

I would request all the reviewers to kindly review this PR despite of the LLVM/Twister errors since these errors cannot be resolved till PR #82034 is merged

Comment on lines +244 to +251
while (true) {
if (bt_is_ready()) {
break;
}

printf("Bluetooth not ready. Checking again in 100 ms\n");
k_sleep(K_MSEC(100));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does't look particularly elegant. You could instead have this wait on a semaphore that your bt_ready() callback eventually gives, however the bt_enable() API already has support for blocking behavior: you just need to pass NULL to it, and then do the stuff you do in your bt_ready() right here in main()


update_payload(turn);

static const struct bt_data ad_new[] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need this new ad_new? Can't you just reuse the top-level ad?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth area: Samples Samples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants