Table of Contents
The following folder contains the data model for UUri (factory, serializer, validator, etc…) as per the uProtocol URI Specifications. The data model is defined in uri.proto and included as a dependency for this project.
from uprotocol.v1.uri_pb2 import UUri
from uprotocol.uri.factory.uri_factory import UriFactory
from uprotocol.core.usubscription.v3 import usubscription_pb2
service_descriptor = usubscription_pb2.DESCRIPTOR.services_by_name["uSubscription"]
uri = UriFactory.from_proto(service_descriptor, 0)
from uprotocol.v1.uri_pb2 import UUri
uri: UUri = UUri(
authority_name = "MyDevice",
ue_id = "0x1234",
ue_version_major = "1",
resource_id = "0x5010"
)
serialized_uri : str = UriSerializer.serialize(uri);
deserialized_uri : UUri = UriSerializer.deserialize(serialized_uri);
self.assertEqual(uri, deserialized_uri)