RobotRaconteurCompanion.Util.UuidUtil

Utility class for working with Robot Raconteur UUIDs.

UUIDs are statistically guaranteed to be unique. The use of UUIDs eliminates the need for a central registry for object identifiers, and allows for easy discovery of devices and services on a network. The name is used to identify services and devices when guaranteed unique identification is not required.

.. code-block:: python

import RobotRaconteur as RR
RRN = RR.RobotRaconteurNode.s
import RobotRaconteurCompanion as RRC
from RobotRaconeteurCompanion.Util.UuidUtil import UuidUtil

RRC.RegisterStdRobDefServiceTypes(RRN)

# Create an UuidUtil
uuid_util = UuidUtil(RRN)

# Create a UUID
my_uuid = uuid_util.NewRandomUuid()

# Create a UUID from a string
my_uuid = uuid_util.UuidFromUuidString("12345678-1234-1234-1234-123456789012")

# Convert UUID to Python UUID
my_uuid = uuid_util.UuidToPyUuid(my_uuid)

# Convert UUID to string
my_uuid_str = uuid_util.UuidToString(my_uuid)

UuidUtil

class RobotRaconteurCompanion.Util.UuidUtil.UuidUtil(node=None, client_obj=None)

Utility class for working with Robot Raconteur UUIDs

Parameters:
  • node (RobotRaconteur.RobotRaconteurNode) – (optional) The Robot Raconteur node to use for parsing. Defaults to RobotRaconteurNode.s

  • client_obj (RobotRaconteur.ClientObject) – (optional) The client object to use for finding types. Defaults to None

NewRandomUuid()

Create a new random Robot Raconteur UUID

Returns:

The new UUID

Return type:

com.robotraconteur.uuid.UUID

ParseUuid(uuid_str)

Parse a UUID string into a Robot Raconteur UUID

Parameters:

uuid_str (str) – The UUID string to parse

UuidFromPyUuid(py_uuid)

Create a Robot Raconteur UUID from a Python UUID

Parameters:

py_uuid (uuid.UUID) – The Python UUID to convert

Returns:

The Robot Raconteur UUID

Return type:

com.robotraconteur.uuid.UUID

UuidToPyUuid(uuid)

Create a Python UUID from a Robot Raconteur UUID

Parameters:

uuid (com.robotraconteur.uuid.UUID) – The Robot Raconteur UUID to convert

Returns:

The Python UUID

Return type:

uuid.UUID

UuidToString(uuid)

Convert a Robot Raconteur UUID to a string

Parameters:

uuid (com.robotraconteur.uuid.UUID) – The Robot Raconteur UUID to convert

Returns:

The UUID string

Return type:

str