Skip to content

Add a UUID generator function #1

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

Open
tigoe opened this issue Nov 14, 2018 · 6 comments
Open

Add a UUID generator function #1

tigoe opened this issue Nov 14, 2018 · 6 comments
Labels
type: enhancement Proposed improvement

Comments

@tigoe
Copy link

tigoe commented Nov 14, 2018

Every BLE sketch needs a handful of them. We all end up going to https://www.uuidgenerator.net/ to get them. Why not just build in the function?

const char[] createUUID(), for example.

@tigoe tigoe added the type: enhancement Proposed improvement label Nov 14, 2018
@sandeepmistry
Copy link
Contributor

Hmm, I'm not sure if this is a good idea, https://www.uuidgenerator.net/ mentions:

What is a Version 1 UUID?

A Version 1 UUID is a universally unique identifier that is generated using a timestamp and the MAC address of the computer on which it was generated.

We won't have easy access to the timestamp unless we connect via WiFi and use NTP.

Then we'd also need to know the devices MAC (or BT address).

What is a version 4 UUID?

A Version 4 UUID is a universally unique identifier that is generated using random numbers. The Version 4 UUIDs produced by this site were generated using a secure random number generator

Unless we use the crypto chip (which needs to be configured and locked), the Arduino random number API's are pseudo random.

What do you think?

@tigoe
Copy link
Author

tigoe commented Nov 14, 2018

Hmmm...

I like the idea of making it easy to generate UUIDs. At the very least, mentioning the uuidgenerator site in the docs is good, perhaps along with these two descriptions.

It's not possible to use the WiFi and the BLE at the same time, is it?

I suppose it'd be possible to use the RTC and the MAC address to generate the version 1 UUID. But that'd be better as its own example or library.

Other than that, maybe you are right, better to use an easily accessible external source.

t.

@sandeepmistry
Copy link
Contributor

I like the idea of making it easy to generate UUIDs. At the very least, mentioning the uuidgenerator site in the docs is good, perhaps along with these two descriptions.

Agreed, when the docs are updated, I'll make sure it gets added

It's not possible to use the WiFi and the BLE at the same time, is it?

Currently no, the SPI pins connected to the NINA are converted to another UART to use for HCI communications.

@tigoe
Copy link
Author

tigoe commented Nov 16, 2018

Hm. Then best to go with a link in the documentation.

@tobozo
Copy link

tobozo commented Nov 16, 2018

would this fit the need of generating UUIDs ?

@mirrorshot
Copy link

I was wondering: how do you see a compile-time directive to generate a random UUID?
This could have access to system time.

mmaciej2 pushed a commit to mmaciej2/ArduinoBLE that referenced this issue Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

4 participants