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 CommunicationManager(IntAirAct.IAIntAirAct intAirAct, PairingRecognizer pairingRecognizer, MSELocator.LocatorInterface locator, PersonManager personManager) { this.intAirAct = intAirAct; this.pairingRecognizer = pairingRecognizer; this.locator = locator; this.personManager = personManager; // Pairing intAirAct.Route(Routes.RequestPairingRoute, new Action<IARequest, IAResponse>(UpdateDevicePairingState)); // Properties of Devices intAirAct.Route(Routes.GetOffsetAngleRoute, new Action<IARequest, IAResponse>(GetOffsetAngle)); intAirAct.Route(Routes.SetOrientationRoute, new Action<IARequest, IAResponse>(UpdateDeviceOrientation)); intAirAct.Route(Routes.SetLocationRoute, new Action<IARequest, IAResponse>(UpdateDeviceLocation)); // Locating Devices intAirAct.Route(Routes.GetDeviceInfoRoute, new Action<IARequest, IAResponse>(GetDevice)); intAirAct.Route(Routes.GetAllDeviceInfoRoute, new Action<IARequest, IAResponse>(GetDevices)); intAirAct.Route(Routes.GetNearestDeviceInViewRoute, new Action<IARequest, IAResponse>(GetNearestDeviceInView)); intAirAct.Route(Routes.GetAllDevicesInViewRoute, new Action<IARequest, IAResponse>(GetDevicesInView)); intAirAct.Route(Routes.GetNearestDeviceInRangeRoute, new Action<IARequest, IAResponse>(GetNearestDeviceInRange)); intAirAct.Route(Routes.GetAllDevicesInRangeRoute, new Action<IARequest, IAResponse>(GetDevicesInRange)); /* Depricated!!! intAirAct.Route(Routes.GetAllDevicesWithIntersectionPointsRoute, new Action<IARequest, IAResponse>(GetDevicesWithIntersectionPoint)); */ }
public CommunicationManager(IntAirAct.IAIntAirAct intAirAct, PairingRecognizer pairingRecognizer, MSELocator.LocatorInterface locator, PersonManager personManager) { this.intAirAct = intAirAct; this.pairingRecognizer = pairingRecognizer; this.locator = locator; this.personManager = personManager; // Pairing intAirAct.Route(Routes.RequestPairingRoute, new Action <IARequest, IAResponse>(UpdateDevicePairingState)); // Properties of Devices intAirAct.Route(Routes.GetOffsetAngleRoute, new Action <IARequest, IAResponse>(GetOffsetAngle)); intAirAct.Route(Routes.SetOrientationRoute, new Action <IARequest, IAResponse>(UpdateDeviceOrientation)); intAirAct.Route(Routes.SetLocationRoute, new Action <IARequest, IAResponse>(UpdateDeviceLocation)); // Locating Devices intAirAct.Route(Routes.GetDeviceInfoRoute, new Action <IARequest, IAResponse>(GetDevice)); intAirAct.Route(Routes.GetAllDeviceInfoRoute, new Action <IARequest, IAResponse>(GetDevices)); intAirAct.Route(Routes.GetNearestDeviceInViewRoute, new Action <IARequest, IAResponse>(GetNearestDeviceInView)); intAirAct.Route(Routes.GetAllDevicesInViewRoute, new Action <IARequest, IAResponse>(GetDevicesInView)); intAirAct.Route(Routes.GetNearestDeviceInRangeRoute, new Action <IARequest, IAResponse>(GetNearestDeviceInRange)); intAirAct.Route(Routes.GetAllDevicesInRangeRoute, new Action <IARequest, IAResponse>(GetDevicesInRange)); /* Depricated!!! * intAirAct.Route(Routes.GetAllDevicesWithIntersectionPointsRoute, new Action<IARequest, IAResponse>(GetDevicesWithIntersectionPoint)); */ }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); logger.TraceEvent(TraceEventType.Start, 0); MainWindow mw = new MainWindow(); //Instantiate and Start IntAirAct intAirAct = IAIntAirAct.New(); intAirAct.Route(IARoute.Post("/mrivisualizer/slice/{slicenumber}"), delegate(IARequest request, IAResponse response) { int slice = int.Parse(request.Parameters["slicenumber"]); logger.TraceEvent(TraceEventType.Verbose, 0, "Updating to {0}", slice); Dispatcher.BeginInvoke((Action) delegate() { mw.showSlice(slice); }); }); intAirAct.Start(); mw.Show(); }
public void Teardown() { Client.Stop(); Server.Stop(); Client = null; Server = null; }
public void TestMethod1() { ia = IAIntAirAct.New(); ia.Start(); ia.Stop(); mse = new MSEKinectManager(); //Setup(); //Teardown(); }
/// <summary> /// Completes information for a List of MSEDevice's /// </summary> /// <param name="deviceList">Device List to be updated</param> /// <param name="intAirAct">Instance of IntAirAct</param> public static void CompleteDeviceListInformation(List<MSEDevice> deviceList, IAIntAirAct intAirAct) { foreach (MSEDevice device in deviceList) { Util.CompleteDeviceInformation(device, intAirAct); if (device.NetworkDevice == null) { deviceList.Remove(device); } } }
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); }
public DICOMViewer(IAIntAirAct intAirAct) { InitializeComponent(); this.intAirAct = intAirAct; string[] filePaths = Directory.GetFiles(Environment.CurrentDirectory + "//MRIScans//", "*.dcm"); ReturnImageListFromFile(filePaths); amount = dicomImages.Count; inkingCanvas.IsHitTestVisible = false; frameNumber.Text = "Frame " + (count+1) + " of " + amount; inkingCanvas.Background = new ImageBrush(dicomImages[count].Bitmap); PatientImages.ItemsSource = dicomImages; }
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 SeismicLineView(IAIntAirAct intairact) { InitializeComponent(); myClient = new SeismicSliceServiceLibrary.SeismicServiceAnswerClient("BasicHttpBinding_ISeismicServiceAnswer"); myClient.GetSeismicCrossSectionCompleted += this.CrossSectionCompletedAsync; this.intAirAct = intairact; //disable shadow ApplyTemplate(); this.Background = new SolidColorBrush(Colors.Transparent); this.BorderBrush = new SolidColorBrush(Colors.Transparent); ShowsActivationEffects = false; Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome ssc; ssc = (Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome)this.Template.FindName("shadow", this); ssc.Visibility = Visibility.Hidden; }
public static IAIntAirAct New() { // don't mess with the order here, TinyIoC is very picky about it TinyIoCContainer container = TinyIoCContainer.Current; NancyServerAdapter adapter = new NancyServerAdapter(); Owin.AppDelegate app = Gate.Adapters.Nancy.NancyAdapter.App(); adapter.App = app; IAClient client = new HttpWebRequestClient(); // register the server adapter for the module serving the routes container.Register <NancyServerAdapter>(adapter); IAIntAirAct intAirAct = new IAIntAirAct(adapter, client); // register IntAirAct for getting the origin devices in NancyModule container.Register <IAIntAirAct>(intAirAct); return(intAirAct); }
private void Window_Loaded(object sender, RoutedEventArgs e) { Debug.WriteLine("Window Loaded"); // Look through all sensors and start the first connected one. // This requires that a Kinect is connected at the time of app startup. // To make your app robust against plug/unplug, // it is recommended to use KinectSensorChooser provided in Microsoft.Kinect.Toolkit foreach (var potentialSensor in KinectSensor.KinectSensors) { if (potentialSensor.Status == KinectStatus.Connected) { this.sensor = potentialSensor; break; } } if (null != this.sensor) { // Turn on the depth stream to receive depth frames this.sensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30); // Allocate space to put the depth pixels we'll receive this.depthPixels = new short[this.sensor.DepthStream.FramePixelDataLength]; // Allocate space to put the color pixels we'll create this.colorPixels = new byte[this.sensor.DepthStream.FramePixelDataLength * sizeof(int)]; // This is the bitmap we'll display on-screen this.colorBitmap = new WriteableBitmap(this.sensor.DepthStream.FrameWidth, this.sensor.DepthStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null); // Set the image we display to point to the bitmap where we'll put the image data //this.Image.Source = this.colorBitmap; // Add an event handler to be called whenever there is new depth frame data this.sensor.DepthFrameReady += this.SensorDepthFrameReady; this.sensor.DepthStream.Range = DepthRange.Near; xPositionAverage = new RollingAverage(5); // Start the sensor! try { this.sensor.Start(); } catch (IOException) { this.sensor = null; Debug.WriteLine("no kinect"); MessageBox.Show("Kinect Error"); } } else MessageBox.Show("No Kinect"); intAirAct = IAIntAirAct.New(); intAirAct.Start(); }
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); }
private void WindowLoaded(object sender, RoutedEventArgs e) { intAirAct = IAIntAirAct.New(); timer = new Timer(1000); //Registers Event Handlers intAirAct.DeviceFound += DeviceFound; intAirAct.DeviceLost += DeviceLost; timer.Elapsed += TimerElapsed; intAirAct.Start(); timer.Start(); }
public PairingRecognizer(LocatorInterface locator, IAIntAirAct intAirAct) { this.locator = locator; this.intAirAct = intAirAct; }
public SeismicLineDrawer(Map map, SkyhunterCanvas canv, IAIntAirAct intAirAct) { InitializeComponent(); SetupSeismicLineDrawer( map, canv, intAirAct); }
public DeviceManager(LocatorInterface locator, IAIntAirAct intAirAct) { this.locator = locator; this.ia = intAirAct; }
public MSEMultiSurface(double screenWidthInCm, double screenHeightInCm, bool isMobile) { this.ScreenWidth = screenWidthInCm; this.ScreenHeight = screenHeightInCm; //Setup Logging logger = new TraceSource("MSEMultiSurface"); this.isRunning = false; //Initialize Our Arrays of Handlers this.ReceivedImageHandlers = new List<MSEReceivedImageHandler>(); this.ReceivedDataHandlers = new List<MSEReceivedDataHandler>(); this.ReceivedDictionaryHandlers = new List<MSEReceivedDictionaryHandler>(); //Setup IntAirAct this.intAirAct = IAIntAirAct.New(); this.ownDevice = new MSEDevice(); LoadConfigurationFile(this.ownDevice); //Setup Locator this.locator = new MSELocator(IntAirAct); //Setup MSE Standard Routes this.setupRoutes(); // Pairing Setup if (!isMobile) { // If we have a location set, we should send it to any server that connencts this.IntAirAct.Route(Routes.GetLocationRoute, delegate(IARequest request, IAResponse response) { if (!this.OwnDevice().Location.HasValue) { response.StatusCode = 404; // Location not found } else { response.SetBodyWith(new IntermediatePoint(this.OwnDevice().Location.Value)); } }); } else { this.setupPairingRoutes(); } // If the server sends us an updated location, we should update our location here this.IntAirAct.Route(Routes.SetLocationRoute, delegate(IARequest request, IAResponse response) { IntermediatePoint p = request.BodyAs<IntermediatePoint>(); UpdateConfigFileLocation(p); }); // Setup handler for when device is found so we can trigger the Ready Event this.IntAirAct.DeviceFound += (delegate(IADevice device, bool ownDevice) { // If the device we find is ourself, then we are ready and fire the event if (ownDevice) { if (Ready != null) { this.ownDevice.Identifier = device.Name; this.ownDevice.setupNetworkDevice(this.IntAirAct); Ready(this.ownDevice); } } }); }
/// <summary> /// Searches for IADevice from IntAirAct and assigns it to device. Updates the LastUpdated property /// </summary> /// <param name="device">Device to be updated</param> /// <param name="intAirAct">Instance of IntAirAct</param> public static void CompleteDeviceInformation(MSEDevice device, IAIntAirAct intAirAct) { device.setupNetworkDevice(intAirAct); device.LastUpdated = DateTime.Now; }
public static IAIntAirAct New() { // don't mess with the order here, TinyIoC is very picky about it TinyIoCContainer container = TinyIoCContainer.Current; NancyServerAdapter adapter = new NancyServerAdapter(); Owin.AppDelegate app = Gate.Adapters.Nancy.NancyAdapter.App(); adapter.App = app; IAClient client = new HttpWebRequestClient(); // register the server adapter for the module serving the routes container.Register<NancyServerAdapter>(adapter); IAIntAirAct intAirAct = new IAIntAirAct(adapter, client); // register IntAirAct for getting the origin devices in NancyModule container.Register<IAIntAirAct>(intAirAct); return intAirAct; }
public NancyRouteModule(NancyServerAdapter adapter) { foreach (KeyValuePair <IARoute, Action <IARequest, IAResponse> > kvp in adapter.Routes) { IARoute route = kvp.Key; Action <IARequest, IAResponse> action = kvp.Value; RouteBuilder rb = new RouteBuilder(route.Action, this); rb[route.Resource] = nancyDynamicDictionary => { Dictionary <string, string> parameters = new Dictionary <string, string>(); // get parameters out of path foreach (string key in nancyDynamicDictionary) { DynamicDictionaryValue value = nancyDynamicDictionary[key]; string urldecoded = HttpUtility.UrlDecode(value.ToString()); parameters.Add(key, urldecoded); } // get parameters out of query string foreach (string key in Request.Query) { DynamicDictionaryValue value = Request.Query[key]; parameters.Add(key, "" + value.Value); } string contentType = Request.Headers.ContentType; IADevice origin = null; if (Request.Headers.Keys.Contains("X-IA-Origin")) { IAIntAirAct intAirAct = TinyIoC.TinyIoCContainer.Current.Resolve <IAIntAirAct>(); if (intAirAct != null) { origin = intAirAct.DeviceWithName(Request.Headers["X-IA-Origin"].First()); } } Dictionary <string, string> metadata = new Dictionary <string, string>(); foreach (KeyValuePair <string, IEnumerable <string> > header in Request.Headers) { var value = header.Value.First(); metadata[header.Key] = value; } IARequest iaRequest = new IARequest(route, metadata, parameters, origin, Request.BodyAsByte(), contentType); IAResponse iaResponse = new IAResponse(); action(iaRequest, iaResponse); Response response = new Response(); response.StatusCode = (HttpStatusCode)iaResponse.StatusCode; response.Contents = stream => { var writer = new BinaryWriter(stream); writer.Write(iaResponse.Body); writer.Flush(); }; response.Headers = iaResponse.Metadata; response.ContentType = iaResponse.ContentType; return(response); }; } }
public bool setupNetworkDevice(IAIntAirAct ia) { IADevice potentialNetworkDevice = ia.DeviceWithName(this.Identifier); if (potentialNetworkDevice == null) return false; this.NetworkDevice = potentialNetworkDevice; return true; }
public MSELocator(IAIntAirAct ia) { this.intAirAct = ia; }
public void SetupSeismicLineDrawer(Map map, SkyhunterCanvas canv, IAIntAirAct intAirAct) { this.intAirAct = intAirAct; intAirAct.Route(IARoute.Get("/seismicimages/slice.jpg"), delegate(IARequest request, IAResponse response) { response.ContentType = "image/jpeg"; response.Body = File.ReadAllBytes(Environment.CurrentDirectory + "/new.jpg"); }); ShowsActivationEffects = false; // to turn off drop shadow this.ApplyTemplate(); Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome ssc; ssc = this.Template.FindName("shadow", this) as Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome; ssc.Visibility = Visibility.Hidden; MyCanvas = canv; MyMap = map; MyGraphicsLayer = new GraphicsLayer(); MyGraphicsLayer.ID = "SeismicLineMarkers"; map.Layers.Add(MyGraphicsLayer); GenerateNewSymbols(); }