News:

  • September 24, 2026, 03:04:49 PM

Login with username, password and session length

Author Topic: Generating a GUID  (Read 8305 times)

Andrew S

  • Hero Member
  • *****
  • Posts: 144
Generating a GUID
« on: May 14, 2019, 10:35:30 AM »
Is there a way to generate a Globally-Unique ID on the Do-more? I want to send data using MQTT with QoS=1 but to ensure that data isn't processed twice I need to send a GUID as part of the data. I could use date/time but this doesn't necessarily ensure uniqueness (especially when strange things happen like a clock time change).

Is there a better way to ensure I don't duplicate data when sending over MQTT? when only QoS=0 and QoS=1 are available?

Thanks, Andrew.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: Generating a GUID
« Reply #1 on: May 14, 2019, 11:50:49 AM »
Is there a way to generate a Globally-Unique ID on the Do-more? I want to send data using MQTT with QoS=1 but to ensure that data isn't processed twice I need to send a GUID as part of the data. I could use date/time but this doesn't necessarily ensure uniqueness (especially when strange things happen like a clock time change).

Is there a better way to ensure I don't duplicate data when sending over MQTT? when only QoS=0 and QoS=1 are available?

Thanks, Andrew.

The microsecond or millisecond tick counters are pretty reliable for that. They reset when the hardware is power cycled, but freerun otherwise. TICKus() or TICKms() from the MATH box.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Andrew S

  • Hero Member
  • *****
  • Posts: 144
Re: Generating a GUID
« Reply #2 on: May 14, 2019, 03:04:29 PM »
Sounds good. Thanks.

Andrew.