public rcl_client_base(rcl_node_t _node, rosidl_service_type_support_t _typesupport, string _service_name, rcl_client_options_t _options) { this.native_node = _node; this.service_name = _service_name; this.options = _options; this.typesupport = _typesupport; }
public rcl_client(rcl_node_t _node, rosidl_service_type_support_t _typesupport, string _service_name, rcl_client_options_t _options) { this.native_node = _node; this.service_name = _service_name; this.options = _options; this.typesupport = _typesupport; native_handle = rcl_get_zero_initialized_client(); rcl_client_init(ref native_handle, ref native_node, ref typesupport, service_name, ref options); }
public Client(Node _Node, string _ServiceName, rmw_qos_profile_t _QOS) { QOSProfile = _QOS; RosNode = _Node; ServiceName = _ServiceName; Type ServiceType = typeof(T); Type wrapperType = typeof(T); foreach (var item in wrapperType.GetMethods()) { if (item.IsStatic) { if (item.Name.Contains("GetMessageType")) { ServiceType = (Type)item.Invoke(null, null); } } } bool foundMethod = false; foreach (var item in ServiceType.GetMethods()) { if (item.IsStatic) { if (item.Name.Contains("rosidl_typesupport_introspection_c__get_service_type_support_handle__")) { foundMethod = true; TypeSupport = (rosidl_service_type_support_t)Marshal.PtrToStructure((IntPtr)item.Invoke(null, null), typeof(rosidl_service_type_support_t)); } } } if (!foundMethod) { throw new MissingMethodException("Could not find typesupprt method"); } if (TypeSupport.data == IntPtr.Zero) { throw new Exception("Couldn't get typesupport"); } ClientOptions = rcl_client.get_default_options(); ClientOptions.qos = QOSProfile; InternalClient = new rcl_client(RosNode.NativeNode, TypeSupport, ServiceName, ClientOptions); }
extern static int rcl_client_init(ref rcl_client_t client, ref rcl_node_t node, ref rosidl_service_type_support_t type_support, string service_name, ref rcl_client_options_t options);
public rcl_client_linux(rcl_node_t _node, rosidl_service_type_support_t _typesupport, string _service_name, rcl_client_options_t _options) : base(_node, _typesupport, _service_name, _options) { native_handle = rcl_get_zero_initialized_client(); rcl_client_init(ref native_handle, ref native_node, ref typesupport, service_name, ref options); }
public rcl_client(rcl_node_t _node, rosidl_service_type_support_t _typesupport, string _service_name, rcl_client_options_t _options) { if (Environment.OSVersion.Platform == PlatformID.Win32NT) { //TODO codepath for windows } else if (Environment.OSVersion.Platform == PlatformID.Unix) { Impl = new rcl_client_linux(_node, _typesupport, _service_name, _options); } else { throw new Exception("Operating system: " + Environment.OSVersion.Platform.ToString() + " not supported"); } }