Ejemplo n.º 1
0
        public async Task <bool> RequestNewSession(TimeSpan SessionLength, int TimeOutSeconds = 60)
        {
            Console.WriteLine("Await request session");
            CDO.Session NewSession = await SessionController.RequestSession(
                TargetEntityID, RequestedResources.Values.ToList(), SessionLength, TimeOutSeconds);

            Console.WriteLine("Done");
            if (NewSession == null)
            {
                throw new AccessViolationException("New session was actively denied");
            }

            JID TargetJID = await SessionController.StartSession(NewSession.ID);

            if (TargetJID == null)
            {
                throw new InvalidProgramException("Session failed to start");
            }

            if (LowlevelDataController != null)
            {
                LowlevelDataController.Dispose();
                LowlevelDataController = null;
            }

            LowlevelDataController = new LWTSD.DataController(Uplink, TargetJID);
            ActiveSession          = NewSession;
            return(true);
        }
Ejemplo n.º 2
0
            public void OnConnectionStateChanged(Connection.CallbackConnectionState State)
            {
                if (State != Connection.CallbackConnectionState.Connected)
                {
                    Console.WriteLine("Still waiting for being connected, new state: " + State.ToString());
                    return;
                }

                while (!SourceStarted && !Quit)
                {
                    Console.WriteLine("Waiting for source to be started");
                    Thread.Sleep(100);
                }
                Console.WriteLine("Connected. Starting controller test");
                Client = new LWTSD.DataController(Connection,
                                                  new JID("[email protected]/sourcetest"));
            }