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

Hardware API addition: get_serial_number() #54

Open
njh opened this issue Nov 13, 2016 · 5 comments
Open

Hardware API addition: get_serial_number() #54

njh opened this issue Nov 13, 2016 · 5 comments

Comments

@njh
Copy link

njh commented Nov 13, 2016

Hello,

I am interesting in getting a unique identifier for a Tingbot device, so that it can be used as a connection identifier when an app is installed on multiple devices.

A couple of options I have considered:

I am leaning towards the second option, because it should work with the simulator too.

What do you think? Would you accept a Pull Request?

Thanks,

nick.

@joerick
Copy link
Member

joerick commented Nov 14, 2016

Hey @njh! The MAC address option has a small problem that users might try it alongside get_ip_address() and not realise that they refer to different interfaces.

So the serial number is my preferred option. Happy to accept PR for that. Would your use case be okay with the Simulator returning a serial number '0000000000000000', or would that cause problems?

@njh
Copy link
Author

njh commented Nov 14, 2016

Thanks Joe!

Yes, lets start with that.

Alternatives might be to either generate (and persist) a random number in the simulator. Or include part of the first network interface MAC address in the simulator. I'm not sure if it is worth contacting Raspberry Pi and asking if there is a structure to the serial number - and if some space could be reserved for 'fake pis'?

@joerick
Copy link
Member

joerick commented Nov 14, 2016

A generated/persisted number would be a handy workaround!

I wouldn't expect these numbers to be used for anything except direct comparisons, so we could design our own identifier scheme for the simulator tbsimulator-0123456789abcdef or something.

@furbrain
Copy link
Contributor

You could use a uuid for this - see the python uuid module for more details

On 14 Nov 2016 09:54, "Joe Rickerby" notifications@github.com wrote:

A generated/persisted number would be a handy workaround!

I wouldn't expect these numbers to be used for anything except direct
comparisons, so we could design our own identifier scheme for the simulator
tbsimulator-0123456789abcdef or something.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#54 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AC233RGtIH17PuQ4dfGx7DpGYXETwwKCks5q-C_NgaJpZM4Kwuix
.

@WhistleMaster
Copy link

That's what I'm using in a one of my app:

import uuid
str(uuid.uuid4())

@joerick joerick changed the title Hardware API addition: get_serial_number() / get_mac_address() Hardware API addition: get_serial_number() Nov 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants