Example #1
0
            internal override CallResult Call()
            {
                if (link.connection.dropped)
                {
                    return(CallResult.Invalid);
                }

                ServiceCallbackHelperParams <MReq, MRes> parms = new ServiceCallbackHelperParams <MReq, MRes>
                {
                    request           = new MReq(),
                    response          = new MRes(),
                    connection_header = link.connection.header.Values
                };

                parms.request.Deserialize(buffer);

                try
                {
                    bool ok = isp.helper.call(parms);
                    link.processResponse(parms.response, ok);
                }
                catch (Exception e)
                {
                    string str = $"[{ThisNode.Name}] Exception thrown while processing service call: {e}";
                    ROS.Error()(str);
                    link.processResponse(str, false);
                    return(CallResult.Invalid);
                }
                return(CallResult.Success);
            }
Example #2
0
        internal bool Call(ServiceCallbackHelperParams <MReq, MRes> parms)
        {
            MRes response = parms.Response;
            bool result   = callback.Invoke(parms.Request, ref response);

            parms.Response = response;
            return(result);
        }
        public virtual MReq deserialize <MReq, MRes>(ServiceCallbackHelperParams <MReq, MRes> parms) where MReq : RosMessage where MRes : RosMessage
        {
            RosMessage msg = RosMessage.Generate(type);

            msg.connection_header = new Dictionary <string, string>(parms.connection_header);
            MReq t = (MReq)msg;

            t.Deserialize(parms.response.Serialized);
            return(t);
        }
 internal bool call(ServiceCallbackHelperParams <MReq, MRes> parms)
 {
     return(_callback.Invoke(parms.request, ref parms.response));
 }