Esempio n. 1
0
        public IPublisher <T> CreatePublisher <T> (string topic, QosProfile.Profile profile_id) where T : IMessage
        {
            MethodInfo m = typeof(T).GetTypeInfo().GetDeclaredMethod("_GET_TYPE_SUPPORT");

            IntPtr        typesupport     = (IntPtr)m.Invoke(null, new object[] { });
            IntPtr        publisherHandle = IntPtr.Zero;
            RCLRet        ret             = (RCLRet)NodeDelegates.native_rcl_create_publisher_handle(ref publisherHandle, Handle, topic, typesupport, profile_id);
            Publisher <T> publisher       = new Publisher <T> (publisherHandle);

            return(publisher);
        }
Esempio n. 2
0
        public ISubscription <T> CreateSubscription <T> (string topic, Action <T> callback, QosProfile.Profile profile_id) where T : IMessage, new ()
        {
            MethodInfo m = typeof(T).GetTypeInfo().GetDeclaredMethod("_GET_TYPE_SUPPORT");

            IntPtr           typesupport        = (IntPtr)m.Invoke(null, new object[] { });
            IntPtr           subscriptionHandle = IntPtr.Zero;
            RCLRet           ret          = (RCLRet)NodeDelegates.native_rcl_create_subscription_handle(ref subscriptionHandle, Handle, topic, typesupport, profile_id);
            Subscription <T> subscription = new Subscription <T> (subscriptionHandle, callback);

            this.subscriptions_.Add(subscription);
            return(subscription);
        }