Beispiel #1
0
 internal override void AddServiceClientLink(IServiceClientLink iServiceClientLink)
 {
     lock (gate)
     {
         clientLinks.Add(iServiceClientLink);
     }
 }
Beispiel #2
0
 internal override void RemoveServiceClientLink(IServiceClientLink iServiceClientLink)
 {
     lock (gate)
     {
         clientLinks.Remove(iServiceClientLink);
     }
 }
Beispiel #3
0
        public override void processRequest(ref byte[] buf, int num_bytes, IServiceClientLink link)
        {
            var cb = new ServiceCallback(this, helper, buf, num_bytes, link, has_tracked_object, tracked_object);

            this.callbackId = cb.Uid;
            callback.AddCallback(cb);
        }
Beispiel #4
0
        public override Task <(RosMessage, bool)> ProcessRequest(byte[] buf, IServiceClientLink link)
        {
            var cb = new ServiceCallback(this, helper, buf, link);

            callback.AddCallback(cb, gate);
            return(cb.ResultTask);
        }
Beispiel #5
0
        private async Task StartReadHeader(Connection connection)
        {
            try
            {
                var headerFields = await connection.ReadHeader(cancel);

                if (headerFields.ContainsKey("topic"))
                {
                    TransportSubscriberLink subscriberLink = new TransportSubscriberLink();
                    subscriberLink.Initialize(connection, new Header(headerFields));
                }
                else if (headerFields.ContainsKey("service"))
                {
                    IServiceClientLink serviceClientLink = new IServiceClientLink();
                    serviceClientLink.Initialize(connection, new Header(headerFields));
                }
                else
                {
                    throw new RosException("Received a connection for a type other than topic or service.");
                }
            }
            catch (Exception e)
            {
                logger.LogWarning(e, e.Message);
                connection.Dispose();
            }
        }
Beispiel #6
0
 public ServiceCallback(ServicePublication <MReq, MRes> sp, ServiceCallbackHelper <MReq, MRes> _helper, byte[] buf, int num_bytes, IServiceClientLink link, bool has_tracked_object, object tracked_object)
 {
     this.isp = sp;
     if (this.isp != null && _helper != null)
     {
         this.isp.helper = _helper;
     }
     this.buffer            = buf;
     this._numBytes         = num_bytes;
     this.link              = link;
     this._hasTrackedObject = has_tracked_object;
     this._trackedObject    = tracked_object;
 }
Beispiel #7
0
        public bool OnConnectionHeaderReceived(Connection conn, Header header)
        {
            bool ret = false;

            if (header.Values.ContainsKey("topic"))
            {
                TransportSubscriberLink sub_link = new TransportSubscriberLink();
                ret  = sub_link.Initialize(conn);
                ret &= sub_link.HandleHeader(header);
            }
            else if (header.Values.ContainsKey("service"))
            {
                IServiceClientLink iscl = new IServiceClientLink();
                ret  = iscl.initialize(conn);
                ret &= iscl.handleHeader(header);
            }
            else
            {
                ROS.Warn()($"[{ThisNode.Name}] Got a connection for a type other than topic or service from [{conn.RemoteString}].");
                return(false);
            }
            //ROS.Debug()( $"[{ThisNode.Name}] CONNECTED [{val}]. WIN." );
            return(ret);
        }
Beispiel #8
0
 public ServiceCallback(ServicePublication <MReq, MRes> sp, ServiceCallbackHelper <MReq, MRes> _helper, byte[] buf, IServiceClientLink link)
 {
     this.isp = sp;
     if (this.isp != null && _helper != null)
     {
         this.isp.helper = _helper;
     }
     this.buffer = buf;
     this.link   = link;
 }
Beispiel #9
0
 public ServiceCallback(ServiceCallbackHelper <MReq, MRes> _helper, byte[] buf, IServiceClientLink link)
     : this(null, _helper, buf, link)
 {
 }
Beispiel #10
0
 public ServiceCallback(ServiceCallbackHelper <MReq, MRes> _helper, byte[] buf, int num_bytes, IServiceClientLink link, bool has_tracked_object, object tracked_object)
     : this(null, _helper, buf, num_bytes, link, has_tracked_object, tracked_object)
 {
 }
Beispiel #11
0
 internal override void removeServiceClientLink(IServiceClientLink iServiceClientLink)
 {
     lock (client_links_mutex)
         client_links.Remove(iServiceClientLink);
 }
Beispiel #12
0
 internal override void addServiceClientLink(IServiceClientLink iServiceClientLink)
 {
     lock (client_links_mutex)
         client_links.Add(iServiceClientLink);
 }
Beispiel #13
0
 public abstract void processRequest(ref byte[] buffer, int size, IServiceClientLink iServiceClientLink);
Beispiel #14
0
 internal abstract void removeServiceClientLink(IServiceClientLink iServiceClientLink);
Beispiel #15
0
 internal abstract void addServiceClientLink(IServiceClientLink iServiceClientLink);