/// <summary>
        /// Initializes a new instance of the <see cref="MyBusListener" /> class.
        /// </summary>
        /// <param name="busAtt">object responsible for connecting to and optionally managing a message
        /// bus.</param>
        /// <param name="ops">Session operations object for this application</param>
        public MyBusListener(BusAttachment busAtt, SessionOperations ops)
        {
            this.sessionOps = ops;

            // Create Bus Listener and register signal handlers 
            this.busListener = new BusListener(busAtt);
            this.busListener.BusDisconnected += new BusListenerBusDisconnectedHandler(this.BusListenerBusDisconnected);
            this.busListener.BusStopping += new BusListenerBusStoppingHandler(this.BusListenerBusStopping);
            this.busListener.FoundAdvertisedName += new BusListenerFoundAdvertisedNameHandler(this.BusListenerFoundAdvertisedName);
            this.busListener.ListenerRegistered += new BusListenerListenerRegisteredHandler(this.BusListenerListenerRegistered);
            this.busListener.ListenerUnregistered += new BusListenerListenerUnregisteredHandler(this.BusListenerListenerUnregistered);
            this.busListener.LostAdvertisedName += new BusListenerLostAdvertisedNameHandler(this.BusListenerLostAdvertisedName);
            this.busListener.NameOwnerChanged += new BusListenerNameOwnerChangedHandler(this.BusListenerNameOwnerChanged);

            // Create Session Listener and register signal handlers 
            this.sessionListener = new SessionListener(busAtt);
            this.sessionListener.SessionLost += new SessionListenerSessionLostHandler(this.SessionListenerSessionLost);
            this.sessionListener.SessionMemberAdded += new SessionListenerSessionMemberAddedHandler(this.SessionListenerSessionMemberAdded);
            this.sessionListener.SessionMemberRemoved += new SessionListenerSessionMemberRemovedHandler(this.SessionListenerSessionMemberRemoved);

            // Create Session Port Listener and register signal handlers 
            this.sessionPortListener = new SessionPortListener(busAtt);
            this.sessionPortListener.AcceptSessionJoiner += new SessionPortListenerAcceptSessionJoinerHandler(this.SessionPortListenerAcceptSessionJoiner);
            this.sessionPortListener.SessionJoined += new SessionPortListenerSessionJoinedHandler(this.SessionPortListenerSessionJoined);

            busAtt.RegisterBusListener(this.busListener);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SignalConsumerBusListener" /> class
        /// </summary>
        /// <param name="bus">object responsible for connecting to and optionally managing a message 
        /// bus</param>
        /// <param name="foundNameEvent">event to set when the well-known name being queried 
        /// is found</param>
        public SignalConsumerBusListener(BusAttachment bus, AutoResetEvent foundNameEvent)
        {
            SessionidList = new List<uint>();
            this.busAtt = bus;
            this.foundName = foundNameEvent;

            this.busListener = new BusListener(bus);
            this.busListener.BusDisconnected += new BusListenerBusDisconnectedHandler(this.BusListenerBusDisconnected);
            this.busListener.BusStopping += new BusListenerBusStoppingHandler(this.BusListenerBusStopping);
            this.busListener.FoundAdvertisedName += new BusListenerFoundAdvertisedNameHandler(this.BusListenerFoundAdvertisedName);
            this.busListener.ListenerRegistered += new BusListenerListenerRegisteredHandler(this.BusListenerListenerRegistered);
            this.busListener.ListenerUnregistered += new BusListenerListenerUnregisteredHandler(this.BusListenerListenerUnregistered);
            this.busListener.LostAdvertisedName += new BusListenerLostAdvertisedNameHandler(this.BusListenerLostAdvertisedName);
            this.busListener.NameOwnerChanged += new BusListenerNameOwnerChangedHandler(this.BusListenerNameOwnerChanged);

            this.sessionListener = new SessionListener(this.busAtt);
            this.sessionListener.SessionLost += new SessionListenerSessionLostHandler(this.SessionListenerSessionLost);
            this.sessionListener.SessionMemberAdded += new SessionListenerSessionMemberAddedHandler(this.SessionListenerSessionMemberAdded);
            this.sessionListener.SessionMemberRemoved += new SessionListenerSessionMemberRemovedHandler(this.SessionListenerSessionMemberRemoved);

            MessageReceiver signalReceiver = new MessageReceiver(bus);
            signalReceiver.SignalHandler += this.NameChangedSignalHandler;
            InterfaceDescription interfaceDescription2 = bus.GetInterface(SignalConsumerGlobals.InterfaceName);
            InterfaceMember signalMember = interfaceDescription2.GetSignal("nameChanged");
            bus.RegisterSignalHandler(signalReceiver, signalMember, string.Empty);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NameChangeBusListener" /> class
        /// </summary>
        /// <param name="bus">object responsible for connecting to and optionally managing a message 
        /// bus</param>
        /// <param name="foundNameEvent">event to set when the well-known name being queried 
        /// is found</param>
        public NameChangeBusListener(BusAttachment bus, AutoResetEvent foundNameEvent)
        {
            this.busAtt = bus;
            this.foundName = foundNameEvent;

            this.busListener = new BusListener(this.busAtt);
            this.busListener.BusDisconnected += new BusListenerBusDisconnectedHandler(this.BusListenerBusDisconnected);
            this.busListener.BusStopping += new BusListenerBusStoppingHandler(this.BusListenerBusStopping);
            this.busListener.FoundAdvertisedName += new BusListenerFoundAdvertisedNameHandler(this.BusListenerFoundAdvertisedName);
            this.busListener.ListenerRegistered += new BusListenerListenerRegisteredHandler(this.BusListenerListenerRegistered);
            this.busListener.ListenerUnregistered += new BusListenerListenerUnregisteredHandler(this.BusListenerListenerUnregistered);
            this.busListener.LostAdvertisedName += new BusListenerLostAdvertisedNameHandler(this.BusListenerLostAdvertisedName);
            this.busListener.NameOwnerChanged += new BusListenerNameOwnerChangedHandler(this.BusListenerNameOwnerChanged);

            this.sessionListener = new SessionListener(this.busAtt);
            this.sessionListener.SessionLost += new SessionListenerSessionLostHandler(this.SessionListenerSessionLost);
            this.sessionListener.SessionMemberAdded += new SessionListenerSessionMemberAddedHandler(this.SessionListenerSessionMemberAdded);
            this.sessionListener.SessionMemberRemoved += new SessionListenerSessionMemberRemovedHandler(this.SessionListenerSessionMemberRemoved);
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicClientBusListener" /> class
        /// </summary>
        /// <param name="bus">object responsible for connecting to and optionally managing a message 
        /// bus</param>
        /// <param name="foundNameEvent">event to set when the well-known name being queried 
        /// is found</param>
        public BasicClientBusListener(BusAttachment bus, AutoResetEvent foundNameEvent)
        {
            SessionidList = new List<uint>();
            busAtt = bus;
            foundName = foundNameEvent;

            busListener = new BusListener(bus);
            busListener.BusDisconnected += new BusListenerBusDisconnectedHandler(BusListenerBusDisconnected);
            busListener.BusStopping += new BusListenerBusStoppingHandler(BusListenerBusStopping);
            busListener.FoundAdvertisedName += new BusListenerFoundAdvertisedNameHandler(BusListenerFoundAdvertisedName);
            busListener.ListenerRegistered += new BusListenerListenerRegisteredHandler(BusListenerListenerRegistered);
            busListener.ListenerUnregistered += new BusListenerListenerUnregisteredHandler(BusListenerListenerUnregistered);
            busListener.LostAdvertisedName += new BusListenerLostAdvertisedNameHandler(BusListenerLostAdvertisedName);
            busListener.NameOwnerChanged += new BusListenerNameOwnerChangedHandler(BusListenerNameOwnerChanged);

            sessionListener = new SessionListener(bus);
            sessionListener.SessionLost += new SessionListenerSessionLostHandler(SessionListenerSessionLost);
            sessionListener.SessionMemberAdded += new SessionListenerSessionMemberAddedHandler(SessionListenerSessionMemberAdded);
            sessionListener.SessionMemberRemoved += new SessionListenerSessionMemberRemovedHandler(SessionListenerSessionMemberRemoved);
        }
        public Listeners(BusAttachment bus, MainPage host)
        {
            _hostPage     = host;
            _busListeners = new BusListener(bus);
            _busListeners.BusDisconnected      += new BusListenerBusDisconnectedHandler(BusListenerBusDisconnected);
            _busListeners.BusStopping          += new BusListenerBusStoppingHandler(BusListenerBusStopping);
            _busListeners.FoundAdvertisedName  += new BusListenerFoundAdvertisedNameHandler(BusListenerFoundAdvertisedName);
            _busListeners.ListenerRegistered   += new BusListenerListenerRegisteredHandler(BusListenerListenerRegistered);
            _busListeners.ListenerUnregistered += new BusListenerListenerUnregisteredHandler(BusListenerListenerUnregistered);
            _busListeners.LostAdvertisedName   += new BusListenerLostAdvertisedNameHandler(BusListenerLostAdvertisedName);
            _busListeners.NameOwnerChanged     += new BusListenerNameOwnerChangedHandler(BusListenerNameOwnerChanged);

            _sessionPortListener = new SessionPortListener(bus);
            _sessionPortListener.AcceptSessionJoiner += new SessionPortListenerAcceptSessionJoinerHandler(SessionPortListenerAcceptSessionJoiner);
            _sessionPortListener.SessionJoined       += new SessionPortListenerSessionJoinedHandler(SessionPortListenerSessionJoined);

            _sessionListener                       = new SessionListener(bus);
            _sessionListener.SessionLost          += new SessionListenerSessionLostHandler(SessionListenerSessionLost);
            _sessionListener.SessionMemberAdded   += new SessionListenerSessionMemberAddedHandler(SessionListenerSessionMemberAdded);
            _sessionListener.SessionMemberRemoved += new SessionListenerSessionMemberRemovedHandler(SessionListenerSessionMemberRemoved);
        }
Exemple #6
0
        public void GameLoop()
        {
            /*
             * börja lyssna på local session
             * när ett meddelande kommer in så kolla vad det är för metod och vad för authentication den har i headern
             * om det är en get
             * kolla i authentication om den har nån session id
             * kolla i meddeelandet
             * om det är sessionaction:start
             * så skicka till handlern
             * som har en sessionlist där den skapar en ny instans och lägger i listan
             * listan skapar en session id och ett session namn den skickar tillbaka
             * handler skickar ett responce med session id och session name
             *
             */
            GameSessionHandler handler = new GameSessionHandler();

            SessionListener sessionListener = new SessionListener(handler);

            sessionListener.StartListening();
        }
Exemple #7
0
        /// <summary>
        /// Initializes a new instance of the Listeners class.
        /// </summary>
        /// <param name="bus">The bus to listen on.</param>
        /// <param name="host">The main page which handles the user interface.</param>
        public Listeners(BusAttachment bus, MainPage host)
        {
            this.hostPage = host;
            this.busListeners = new BusListener(bus);
            this.busListeners.BusDisconnected += new BusListenerBusDisconnectedHandler(this.BusListenerBusDisconnected);
            this.busListeners.BusStopping += new BusListenerBusStoppingHandler(this.BusListenerBusStopping);
            this.busListeners.FoundAdvertisedName += new BusListenerFoundAdvertisedNameHandler(this.BusListenerFoundAdvertisedName);
            this.busListeners.ListenerRegistered += new BusListenerListenerRegisteredHandler(this.BusListenerListenerRegistered);
            this.busListeners.ListenerUnregistered += new BusListenerListenerUnregisteredHandler(this.BusListenerListenerUnregistered);
            this.busListeners.LostAdvertisedName += new BusListenerLostAdvertisedNameHandler(this.BusListenerLostAdvertisedName);
            this.busListeners.NameOwnerChanged += new BusListenerNameOwnerChangedHandler(this.BusListenerNameOwnerChanged);

            this.sessionPortListener = new SessionPortListener(bus);
            this.sessionPortListener.AcceptSessionJoiner += new SessionPortListenerAcceptSessionJoinerHandler(this.SessionPortListenerAcceptSessionJoiner);
            this.sessionPortListener.SessionJoined += new SessionPortListenerSessionJoinedHandler(this.SessionPortListenerSessionJoined);

            this.sessionListener = new SessionListener(bus);
            this.sessionListener.SessionLost += new SessionListenerSessionLostHandler(this.SessionListenerSessionLost);
            this.sessionListener.SessionMemberAdded += new SessionListenerSessionMemberAddedHandler(this.SessionListenerSessionMemberAdded);
            this.sessionListener.SessionMemberRemoved += new SessionListenerSessionMemberRemovedHandler(this.SessionListenerSessionMemberRemoved);
        }
            public QStatus JoinSession(string sessionHost, ushort sessionPort, SessionListener listener,
                                       out uint sessionId, SessionOpts opts)
            {
                IntPtr optsPtr           = opts.UnmanagedPtr;
                uint   sessionId_out     = 0;
                int    qstatus           = 0;
                Thread joinSessionThread = new Thread((object o) => {
                    qstatus = alljoyn_busattachment_joinsession(_busAttachment, sessionHost, sessionPort,
                                                                (listener == null ? IntPtr.Zero : listener.UnmanagedPtr), ref sessionId_out, optsPtr);
                });

                joinSessionThread.Start();
                while (joinSessionThread.IsAlive)
                {
                    AllJoyn.TriggerCallbacks();
                    Thread.Sleep(1);
                }

                sessionId = sessionId_out;
                return(qstatus);
            }
Exemple #9
0
        /// <summary>
        /// Initializes a new instance of the Listeners class.
        /// </summary>
        /// <param name="bus">The BusAttachment to use.</param>
        public Listeners(BusAttachment bus)
        {
            this.bus         = bus;
            this.busListener = new BusListener(this.bus);
            this.busListener.BusDisconnected      += new BusListenerBusDisconnectedHandler(this.BusListenerBusDisconnected);
            this.busListener.BusStopping          += new BusListenerBusStoppingHandler(this.BusListenerBusStopping);
            this.busListener.FoundAdvertisedName  += new BusListenerFoundAdvertisedNameHandler(this.BusListenerFoundAdvertisedName);
            this.busListener.ListenerRegistered   += new BusListenerListenerRegisteredHandler(this.BusListenerListenerRegistered);
            this.busListener.ListenerUnregistered += new BusListenerListenerUnregisteredHandler(this.BusListenerListenerUnregistered);
            this.busListener.LostAdvertisedName   += new BusListenerLostAdvertisedNameHandler(this.BusListenerLostAdvertisedName);
            this.busListener.NameOwnerChanged     += new BusListenerNameOwnerChangedHandler(this.BusListenerNameOwnerChanged);

            this.sessionPortListener = new SessionPortListener(this.bus);
            this.sessionPortListener.AcceptSessionJoiner += new SessionPortListenerAcceptSessionJoinerHandler(this.SessionPortListenerAcceptSessionJoiner);
            this.sessionPortListener.SessionJoined       += new SessionPortListenerSessionJoinedHandler(this.SessionPortListenerSessionJoined);

            this.sessionListener                       = new SessionListener(this.bus);
            this.sessionListener.SessionLost          += new SessionListenerSessionLostHandler(this.SessionListenerSessionLost);
            this.sessionListener.SessionMemberAdded   += new SessionListenerSessionMemberAddedHandler(this.SessionListenerSessionMemberAdded);
            this.sessionListener.SessionMemberRemoved += new SessionListenerSessionMemberRemovedHandler(this.SessionListenerSessionMemberRemoved);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SignalServiceBusListener" /> class.
        /// </summary>
        /// <param name="bus">object responsible for connecting to and optionally managing a message
        /// bus.</param>
        public SignalServiceBusListener(BusAttachment bus)
        {
            SessionidList = new List<uint>();
            this.busAtt = bus;
            this.busListener = new BusListener(bus);
            this.busListener.BusDisconnected += new BusListenerBusDisconnectedHandler(this.BusListenerBusDisconnected);
            this.busListener.BusStopping += new BusListenerBusStoppingHandler(this.BusListenerBusStopping);
            this.busListener.FoundAdvertisedName += new BusListenerFoundAdvertisedNameHandler(this.BusListenerFoundAdvertisedName);
            this.busListener.ListenerRegistered += new BusListenerListenerRegisteredHandler(this.BusListenerListenerRegistered);
            this.busListener.ListenerUnregistered += new BusListenerListenerUnregisteredHandler(this.BusListenerListenerUnregistered);
            this.busListener.LostAdvertisedName += new BusListenerLostAdvertisedNameHandler(this.BusListenerLostAdvertisedName);
            this.busListener.NameOwnerChanged += new BusListenerNameOwnerChangedHandler(this.BusListenerNameOwnerChanged);

            this.sessionPortListener = new SessionPortListener(bus);
            this.sessionPortListener.AcceptSessionJoiner += new SessionPortListenerAcceptSessionJoinerHandler(this.SessionPortListenerAcceptSessionJoiner);
            this.sessionPortListener.SessionJoined += new SessionPortListenerSessionJoinedHandler(this.SessionPortListenerSessionJoined);

            this.sessionListener = new SessionListener(bus);
            this.sessionListener.SessionLost += new SessionListenerSessionLostHandler(this.SessionListenerSessionLost);
            this.sessionListener.SessionMemberAdded += new SessionListenerSessionMemberAddedHandler(this.SessionListenerSessionMemberAdded);
            this.sessionListener.SessionMemberRemoved += new SessionListenerSessionMemberRemovedHandler(this.SessionListenerSessionMemberRemoved);
        }
 public override Session Connect(string senderName, Connection connection, TemplateRegistry inboundRegistry, TemplateRegistry outboundRegistry, MessageListener messageListener, SessionListener sessionListener)
 {
     var session = new Session(connection, this, TemplateRegistry_Fields.NULL, TemplateRegistry_Fields.NULL);
     session.MessageOutputStream.WriteMessage(CreateHelloMessage(senderName));
     try
     {
         System.Threading.Thread.Sleep(new TimeSpan((Int64) 10000 * 20));
     }
     catch (System.Threading.ThreadInterruptedException)
     {
     }
     var message = session.MessageInputStream.ReadMessage();
     string serverName = message.GetString(1);
     string vendorId = message.IsDefined(2)?message.GetString(2):"unknown";
     session.Client = new BasicClient(serverName, vendorId);
     return session;
 }
 private void _SessionLost(SessionListener context, uint sessionId)
 {
     context.SessionLost(sessionId);
 }
Exemple #13
0
		public LoginButton (Context context)
			: base (context)
		{
			mSessionListener = new SessionListener (this);
		}
Exemple #14
0
            }                                      // Dummy constructor

            public SessionHandler(SessionListener cb)
            {
            }                                                        // 0x0000000181B547F0-0x0000000181B54850
        protected internal virtual Session createNewSession(bool isPolling, bool isComboForced, bool isHTTP, Session prevSession, SessionListener listener, SubscriptionsListener subscriptions, MessagesListener messages, SessionThread sessionThread, InternalConnectionDetails details, InternalConnectionOptions options, int handlerPhase, bool retryAgainIfStreamFails, bool sessionRecovery)
        {
            Interlocked.Increment(ref objectIdGenerator);
            int objectId = objectIdGenerator;

            HttpProvider httpProvider = TransportFactory <HttpProvider> .DefaultHttpFactory.getInstance(sessionThread);

            /*var htf = new NettyHttpProviderFactory();
             *
             * if (htf is null)
             * {
             *  log.Debug("NettyHttpProviderFactory error.");
             * }
             *
             * HttpProvider httpProvider = htf.getInstance(sessionThread);*/

            Http httpTransport = new Http(sessionThread, httpProvider);

            if (isHTTP)
            {
                Protocol    txt         = new TextProtocolHttp(objectId, sessionThread, options, httpTransport);
                SessionHTTP sessionHTTP = new SessionHTTP(objectId, isPolling, isComboForced, listener, subscriptions, messages, prevSession, sessionThread, txt, details, options, handlerPhase, retryAgainIfStreamFails, sessionRecovery);
                return(sessionHTTP);
            }
            else
            {
                Protocol ws;
                try
                {
                    ws = new TextProtocolWS(objectId, sessionThread, options, details, httpTransport);
                }
                catch (Exception e)
                {
                    log.Error("Error TextProtocolWS: " + e.Message + ", " + e.StackTrace);

                    ws = null;
                }

                return(new SessionWS(objectId, isPolling, isComboForced, listener, subscriptions, messages, prevSession, sessionThread, ws, details, options, handlerPhase, retryAgainIfStreamFails, sessionRecovery));
            }
        }
 public static extern void SessionListener_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, SessionListener.SwigDelegateSessionListener_0 delegate0, SessionListener.SwigDelegateSessionListener_1 delegate1, SessionListener.SwigDelegateSessionListener_2 delegate2, SessionListener.SwigDelegateSessionListener_3 delegate3);
 static SessionListener_Fields()
 {
     NULL = new NULLSessionListener();
 }
Exemple #18
0
 public SessionHTTP(int objectId, bool isPolling, bool forced, SessionListener handler, SubscriptionsListener subscriptions, MessagesListener messages, Session originalSession, SessionThread thread, Protocol protocol, InternalConnectionDetails details, InternalConnectionOptions options, int callerPhase, bool retryAgainIfStreamFails, bool sessionRecovery) : base(objectId, isPolling, forced, handler, subscriptions, messages, originalSession, thread, protocol, details, options, callerPhase, retryAgainIfStreamFails, sessionRecovery)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientBusListener" /> class.
        /// </summary>
        /// <param name="busAtt">object responsible for connecting to and optionally managing a message
        /// bus.</param>
        /// <param name="op">Stress Operation using this class as listener object</param>
        /// <param name="foundNameEvent">Event to set when the first service is discovered</param>
        public ClientBusListener(BusAttachment busAtt, StressOperation op, AutoResetEvent foundNameEvent)
        {
            this.stressOp = op;
            this.mutex = new Mutex();
            this.foundAvertisedName = false;
            this.foundName = foundNameEvent;

            // Create Bus Listener and register signal handlers 
            this.busListener = new BusListener(busAtt);
            this.busListener.BusDisconnected += new BusListenerBusDisconnectedHandler(this.BusListenerBusDisconnected);
            this.busListener.BusStopping += new BusListenerBusStoppingHandler(this.BusListenerBusStopping);
            this.busListener.FoundAdvertisedName += new BusListenerFoundAdvertisedNameHandler(this.BusListenerFoundAdvertisedName);
            this.busListener.ListenerRegistered += new BusListenerListenerRegisteredHandler(this.BusListenerListenerRegistered);
            this.busListener.ListenerUnregistered += new BusListenerListenerUnregisteredHandler(this.BusListenerListenerUnregistered);
            this.busListener.LostAdvertisedName += new BusListenerLostAdvertisedNameHandler(this.BusListenerLostAdvertisedName);
            this.busListener.NameOwnerChanged += new BusListenerNameOwnerChangedHandler(this.BusListenerNameOwnerChanged);

            // Create Session Listener and register signal handlers 
            this.sessionListener = new SessionListener(busAtt);
            this.sessionListener.SessionLost += new SessionListenerSessionLostHandler(this.SessionListenerSessionLost);
            this.sessionListener.SessionMemberAdded += new SessionListenerSessionMemberAddedHandler(this.SessionListenerSessionMemberAdded);
            this.sessionListener.SessionMemberRemoved += new SessionListenerSessionMemberRemovedHandler(this.SessionListenerSessionMemberRemoved);

            busAtt.RegisterBusListener(this.busListener);
        }
 public abstract Session Connect(string param1, Connection param2, TemplateRegistry inboundRegistry, TemplateRegistry outboundRegistry, MessageListener messageListener, SessionListener sessionListener);
 public override Session Connect(string senderName, Connection connection, TemplateRegistry inboundRegistry, TemplateRegistry outboundRegistry, MessageListener messageListener, SessionListener sessionListener)
 {
     var session = new Session(connection, this, TemplateRegistry_Fields.NULL, TemplateRegistry_Fields.NULL);
     session.MessageOutputStream.WriteMessage(CreateHelloMessage(senderName));
     Message message = session.MessageInputStream.ReadMessage();
     string serverName = message.GetString(1);
     session.Client = new BasicClient(serverName, "unknown");
     return session;
 }
Exemple #22
0
 private void _SessionMemberRemoved(SessionListener context, uint sessionId, IntPtr uniqueName)
 {
     context.SessionMemberRemoved(sessionId, Marshal.PtrToStringAuto(uniqueName));
 }
 public LoginButton(Context context, IAttributeSet attrs, int defStyle)
     : base(context, attrs, defStyle)
 {
     mSessionListener = new SessionListener(this);
 }
        public override Session Connect(string senderName, Connection connection, TemplateRegistry inboundRegistry, TemplateRegistry outboundRegistry, MessageListener messageListener, SessionListener sessionListener)
        {
            var session = new Session(connection, this, TemplateRegistry_Fields.NULL, TemplateRegistry_Fields.NULL);

            session.MessageOutputStream.WriteMessage(CreateHelloMessage(senderName));
            try
            {
                System.Threading.Thread.Sleep(new TimeSpan((Int64)10000 * 20));
            }
            catch (System.Threading.ThreadInterruptedException)
            {
            }
            var    message    = session.MessageInputStream.ReadMessage();
            string serverName = message.GetString(1);
            string vendorId   = message.IsDefined(2)?message.GetString(2):"unknown";

            session.Client = new BasicClient(serverName, vendorId);
            return(session);
        }
Exemple #25
0
        }                                                                                 // 0x0000000181B54DB0-0x0000000181B54E10

        public static void Start(SessionListener listener)
        {
        }                                                             // 0x0000000181B54F30-0x0000000181B55190
 public LoginButton(Context context)
     : base(context)
 {
     mSessionListener = new SessionListener(this);
 }
 private void _SessionMemberRemoved(SessionListener context, uint sessionId, IntPtr uniqueName)
 {
     context.SessionMemberRemoved(sessionId, Marshal.PtrToStringAuto(uniqueName));
 }
Exemple #28
0
        }                                                                                   // 0x0000000181B549D0-0x0000000181B54A30

        public static void IsReady(SessionListener listener)
        {
        }                                                               // 0x0000000181B54B50-0x0000000181B54DB0
 public QStatus SetSessionListener(SessionListener listener, uint sessionId)
 {
     return(alljoyn_busattachment_setsessionlistener(_busAttachment, sessionId, listener.UnmanagedPtr));
 }
