Table of Contents
The following folder contains everything but the data model for UUri (builders, serializers, validators, etc…) per uProtocol URI Specifications. The data model is defined in uri.proto and included as a dependency for this project.
Important
|
For more details about the data model, various formats (object, long, micro) and their uses, please refer to uProtocol URI Specifications. |
When building UUri, you can choose to populate it with only names, only numbers, or both (resolved). When you should use each is described the best practice section of uProtocol URI Specifications.
uri: UUri = UUri(
authority=UAuthority(name="MyDevice", ip=bytes(socket.inet_pton(socket.AF_INET, "192.168.1.100")),
id=bytes.fromhex("3GTU2NEC8HG403825")),
entity=UEntity(name="HartleyService", id=10203, version_major=1),
resource=UResourceBuilder.for_rpc_request("Raise", 10))
status : ValidationResult = UriValidator.validate_rpc_method(uuri)
assertTrue(status.is_success());
uri = .../* UUri example above */
micro = MicroUriSerializer().serialize(uri)
long = LongUriSerializer().serialize(uri)
deserialized_micro_uuri = MicroUriSerializer().deserialize(uri)
deserialized_long_uuri = LongUriSerializer().deserialize(uri)
uri2 = UriSerializer.build_resolved(long, micro)