ros2_control - foxy
Loading...
Searching...
No Matches
rihs_ledger.h
1// Copyright 2026 Open Source Robotics Foundation, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef ZENBEDDED_TRANSPORT__RIHS_LEDGER_H_
16#define ZENBEDDED_TRANSPORT__RIHS_LEDGER_H_
17
18#include <stddef.h>
19#include <string.h>
20
21typedef struct
22{
23 const char * type_name;
24 const char * rihs_hash;
26
27// Hardcoded ROS 2 distro type hashes. Must match host's rmw_zenoh. Regenerate when interfaces
28// change.
29static const zenbedded_rihs_mapping_t RIHS_LEDGER[] = {
30 {"sensor_msgs::msg::dds_::JointState_",
31 "RIHS01_a13ee3a330e346c9d87b5aa18d24e11690752bd33a0350f11c5882bc9179260e"},
32 {"control_msgs::msg::dds_::JointCommand_",
33 "RIHS01_6080a1df9d28b6badffa5efb27d4ba4ae657c4f6dd2b519b178a32db12405985"},
34 {"sensor_msgs::msg::dds_::Imu_",
35 "RIHS01_7d9a00ff131080897a5ec7e26e315954b8eae3353c3f995c55faf71574000b5b"}};
36
37static inline const char * zenbedded_get_rihs_hash(const char * type_name)
38{
39 if (type_name == NULL)
40 {
41 return NULL;
42 }
43 size_t ledger_size = sizeof(RIHS_LEDGER) / sizeof(RIHS_LEDGER[0]);
44 for (size_t i = 0; i < ledger_size; i++)
45 {
46 if (strcmp(RIHS_LEDGER[i].type_name, type_name) == 0)
47 {
48 return RIHS_LEDGER[i].rihs_hash;
49 }
50 }
51 return NULL;
52}
53
54#endif // ZENBEDDED_TRANSPORT__RIHS_LEDGER_H_
Definition rihs_ledger.h:22