public SubscriberCallbacks(SubscriberStatusCallback connectCB, SubscriberStatusCallback disconnectCB,
     CallbackQueueInterface Callback)
 {
     connect = connectCB;
     disconnect = disconnectCB;
     this.Callback = Callback;
 }
Example #2
0
        public AdvertiseOptions(
            string topic,
            int queueSize,
            string md5Sum,
            string dataType,
            string messageDefinition,
            SubscriberStatusCallback connectcallback    = null,
            SubscriberStatusCallback disconnectcallback = null,
            ICallbackQueue callbackQueue = null
            )
        {
            this.topic         = topic;
            this.md5Sum        = md5Sum;
            this.queueSize     = queueSize;
            this.callbackQueue = callbackQueue;

            T tt = new T();

            this.dataType          = dataType.Length > 0 ? dataType : tt.MessageType;
            this.messageDefinition = string.IsNullOrEmpty(messageDefinition) ? tt.MessageDefinition() : messageDefinition;
            this.hasHeader         = tt.HasHeader();

            this.connectCB    = connectcallback;
            this.disconnectCB = disconnectcallback;
        }
Example #3
0
        public AdvertiseOptions(string t, int q_size, string md5, string dt, string message_def,
                                SubscriberStatusCallback connectcallback,
                                SubscriberStatusCallback disconnectcallback)
        {
            topic      = t;
            queue_size = q_size;
            md5sum     = md5;
            T tt = new T();

            if (dt.Length > 0)
            {
                datatype = dt;
            }
            else
            {
                datatype = tt.msgtype.ToString().Replace("__", "/");
            }
            if (message_def.Length == 0)
            {
                message_definition = tt.MessageDefinition;
            }
            else
            {
                message_definition = message_def;
            }
            has_header   = tt.HasHeader;
            connectCB    = connectcallback;
            disconnectCB = disconnectcallback;
        }
 public SubscriberCallbacks(SubscriberStatusCallback connectCB, SubscriberStatusCallback disconnectCB,
                            CallbackQueueInterface Callback)
 {
     connect       = connectCB;
     disconnect    = disconnectCB;
     this.Callback = Callback;
 }
Example #5
0
 /// <summary>
 ///     Creates a publisher with connect and disconnect callbacks, specify latching.
 /// </summary>
 /// <typeparam name="M">Type of topic</typeparam>
 /// <param name="topic">Name of topic</param>
 /// <param name="queue_size">How many messages to enqueue if asynchrinous</param>
 /// <param name="connectcallback">Callback to fire when this node connects</param>
 /// <param name="disconnectcallback">Callback to fire when this node disconnects</param>
 /// <param name="l">Boolean determines whether the given publisher will latch or not</param>
 /// <returns>A publisher with the specified topic type, name and options</returns>
 public Publisher <M> advertise <M>(string topic, int queue_size, SubscriberStatusCallback connectcallback,
                                    SubscriberStatusCallback disconnectcallback, bool l)
     where M : IRosMessage, new()
 {
     return(advertise(new AdvertiseOptions <M>(topic, queue_size, connectcallback, disconnectcallback)
     {
         latch = l
     }));
 }
Example #6
0
        Publisher <M> queue_advertise <M> (string topic, uint queue_size, SubscriberStatusCallback connect_cb, SubscriberStatusCallback disconnect_cb, CallbackQueueInterface queue) where M : IRosMessage, new()
        {
            AdvertiseOptions <M> ops = new AdvertiseOptions <M> (topic, (int)queue_size, connect_cb, disconnect_cb);

//			ops.tracked_object = ros::VoidPtr();
            ops.latch          = false;
            ops.callback_queue = queue;
            return(nodeHandle.advertise(ops));
        }
Example #7
0
 public static AdvertiseOptions <M> Create <M>(string topic, int q_size, SubscriberStatusCallback connectcallback,
                                               SubscriberStatusCallback disconnectcallback, CallbackQueue queue)
     where M : IRosMessage, new()
 {
     return(new AdvertiseOptions <M>(topic, q_size, connectcallback, disconnectcallback)
     {
         callback_queue = queue
     });
 }
