Example #1
0
        public CcdCam(string pipeName)
        {
            if (!DataServer.IsRunning(pipeName))
            {
                this.externalDataServer = DataServer.LaunchExternal(pipeName, waitUntilReady: true);
            }

            cameraReader = new CameraReader <ICameraFlow, RemoteClientCameraFlow>(pipeName, new AcqProtoSerializer());

            // ensure we stop the server, if we're the ones who started it
            cameraReader.TerminateServerOnStop = (this.externalDataServer != null);

            cameraReader.DataSource.NewData += DataSource_NewData;
        }
Example #2
0
        private static void Test()
        {
            var serverObj    = new QCamServer();
            var cancelSource = new CancellationTokenSource();
            var serverTask   = serverObj.LaunchServer(cancelSource.Token, waitUntilReady: true);

            var cr = new CameraReader <ICameraFlow, RemoteClientCameraFlow>(
                serverObj.DefaultCoordinationName,
                serverObj.customSerializer);

            cr.TerminateServerOnStop = true;
            var cam = cr.Flow;
            var src = cr.DataSource;

            var ss = cam.SettingsStatic;

            cam.SettingsStatic = ss;
            src.NewData       += (s, e) => Console.WriteLine(e.FrameNumber);;
            src.Start();

            while (true)
            {
                if (Console.KeyAvailable)
                {
                    if (Console.ReadKey().Key == ConsoleKey.Escape)
                    {
                        break;
                    }
                }
                Thread.Sleep(100);
            }

            src.Stop();
            cam.Dispose();

            cancelSource.Cancel();
        }