예제 #1
0
        public static void SubscriberCallback(IAsyncResult ar)
        {
            SubscriberDelegate del = (SubscriberDelegate)((AsyncResult)ar).AsyncDelegate;

            del.EndInvoke(ar);
            return;
        }
예제 #2
0
 /// <summary>
 /// This function must be called before displaying the form.
 /// </summary>
 /// <param name="receiver">a ReceiverDelegate for handling output from the AllJoynBusConnection</param>
 /// <param name="subscribe">a SubscriberDelegate that will handle adding "joiners" to the session"</param>
 /// <returns></returns>
 public bool InstallDelegates(ReceiverDelegate receiver, SubscriberDelegate subscribe)
 {
     if (_ajBus != null) {
     _ajBus.SetOutputStream(receiver);
     _ajBus.SetLocalListener(subscribe);
     return true;
     }
     // else do notning
     return false;
 }
예제 #3
0
 /// <summary>
 /// This function must be called before displaying the form.
 /// </summary>
 /// <param name="receiver">a ReceiverDelegate for handling output from the AllJoynBusConnection</param>
 /// <param name="subscribe">a SubscriberDelegate that will handle adding "joiners" to the session"</param>
 /// <returns></returns>
 public bool InstallDelegates(ReceiverDelegate receiver, SubscriberDelegate subscribe)
 {
     if (_ajBus != null)
     {
         _ajBus.SetOutputStream(receiver);
         _ajBus.SetLocalListener(subscribe);
         return(true);
     }
     // else do notning
     return(false);
 }
예제 #4
0
 private void CleanupSubscriber()
 {
     if (_subscriber != null)
     {
         _subscriber.View.RemoveFromSuperview();
         _subscriber.Delegate = null;
         _subscriber.Dispose();
         _subscriber         = null;
         _subscriberDelegate = null;
     }
 }
예제 #5
0
 private void setCallbacks()
 {
     if (!_callbacksInstalled) {
     _receiveDelegate = new ReceiverDelegate(receiveOutput);
     _joinDelegate = new SubscriberDelegate(sessionSubscriber);
     GC.KeepAlive(_receiveDelegate);
     GC.KeepAlive(_joinDelegate);
     _connectForm.InstallDelegates(_receiveDelegate, _joinDelegate);
     _callbacksInstalled = true;
     }
 }
예제 #6
0
        //      private bool _callbacksInstalled = false;

        private void setCallbacks()
        {
            _receiveDelegate = new ReceiverDelegate(receiveOutput);
            _joinDelegate    = new SubscriberDelegate(sessionSubscriber);
            _queryDelegate   = new IncomingQueryDelegate(incomingQuery);
            _xferDelegate    = new IncomingXferDelegate(xferHandler);
            GC.KeepAlive(_queryDelegate);
            GC.KeepAlive(_xferDelegate);
            GC.KeepAlive(_receiveDelegate);
            GC.KeepAlive(_joinDelegate);
        }
예제 #7
0
        public static void Unsubscribe(string topic)
        {
            Console.WriteLine("Unsubscribing from: " + topic);

            //broker.Unsubscribe( name, topic );
            //SubscriberDelegate del = new SubscriberDelegate( broker.Unsubscribe );
            SubscriberDelegate del            = new SubscriberDelegate(brokerCircle.Unsubscribe);
            AsyncCallback      remoteCallback = new AsyncCallback(SubscriberCallback);
            IAsyncResult       remAr          = del.BeginInvoke(name, topic, remoteCallback, null);

            Subscriber.topics.Remove(topic);
        }
예제 #8
0
 private void setCallbacks()
 {
     if (!_callbacksInstalled)
     {
         _receiveDelegate = new ReceiverDelegate(receiveOutput);
         _joinDelegate    = new SubscriberDelegate(sessionSubscriber);
         GC.KeepAlive(_receiveDelegate);
         GC.KeepAlive(_joinDelegate);
         _connectForm.InstallDelegates(_receiveDelegate, _joinDelegate);
         _callbacksInstalled = true;
     }
 }
예제 #9
0
 private bool setCallbacks()
 {
     if (!_callbacksInstalled)
     {
         _receiveDelegate = new ReceiverDelegate(receive);
         _joinDelegate    = new SubscriberDelegate(subscribe);
         GC.KeepAlive(_receiveDelegate);
         GC.KeepAlive(_joinDelegate);
         _alljoyn.RemoteStream(_receiveDelegate);
         _alljoyn.RemoteListener(_joinDelegate);
     }
     return(true);
 }
예제 #10
0
        private void DoSubscribe(OTStream stream)
        {
            _subscriberDelegate = new SubscriberDelegate(this);
            _subscriber         = new OTSubscriber(stream, _subscriberDelegate);

            OTError error;

            _session.Subscribe(_subscriber, out error);

            if (error != null)
            {
                this.RaiseOnError(error.Description);
            }
        }
