Skip to content

Commit e898139

Browse files
committed
add ue_type and ue_instance
1 parent 5ee6cd6 commit e898139

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

up_transport_zenoh/zenohutils.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ class ZenohUtils:
4545
def uri_to_zenoh_key(authority_name: str, uri: UUri) -> str:
4646
authority = authority_name if not uri.authority_name else uri.authority_name
4747
ue_id = "*" if uri.ue_id == UriFactory.WILDCARD_ENTITY_ID else f"{uri.ue_id:X}"
48+
if ue_id == "*":
49+
ue_type = "*"
50+
ue_instance = "*"
51+
else:
52+
ue_id = int(ue_id)
53+
ue_type = (ue_id >> 16) & 0xFFFF # Get upper 16 bits
54+
ue_instance = ue_id & 0xFFFF # Get lower 16 bits
4855
ue_version_major = (
4956
"*" if uri.ue_version_major == UriFactory.WILDCARD_ENTITY_VERSION else f"{uri.ue_version_major:X}"
5057
)
5158
resource_id = "*" if uri.resource_id == UriFactory.WILDCARD_RESOURCE_ID else f"{uri.resource_id:X}"
52-
if ue_id == "*":
53-
upper_16 = "*"
54-
lower_16 = "*"
55-
else:
56-
ue_id = int(ue_id) # Convert string to integer
57-
upper_16 = (ue_id >> 16) & 0xFFFF # Get upper 16 bits
58-
lower_16 = ue_id & 0xFFFF # Get lower 16 bits
59-
return f"{authority}/{upper_16}/{lower_16}/{ue_version_major}/{resource_id}"
59+
return f"{authority}/{ue_type}/{ue_instance}/{ue_version_major}/{resource_id}"
6060

6161
@staticmethod
6262
def get_uauth_from_uuri(uri: UUri) -> Union[str, UStatus]:

0 commit comments

Comments
 (0)