Example #8
0
 public AdvertiseOptions(string t, int q_size, SubscriberStatusCallback connectcallback,
                         SubscriberStatusCallback disconnectcallback) :
     this(
         t, q_size, new T().MD5Sum,
         new T().msgtype.ToString().Replace("__", "/"),
         new T().MessageDefinition,
         connectcallback, disconnectcallback)
 {
 }
Example #9
0
 public SubscriberCallbacks(
     SubscriberStatusCallback connectCB,
     SubscriberStatusCallback disconnectCB,
     ICallbackQueue callbackQueue
     )
 {
     this.connect       = connectCB;
     this.disconnect    = disconnectCB;
     this.CallbackQueue = callbackQueue;
 }
Example #10
0
 public SubscriberCallbacks(
     SubscriberStatusCallback onConnect,
     SubscriberStatusCallback onDisconnect,
     ICallbackQueue callbackQueue
     )
 {
     this.OnConnect     = onConnect;
     this.OnDisconnect  = onDisconnect;
     this.CallbackQueue = callbackQueue;
 }
 /// <summary>
 ///     Creates a publisher with connect and disconnect callbacks
 /// </summary>
 /// <typeparam name="M">Type of topic</typeparam>
 /// <param name="topic">Name of topic</param>
 /// <param name="queue_size">How many messages to enqueue if asynchrinous</param>
 /// <param name="connectcallback">Callback to fire when this node connects</param>
 /// <param name="disconnectcallback">Callback to fire when this node disconnects</param>
 /// <returns>A publisher with the specified topic type, name and options</returns>
 public Publisher <M> advertise <M>(string topic, int queue_size, SubscriberStatusCallback connectcallback,
                                    SubscriberStatusCallback disconnectcallback)
     where M : IRosMessage, new()
 {
     if (started_by_visual_studio)
     {
         return(null);
     }
     return(advertise <M>(topic, queue_size, connectcallback, disconnectcallback, false));
 }
Example #12
0
        public AdvertiseOptions(string t, int q_size, string md5, string dt, string message_def,
                                SubscriberStatusCallback connectcallback,
                                SubscriberStatusCallback disconnectcallback)
        {
            topic      = t;
            queue_size = q_size;
            md5sum     = md5;
            T tt = new T();

            if (dt.Length > 0)
            {
                datatype = dt;
            }
            else
            {
                datatype = tt.msgtype.ToString().Replace("__", "/");
            }
            if (message_def.Length == 0)
            {
                message_definition = tt.MessageDefinition;
            }
            else
            {
                message_definition = message_def;
            }
            List <Type>         visited  = new List <Type>();
            Queue <IRosMessage> frontier = new Queue <IRosMessage>();
            IRosMessage         current  = tt;

            do
            {
                if (frontier.Count > 0)
                {
                    current             = frontier.Dequeue();
                    message_definition += "\n================================================================================\nMSG: " + current.msgtype.ToString().Replace("__", "/") + "\n" + current.MessageDefinition;
                }
                foreach (MsgFieldInfo fi in current.Fields.Values)
                {
                    if (fi.message_type == MsgTypes.Unknown)
                    {
                        continue;
                    }
                    IRosMessage field = IRosMessage.generate(fi.message_type);
                    if (field != null && fi.IsMetaType && !visited.Contains(fi.Type))
                    {
                        frontier.Enqueue(field);
                        visited.Add(fi.Type);
                    }
                }
            } while (frontier.Count > 0);
            has_header   = tt.HasHeader;
            connectCB    = connectcallback;
            disconnectCB = disconnectcallback;
        }
Example #13
0
 public static AdvertiseOptions <M> Create <M>(
     string topic,
     int queueSize,
     SubscriberStatusCallback connectcallback,
     SubscriberStatusCallback disconnectcallback,
     ICallbackQueue callbackQueue
     )
     where M : RosMessage, new()
 {
     return(new AdvertiseOptions <M>(topic, queueSize, connectcallback, disconnectcallback, callbackQueue));
 }
