示例#1
0
        private void RosbridgeMessageReceivedHandler(object sender, RosbridgeMessageReceivedEventArgs args)
        {
            if (args != null)
            {
                RosMessageReceivedEventArgs rosMessageReceivedEventArgs = this.HandleRosbridgeMessage(args.RosbridgeMessage);

                if (rosMessageReceivedEventArgs != null)
                {
                    RosMessageReceived?.Invoke(this, rosMessageReceivedEventArgs);
                }
            }
        }
        private void RosbridgeMessageReceived(object sender, RosbridgeMessageReceivedEventArgs args)
        {
            if (null != args)
            {
                RosPublishMessage receivedPublishMessage = args.RosbridgeMessage.ToObject <RosPublishMessage>();

                if (null != RosMessageReceived && null != receivedPublishMessage && !string.IsNullOrEmpty(receivedPublishMessage.Topic) && receivedPublishMessage.Topic.Equals(this.Topic))
                {
                    TRosMessage receivedRosMessage = receivedPublishMessage.Message.ToObject <TRosMessage>();

                    RosMessageReceived(this, new RosMessageReceivedEventArgs <TRosMessage>(receivedRosMessage));
                }
            }
        }