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); }
/// <summary> /// Determines if a server to the given client is available /// </summary> /// <returns><c>true</c>, if a service to the given client is avilable, <c>false</c> otherwise.</returns> /// <param name="RosNode">Ros node.</param> /// <param name="ServiceClient">Service client.</param> /// <typeparam name="T">Request type</typeparam> /// <typeparam name="U">Response type</typeparam> public override bool ServiceServerAvailable <T, U>(Node RosNode, Client <T, U> ServiceClient) { byte available = 0; rcl_node_t native_node_handle = RosNode.NativeNode; rcl_client_t native_client_handle = ServiceClient.NativeClient; int ret = rcl_service_server_is_available(ref native_node_handle, ref native_client_handle, ref available); //TODO Evaluate return value if (available > 0) { return(true); } return(false); }
extern static IntPtr rcl_client_get_options(ref rcl_client_t client);
extern static string rcl_client_get_service_name(ref rcl_client_t client);
extern static int rcl_take_response(ref rcl_client_t client, ref rmw_request_id_t request_header, [In, Out] ValueType ros_response);
extern static int rcl_send_request(ref rcl_client_t client, [In, Out] ValueType ros_request, ref Int64 sequence_number);
extern static int rcl_client_fini(ref rcl_client_t client, ref rcl_node_t node);
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);
static extern int rcl_service_server_is_available(ref rcl_node_t node, ref rcl_client_t client, ref byte is_available);