public void initialize <MReq, MRes>() where MReq : IRosMessage, new() where MRes : IRosMessage, new() { MReq req = new MReq(); MRes res = new MRes(); RequestMd5Sum = req.MD5Sum(); ResponseMd5Sum = res.MD5Sum(); RequestType = req.msgtype(); ResponseType = res.msgtype(); }
public void Initialize <MReq, MRes>() where MReq : RosMessage, new() where MRes : RosMessage, new() { MReq req = new MReq(); MRes res = new MRes(); RequestMd5Sum = req.MD5Sum(); ResponseMd5Sum = res.MD5Sum(); RequestType = req.MessageType; ResponseType = res.MessageType; this.connectionTask = HandleConnection(); }
internal override CallResult Call() { if (link.connection.dropped) { return(CallResult.Invalid); } ServiceCallbackHelperParams <MReq, MRes> parms = new ServiceCallbackHelperParams <MReq, MRes> { request = new MReq().Deserialize(buffer) as MReq, response = new MRes(), connection_header = link.connection.header.Values }; try { bool ok = isp.helper.call(parms); if (ok) { link.processResponse(parms.response, true); } else { IRosMessage res = new MRes(); link.processResponse(res, false); } } catch (Exception e) { string woops = "Exception thrown while processing service call: " + e; ROS.Error(woops); link.processResponse(woops, false); return(CallResult.Invalid); } return(CallResult.Success); }