Exemple #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form1 form = new Form1();

            IAIntAirAct intAirAct = IAIntAirAct.New();

            intAirAct.Route(new IARoute("PUT", "/image"), delegate(IARequest req, IAResponse res)
            {
                logger.TraceEvent(TraceEventType.Information, 0, "Received request on {0}", req.Route);

                String url = req.BodyAsString();
                form.BeginInvoke((Action) delegate()
                {
                    form.LoadImageFromURL(url);
                });
            });

            intAirAct.Start();

            Application.Run(form);

            intAirAct.Stop();
        }
        public void Setup()
        {
            //client = IAIntAirAct.New();
            Client                 = IAIntAirAct.New();
            Server                 = new MSEKinectManager();
            clientConnected        = false;
            serverConnected        = false;
            doneWaitingForResponse = false;

            Client.Port           = ClientPort;
            Server.IntAirAct.Port = ServerPort;

            // Increment the port numbers, so that if the current test run crashes, we don't try to use unreclaimed ports on the next test
            ClientPort++;
            ServerPort++;

            // In the tests, we wait on clientConnected and serverConnected, to be certain that each IntAirAct instance has registered the other
            // We use known ports to 'uniquely' identify instances during the test, since other IntAirAct devices may exist on the network during the test
            Client.DeviceFound += delegate(IADevice device, bool ownDevice)
            {
                if (device.Port == Server.IntAirAct.Port)
                {
                    clientConnected = true;
                }
            };

            Server.IntAirAct.DeviceFound += delegate(IADevice device, bool ownDevice)
            {
                if (device.Port == Client.Port)
                {
                    serverConnected = true;
                }
            };
        }
        public void Teardown()
        {
            Client.Stop();
            Server.Stop();

            Client = null;
            Server = null;
        }
        public void Teardown()
        {
            Client.Stop();
            Server.Stop();

            Client = null;
            Server = null;

            // Wait a few seconds at the end of each test, to allow networking dependencies to clean up
            System.Threading.Thread.Sleep(2000);
        }
Exemple #5
0
        public void TestMethod1()
        {
            ia = IAIntAirAct.New();
            ia.Start();
            ia.Stop();

            mse = new MSEKinectManager();

            //Setup();
            //Teardown();
        }
        public PersonManager(LocatorInterface locator, GestureController gc, IAIntAirAct intAirAct)
        {
            this.gestureController = gc;
            this.locator           = locator;
            locator.threadLock     = new object();
            this.intAirAct         = intAirAct;

            kinectserver = new MSEKinectServer();

            kinectserver.NewKinectDiscovered += new NewKinectDiscoveredEventSignature(kinectserver_NewKinectDiscovered);
            kinectserver.SkeletonsRecieved   += new SkeletonsReceivedEventSignature(kinectserver_SkeletonsRecieved);
            kinectserver.kinectRemoved       += new KinectRemovedSignature(kinectserver_kinectRemoved);
        }
        public MSEKinectManager(bool RequireKinect = false)
        {
            if (RequireKinect)
            {
                TestKinectAvailability();
            }


            //Instantiate Components
            intAirAct         = IAIntAirAct.New();
            locator           = new Locator();
            pairingRecognizer = new PairingRecognizer(locator, intAirAct);
            gestureController = new GestureController();
            personManager     = new PersonManager(locator, gestureController, intAirAct);
            deviceManager     = new DeviceManager(locator, intAirAct);
        }
Exemple #8
0
        static void Main(string[] args)
        {
            Program  p        = new Program();
            AmazonS3 s3Client = Program.GetS3Client();
            //Program.CreateNewFolder(s3Client, Program.BUCKET_NAME, "first folder");
            //Program.CreateBucket(s3Client);

            IAIntAirAct intAirAct = IAIntAirAct.New();

            IARoute imageRoute           = IARoute.Get("/SKA/image/{slicenumber}");
            IARoute imageRouteParameters = IARoute.Get("/SKA/image/{slicenumber}/{cmap}/{clipping}");
            IARoute numberOfSlicesRoute  = IARoute.Get("/SKA/numberOfSlices/{cmap}/{clipping}");


            intAirAct.Route(numberOfSlicesRoute, delegate(IARequest request, IAResponse response)
            {
                try
                {
                    string cmap     = request.Parameters["cmap"];
                    string clipping = request.Parameters["clipping"];
                    Program.SliceNumbers(s3Client, cmap, clipping);
                    response.SetBodyWithString(Program.SliceNumbers(s3Client, cmap, clipping));
                }
                catch
                {
                    response.SetBodyWithString("0");
                }
            });

            intAirAct.Route(imageRouteParameters, delegate(IARequest request, IAResponse response)
            {
                try
                {
                    int sliceNumber = Convert.ToInt32(request.Parameters["slicenumber"]);
                    string cmap     = request.Parameters["cmap"];
                    string clipping = request.Parameters["clipping"];

                    byte[] data = Program.GetImage(sliceNumber, cmap, clipping);

                    if (Program.imgfound == false)
                    {
                        response.StatusCode = 404;
                        Program.imgfound    = true;
                    }
                    else
                    {
                        response.Body        = data;
                        response.ContentType = "image/jpeg";
                    }
                }
                catch
                {
                    response.StatusCode = 404;
                }
            });

            intAirAct.Port = 12350;
            intAirAct.Start();

            Console.WriteLine("");
            Console.WriteLine(WebServer.GetExternalIP() + "Port " + intAirAct.Port.ToString());
            Console.WriteLine("\nA simple webserver. Press any key to quit.");
            Console.ReadKey();
        }
Exemple #9
0
 public DeviceManager(LocatorInterface locator, IAIntAirAct intAirAct)
 {
     this.locator = locator;
     this.ia      = intAirAct;
 }
Exemple #10
0
 public PairingRecognizer(LocatorInterface locator, IAIntAirAct intAirAct)
 {
     this.locator   = locator;
     this.intAirAct = intAirAct;
 }