Exemple #30
0
        }                                                                                // 0x0000000181B55190-0x0000000181B551F0

        public static void Stop(SessionListener listener)
        {
        }                                                            // 0x0000000181B55310-0x0000000181B55570
        public override Session Connect(string senderName, Connection connection, TemplateRegistry inboundRegistry, TemplateRegistry outboundRegistry, MessageListener messageListener, SessionListener sessionListener)
        {
            var session = new Session(connection, this, TemplateRegistry_Fields.NULL, TemplateRegistry_Fields.NULL);

            session.MessageOutputStream.WriteMessage(CreateHelloMessage(senderName));
            Message message    = session.MessageInputStream.ReadMessage();
            string  serverName = message.GetString(1);

            session.Client = new BasicClient(serverName, "unknown");
            return(session);
        }
Exemple #32
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SessionListener obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Exemple #33
0
 public abstract Session Connect(string param1, Connection param2, TemplateRegistry inboundRegistry, TemplateRegistry outboundRegistry, MessageListener messageListener, SessionListener sessionListener);
Exemple #34
0
		public LoginButton (Context context, IAttributeSet attrs, int defStyle)
			: base (context, attrs, defStyle)
		{
			mSessionListener = new SessionListener (this);
		}
 public ClientSessionListener(BusAttachment busAtt)
 {
     this.sl = new SessionListener(busAtt);
     this.sl.SessionLost += new SessionListenerSessionLostHandler(this.SessionListenerSessionLost);
 }
            public QStatus JoinSession(string sessionHost, ushort sessionPort, SessionListener listener,
				out uint sessionId, SessionOpts opts)
            {
                IntPtr optsPtr = opts.UnmanagedPtr;
                uint sessionId_out = 0;
                int qstatus = 0;
                Thread joinSessionThread = new Thread((object o) => {
                    qstatus = alljoyn_busattachment_joinsession(_busAttachment, sessionHost, sessionPort,
                        (listener == null ? IntPtr.Zero : listener.UnmanagedPtr), ref sessionId_out, optsPtr);
                });
                joinSessionThread.Start();
                while(joinSessionThread.IsAlive)
                {
                    AllJoyn.TriggerCallbacks();
                    Thread.Sleep(1);
                }

                sessionId = sessionId_out;
                return qstatus;
            }
