예제 #1
0
 public static InputProgram[] GetPrograms(CameraThread Cameras)
 {
     return(new InputProgram[] {
         new StartStopProgram(Cameras)                /*,
                                                       * new Transect_Line.TransectProgram(Cameras)*/
     });
 }
예제 #2
0
        //[Test]
        public void CameraThreadConnectionTest()
        {
            Thread camServer = new Thread(new Listener().StartListening);

            camServer.Name = "CameraServer";
            camServer.Start();
            CameraConfiguration testConfig = new CameraConfiguration
            {
#pragma warning disable 618
                Address = NetworkHelpers.GrabIpv4(Dns.GetHostEntry(Dns.GetHostName())).Address,
#pragma warning restore 618
                Port            = 11003,
                CamFileIdentity = "testCam",
                Id = -1
            };

            CameraSocket testSocket = new CameraSocket
            {
                DataSocket = new WSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp),
                Config     = testConfig
            };

            //start initialising the camera thread
            Assert.IsTrue(testSocket.Setup());
            CameraThread threadTask = new CameraThread(testSocket);
            Thread       camThread  = new Thread(threadTask.Start);

            camThread.Name = "CameraThread";
            camThread.Start();

            //Tell the camera to send a test image
            threadTask.Request = CameraRequest.SendTestImage;
            Thread.Sleep(32);
            while (threadTask.Request != CameraRequest.Alive)
            {
                Thread.Sleep(10);
            }

            camThread.Join();
            camServer.Join();
        }
        //Initialize window, create threads / thread switchers, and initialize logger.
        public MainInterface()
        {
            try {
                Thread.CurrentThread.Name = "Main UI";
            } catch (Exception) { }

            if (!InitializeLogging())
            {
                return;
            }
            Log.Info("Logging initialized.");

            InitializeComponent();
            Log.Info("Program initialized.");

            inputThread    = new InputThread(ThreadPriority.Normal);
            cameraThread   = new CameraThread(ThreadPriority.Normal);
            robotThread    = new RobotThread(ThreadPriority.Normal);
            controlsThread = new ControlsThread(inputThread, robotThread, ThreadPriority.Normal);
            Log.Info("Threads initialized.");

            settings = new AppSettings(robotThread);
        }
 public TransectProgram(CameraThread Cameras) : base()
 {
     cameraThread = Cameras;
 }
 public StartStopProgram(CameraThread Cameras) : base()
 {
     cameraThread = Cameras;
 }
예제 #6
0
 public void Dispose()
 {
     CameraThread.Abort();
 }