Example #14
0
 public AdvertiseOptions(
     string topic,
     int queueSize,
     SubscriberStatusCallback connectCallback,
     SubscriberStatusCallback disconnectCallback,
     ICallbackQueue callbackQueue = null
     )
     : this(
         topic,
         queueSize,
         new T().MD5Sum(),
         new T().MessageType,
         new T().MessageDefinition(),
         connectCallback,
         disconnectCallback
         )
 {
 }
Example #15
0
 public PeerConnDisconnCallback(SubscriberStatusCallback callback, SubscriberLink sub_link)
 {
     this.callback = callback;
     this.sub_link = sub_link;
 }
Example #16
0
 public Publisher <M> Advertise <M>(string topic, int queueSize, SubscriberStatusCallback connectCallback,
                                    SubscriberStatusCallback disconnectCallback, bool latch) where M : RosMessage, new() =>
 AdvertiseAsync <M>(topic, queueSize, connectCallback, disconnectCallback, latch).Result;
Example #17
0
 public PeerConnDisconnCallback(SubscriberStatusCallback callback, SubscriberLink subscriberLink)
 {
     this.callback       = callback;
     this.subscriberLink = subscriberLink;
 }
Example #18
0
 /// <summary>
 ///     Creates a publisher with connect and disconnect callbacks, specify latching.
 /// </summary>
 /// <typeparam name="M">Type of topic</typeparam>
 /// <param name="topic">Name of topic</param>
 /// <param name="queueSize">How many messages to enqueue if asynchrinous</param>
 /// <param name="connectCallback">Callback to fire when this node connects</param>
 /// <param name="disconnectCallback">Callback to fire when this node disconnects</param>
 /// <param name="latch">Boolean determines whether the given publisher will latch or not</param>
 /// <returns>A publisher with the specified topic type, name and options</returns>
 public async Task <Publisher <M> > AdvertiseAsync <M>(string topic, int queueSize, SubscriberStatusCallback connectCallback,
                                                       SubscriberStatusCallback disconnectCallback, bool latch)
     where M : RosMessage, new()
 {
     return(await AdvertiseAsync(new AdvertiseOptions <M>(topic, queueSize, connectCallback, disconnectCallback) { Latch = latch }));
 }
Example #19
0
 /// <summary>
 ///     Creates a publisher with connect and disconnect callbacks
 /// </summary>
 /// <typeparam name="M">Type of topic</typeparam>
 /// <param name="topic">Name of topic</param>
 /// <param name="queueSize">How many messages to enqueue if asynchrinous</param>
 /// <param name="connectCallback">Callback to fire when this node connects</param>
 /// <param name="disconnectCallback">Callback to fire when this node disconnects</param>
 /// <returns>A publisher with the specified topic type, name and options</returns>
 public async Task <Publisher <M> > AdvertiseAsync <M>(string topic, int queueSize, SubscriberStatusCallback connectCallback,
                                                       SubscriberStatusCallback disconnectCallback)
     where M : RosMessage, new()
 {
     return(await AdvertiseAsync <M>(topic, queueSize, connectCallback, disconnectCallback, false));
 }
Example #20
0
 public AdvertiseOptions(string t, int q_size, string md5, string dt, string message_def,
                         SubscriberStatusCallback connectcallback)
     : this(t, q_size, md5, dt, message_def, connectcallback, null)
 {
 }
Example #21
0
 /// <summary>
 ///     Creates a publisher with connect and disconnect callbacks
 /// </summary>
 /// <typeparam name="M">Type of topic</typeparam>
 /// <param name="topic">Name of topic</param>
 /// <param name="queueSize">How many messages to enqueue if asynchrinous</param>
 /// <param name="connectCallback">Callback to fire when this node connects</param>
 /// <param name="disconnectCallback">Callback to fire when this node disconnects</param>
 /// <returns>A publisher with the specified topic type, name and options</returns>
 public Publisher <M> advertise <M>(string topic, int queueSize, SubscriberStatusCallback connectCallback,
                                    SubscriberStatusCallback disconnectCallback)
     where M : RosMessage, new()
 {
     return(advertise <M>(topic, queueSize, connectCallback, disconnectCallback, false));
 }