예제 #11
0
        public static void Subscribe(string topic)
        {
            // Console.WriteLine( "Subscribing to: " + topic );

            //broker.Subscribe( name, topic );

            // No replication
            //SubscriberDelegate del = new SubscriberDelegate( broker.Subscribe );

            // Replication
            SubscriberDelegate del = new SubscriberDelegate(brokerCircle.Subscribe);

            AsyncCallback remoteCallback = new AsyncCallback(SubscriberCallback);
            IAsyncResult  remAr          = del.BeginInvoke(name, topic, remoteCallback, null);

            Subscriber.topics.Add(topic);
        }
예제 #12
0
 public void SetLocalListener(SubscriberDelegate callback)
 {
     SetJoinListener(callback);
 }
예제 #13
0
 public void Unsubscribe(SubscriberDelegate subscriber)
 {
     _mutex.EnterWriteLock();
     _subscribers.Remove(subscriber);
     _mutex.ExitWriteLock();
 }
예제 #14
0
 public void Subscribe(SubscriberDelegate subscriber)
 {
     _mutex.EnterWriteLock();
     _subscribers.Add(subscriber);
     _mutex.ExitWriteLock();
 }
예제 #15
0
 private bool setCallbacks()
 {
     if (!_callbacksInstalled) {
     _receiveDelegate = new ReceiverDelegate(receive);
     _joinDelegate = new SubscriberDelegate(subscribe);
     GC.KeepAlive(_receiveDelegate);
     GC.KeepAlive(_joinDelegate);
     _alljoyn.RemoteStream(_receiveDelegate);
     _alljoyn.RemoteListener(_joinDelegate);
     }
     return true;
 }
예제 #16
0
 public static extern void SetListener([MarshalAs(UnmanagedType.FunctionPtr)] SubscriberDelegate callBack);
예제 #17
0
 internal void RemoteListener(SubscriberDelegate callback)
 {
     SetListener(callback);
 }
예제 #18
0
        public static void Subscribe( string topic )
        {
            // Console.WriteLine( "Subscribing to: " + topic );

            //broker.Subscribe( name, topic );

            // No replication
            //SubscriberDelegate del = new SubscriberDelegate( broker.Subscribe );

            // Replication
            SubscriberDelegate del = new SubscriberDelegate( brokerCircle.Subscribe );

            AsyncCallback remoteCallback = new AsyncCallback( SubscriberCallback );
            IAsyncResult remAr = del.BeginInvoke( name, topic, remoteCallback, null );

            Subscriber.topics.Add(topic);
        }
예제 #19
0
 public void SetLocalListener(SubscriberDelegate callback)
 {
     SetJoinListener(callback);
 }
예제 #20
0
 public void SetSubscriberMethod(SubscriberDelegate method)
 {
     _subMethod = method;
 }
예제 #21
0
        public static void Unsubscribe( string topic )
        {
            Console.WriteLine( "Unsubscribing from: " + topic );

            //broker.Unsubscribe( name, topic );
            //SubscriberDelegate del = new SubscriberDelegate( broker.Unsubscribe );
            SubscriberDelegate del = new SubscriberDelegate( brokerCircle.Unsubscribe );
            AsyncCallback remoteCallback = new AsyncCallback( SubscriberCallback );
            IAsyncResult remAr = del.BeginInvoke( name, topic, remoteCallback, null );

            Subscriber.topics.Remove(topic);
        }
예제 #22
0
 private void CleanupSubscriber()
 {
     if (_subscriber != null)
     {
         _subscriber.View.RemoveFromSuperview();
         _subscriber.Delegate = null;
         _subscriber.Dispose();
         _subscriber = null;
         _subscriberDelegate = null;
     }
 }
예제 #23
0
        private void DoSubscribe(OTStream stream)
        {
            _subscriberDelegate = new SubscriberDelegate (this);
            _subscriber = new OTSubscriber(stream, _subscriberDelegate);

            OTError error;

            _session.Subscribe(_subscriber, out error);

            if (error != null)
            {
                this.RaiseOnError(error.Description);
            }
        }
예제 #24
0
 //      private bool _callbacksInstalled = false;
 private void setCallbacks()
 {
     _receiveDelegate = new ReceiverDelegate(receiveOutput);
     _joinDelegate = new SubscriberDelegate(sessionSubscriber);
     _queryDelegate = new IncomingQueryDelegate(incomingQuery);
     _xferDelegate = new IncomingXferDelegate(xferHandler);
     GC.KeepAlive(_queryDelegate);
     GC.KeepAlive(_xferDelegate);
     GC.KeepAlive(_receiveDelegate);
     GC.KeepAlive(_joinDelegate);
 }
예제 #25
0
 internal void RemoteListener(SubscriberDelegate callback)
 {
     SetListener(callback);
 }