Example #1
0
        public override T TakeResponse <T>(ref bool success)
        {
            success = false;
            rmw_request_id_t request_header = new rmw_request_id_t();
            T         response = new T();
            ValueType msg;

            response.GetData(out msg);
            int             ret    = rcl_take_response(ref native_handle, ref request_header, msg);
            RCLReturnValues retVal = (RCLReturnValues)ret;

            switch (retVal)
            {
            case RCLReturnValues.RCL_RET_OK:
                success = true;
                response.SetData(ref msg);
                break;

            case RCLReturnValues.RCL_RET_INVALID_ARGUMENT:
                throw new RCLInvalidArgumentException();

            case RCLReturnValues.RCL_RET_CLIENT_INVALID:
                throw new RCLClientInvalidException();

            case RCLReturnValues.RCL_RET_ERROR:
                success = false;
                break;

            default:
                break;
            }
            return(response);
        }
Example #2
0
        public T TakeRequest <T> (ref bool success)
            where T : MessageWrapper, new()
        {
            success             = false;
            last_request_header = new rmw_request_id_t();
            T         request = new T();
            ValueType msg;

            request.GetData(out msg);
            int             ret    = rcl_take_request(ref native_handle, ref last_request_header, msg);
            RCLReturnValues retVal = (RCLReturnValues)ret;

            switch (retVal)
            {
            case RCLReturnValues.RCL_RET_OK:
                success = true;
                request.SetData(ref msg);
                break;

            case RCLReturnValues.RCL_RET_INVALID_ARGUMENT:
                //throw new RCLInvalidArgumentException();
                break;

            case RCLReturnValues.RCL_RET_SERVICE_INVALID:
                throw new RCLServiceInvalidException();
                break;

            case RCLReturnValues.RCL_RET_BAD_ALLOC:
                throw new RCLBadAllocException();
                break;

            case RCLReturnValues.RCL_RET_ERROR:
                success = false;
                break;

            default:
                break;
            }
            return(request);
        }
Example #3
0
 extern static int rcl_send_response(ref rcl_service_t service, ref rmw_request_id_t request_header, [In, Out] ValueType ros_response);
Example #4
0
 extern static int rcl_take_request(ref rcl_service_t service, ref rmw_request_id_t request_header, [In, Out] ValueType ros_request);
Example #5
0
 extern static int rcl_take_response(ref rcl_client_t client, ref rmw_request_id_t request_header, [In, Out] ValueType ros_response);