Exemple #37
0
 static SessionListener_Fields()
 {
     NULL = new NULLSessionListener();
 }
 /**
  * Set the SessionListener for an existing sessionId.
  * Calling this method will override the listener set by a previous call to SetSessionListener or any
  * listener specified in JoinSession.
  *
  * @param sessionId    The session id of an existing session.
  * @param listener     The SessionListener to associate with the session. May be NULL to clear previous listener.
  * @return  QStatus.OK if successful.
  */
 public QStatus SetSessionListener(SessionListener listener, uint sessionId)
 {
     QStatus ret = QStatus.OK;
     Thread bindThread = new Thread((object o) =>
     {
         ret = alljoyn_busattachment_setsessionlistener(_busAttachment, sessionId, listener == null ? IntPtr.Zero : listener.UnmanagedPtr);
     });
     bindThread.Start();
     while (bindThread.IsAlive)
     {
         AllJoyn.TriggerCallbacks();
         Thread.Sleep(0);
     }
     return ret;
 }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SessionListener obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
Exemple #40
0
 public virtual void RemoveListener(SessionListener oldListener)
 {
     SharingClientPINVOKE.Session_RemoveListener(swigCPtr, SessionListener.getCPtr(oldListener));
 }
            public QStatus JoinSession(string sessionHost, ushort sessionPort, SessionListener listener,
				out uint sessionId, SessionOpts opts)
            {
                IntPtr optsPtr = opts.UnmanagedPtr;
                uint sessionId_out = 0;
                int qstatus = alljoyn_busattachment_joinsession(
                    _busAttachment, sessionHost, sessionPort,
                    (listener == null ? IntPtr.Zero : listener.UnmanagedPtr),
                    ref sessionId_out, optsPtr);

                sessionId = sessionId_out;
                return qstatus;
            }
 public QStatus SetSessionListener(SessionListener listener, uint sessionId)
 {
     return alljoyn_busattachment_setsessionlistener(_busAttachment, sessionId, listener.UnmanagedPtr);
 }
 public virtual void AddListener(SessionListener newListener) {
   SharingClientPINVOKE.Session_AddListener(swigCPtr, SessionListener.getCPtr(newListener));
 }
Exemple #44
0
 public virtual void AddListener(SessionListener newListener)
 {
     SharingClientPINVOKE.Session_AddListener(swigCPtr, SessionListener.getCPtr(newListener));
 }
 public virtual void RemoveListener(SessionListener oldListener) {
   SharingClientPINVOKE.Session_RemoveListener(swigCPtr, SessionListener.getCPtr(oldListener));
 }
 public ClientSessionListener(BusAttachment busAtt)
 {
     this.sl              = new SessionListener(busAtt);
     this.sl.SessionLost += new SessionListenerSessionLostHandler(this.SessionListenerSessionLost);
 }
Exemple #47
0
 private void _SessionLost(SessionListener context, uint sessionId)
 {
     context.SessionLost(sessionId);
 }