Class for manipulating UUID (aka GUID) entities. More...

#include <Uuid.h>

Inheritance diagram for Uuid:
Collaboration diagram for Uuid:

Public Member Functions

constexpr Uuid ()
 
 Uuid (const char *s)
 
 Uuid (const char *s, size_t len)
 
 Uuid (const String &s)
 
 Uuid (const FlashString &s)
 
constexpr Uuid (uint32_t time_low, uint16_t time_mid, uint16_t time_hi_and_version, uint8_t clock_seq_hi_and_reserved, uint8_t clock_seq_low, uint8_t n1, uint8_t n2, uint8_t n3, uint8_t n4, uint8_t n5, uint8_t n6)
 
 operator bool () const
 
bool operator== (const Uuid &other) const
 
bool operator!= (const Uuid &other) const
 
bool generate (MacAddress mac)
 Generate a UUID using a MAC node address. More...
 
bool generate ()
 Generate UUID using random number instead of MAC. More...
 
Decompose string into UUID
bool decompose (const char *s, size_t len)
 
bool decompose (const char *s)
 
bool decompose (const String &s)
 
Get string representation of UUID
size_t toString (char *buffer, size_t bufSize) const
 
String toString () const
 
 operator String () const
 

Public Attributes

uint32_t time_low {0}
 
uint16_t time_mid {0}
 
uint16_t time_hi_and_version {0}
 
uint8_t clock_seq_hi_and_reserved {0}
 
uint8_t clock_seq_low {0}
 
uint8_t node [6] {}
 

Static Public Attributes

static constexpr size_t stringSize = 36
 Number of characters in a UUID string (excluding NUL terminator) More...
 

Detailed Description

Class for manipulating UUID (aka GUID) entities.

UUID: Universally Unique IDentifier GUID: Globally Unique IDentifier

See https://pubs.opengroup.org/onlinepubs/9629399/apdxa.htm.

Constructor & Destructor Documentation

◆ Uuid() [1/6]

constexpr Uuid::Uuid ( )
inlineconstexpr

◆ Uuid() [2/6]

Uuid::Uuid ( const char *  s)
inlineexplicit

◆ Uuid() [3/6]

Uuid::Uuid ( const char *  s,
size_t  len 
)
inlineexplicit

◆ Uuid() [4/6]

Uuid::Uuid ( const String s)
inlineexplicit

◆ Uuid() [5/6]

Uuid::Uuid ( const FlashString s)
inlineexplicit

◆ Uuid() [6/6]

constexpr Uuid::Uuid ( uint32_t  time_low,
uint16_t  time_mid,
uint16_t  time_hi_and_version,
uint8_t  clock_seq_hi_and_reserved,
uint8_t  clock_seq_low,
uint8_t  n1,
uint8_t  n2,
uint8_t  n3,
uint8_t  n4,
uint8_t  n5,
uint8_t  n6 
)
inlineexplicitconstexpr

Member Function Documentation

◆ decompose() [1/3]

bool Uuid::decompose ( const char *  s)
inline

◆ decompose() [2/3]

bool Uuid::decompose ( const char *  s,
size_t  len 
)

◆ decompose() [3/3]

bool Uuid::decompose ( const String s)
inline

◆ generate() [1/2]

bool Uuid::generate ( )

Generate UUID using random number instead of MAC.

Return values
booltrue if system clock time was used, false if substituted with random number

Used where MAC address is not available or it is not desirable to expose it.

◆ generate() [2/2]

bool Uuid::generate ( MacAddress  mac)

Generate a UUID using a MAC node address.

Parameters
macNode address to use in generating the UUID, typically from WifiStation
Return values
booltrue if system clock time was used, false if substituted with random number

◆ operator bool()

Uuid::operator bool ( ) const
inlineexplicit

◆ operator String()

Uuid::operator String ( ) const
inline

◆ operator!=()

bool Uuid::operator!= ( const Uuid other) const
inline

◆ operator==()

bool Uuid::operator== ( const Uuid other) const

◆ toString() [1/2]

String Uuid::toString ( ) const

◆ toString() [2/2]

size_t Uuid::toString ( char *  buffer,
size_t  bufSize 
) const
Parameters
uuid
buffer
bufSizeMust be at least UUID_STRING_SIZE
Return values
size_tnumber of characters written (either 0 or UUID_STRING_SIZE)
Note
Converts UUID into a string of the form

<time_low>-<time_mid>-<time_high_and_version>-<clock_seq_and_reserved><clock_seq_low>-<node>

e.g. 2fac1234-31f8-11b4-a222-08002b34c003

Member Data Documentation

◆ clock_seq_hi_and_reserved

uint8_t Uuid::clock_seq_hi_and_reserved {0}

◆ clock_seq_low

uint8_t Uuid::clock_seq_low {0}

◆ node

uint8_t Uuid::node[6] {}

◆ stringSize

constexpr size_t Uuid::stringSize = 36
staticconstexpr

Number of characters in a UUID string (excluding NUL terminator)

◆ time_hi_and_version

uint16_t Uuid::time_hi_and_version {0}

◆ time_low

uint32_t Uuid::time_low {0}

◆ time_mid

uint16_t Uuid::time_mid {0}

The documentation for this struct was generated from the following file: