public ActiveCall FindCall(NSUuid uuid) { foreach (ActiveCall call in Calls) { if (call.UUID.ToString() == uuid.ToString()) { return(call); } } return(null); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // // @todo Check for camera availability and set in GlobalStatusSingleton public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions) { this.uiApplication = uiApplication; Forms.Init(); CarouselViewRenderer.Init(); //var cv = typeof(Xamarin.Forms.CarouselView); //var assembly = Assembly.Load(cv.FullName); Debug.WriteLine("DHB:AppDelegate:FinishedLaunching pre imgPath."); GlobalStatusSingleton.imgPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); Debug.WriteLine("DHB:AppDelegate:FinishedLaunching imgPath=" + GlobalStatusSingleton.imgPath); LoadApplication(new App()); if ((!Xamarin.Forms.Application.Current.Properties.ContainsKey(App.PROPERTY_UUID)) || (Xamarin.Forms.Application.Current.Properties[App.PROPERTY_UUID].Equals(""))) { NSUuid generator = new NSUuid(); generator.Init(); GlobalStatusSingleton.UUID = generator.ToString(); // this gives the device id. //UIKit.UIDevice.CurrentDevice.IdentifierForVendor.AsString(); } Debug.WriteLine("DHB:AppDelegate:FinishedLaunching guid set to:" + GlobalStatusSingleton.UUID); //notificationTest(); notify.RequestAuthorization(); fbLogin.Init(); FacebookLogin_iOS.uiApplication = uiApplication; CameraServices_iOS myCamera = new CameraServices_iOS(); ((ICamera)(((IExposeCamera)(Xamarin.Forms.Application.Current as App).MainPage).getCamera())).ShouldTakePicture += () => { Debug.WriteLine("pre launch"); uiApplication.KeyWindow.RootViewController.PresentViewController(myCamera, true, null); Debug.WriteLine("present called already"); }; //< FinishedPickingMedia myCamera.FinishedPickingMedia += OnCameraFinished; //> FinishedPickingMedia //< Canceled // i don't have a cancel button... //imagePicker.Canceled += (sender, e) => uiApplication.KeyWindow.RootViewController.DismissViewController(true, null); //> Canceled return(base.FinishedLaunching(uiApplication, launchOptions)); }
/// <summary> /// Connects to known device async. /// /// https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/BestPracticesForInteractingWithARemotePeripheralDevice/BestPracticesForInteractingWithARemotePeripheralDevice.html /// /// </summary> /// <returns>The to known device async.</returns> /// <param name="deviceGuid">Device GUID.</param> public override async Task <IDevice> ConnectToKnownDeviceAsync(Guid deviceGuid, ConnectParameters connectParameters = default(ConnectParameters), CancellationToken cancellationToken = default(CancellationToken)) { // Wait for the PoweredOn state await WaitForState(CBCentralManagerState.PoweredOn, cancellationToken, true); if (cancellationToken.IsCancellationRequested) { throw new TaskCanceledException("ConnectToKnownDeviceAsync cancelled"); } //FYI attempted to use tobyte array insetead of string but there was a problem with byte ordering Guid->NSUui var uuid = new NSUuid(deviceGuid.ToString()); Trace.Message($"[Adapter] Attempting connection to {uuid.ToString()}"); var peripherials = _centralManager.RetrievePeripheralsWithIdentifiers(uuid); var peripherial = peripherials.SingleOrDefault(); if (peripherial == null) { var systemPeripherials = _centralManager.RetrieveConnectedPeripherals(new CBUUID[0]); #if __IOS__ var cbuuid = CBUUID.FromNSUuid(uuid); #endif peripherial = systemPeripherials.SingleOrDefault(p => #if __IOS__ p.UUID.Equals(cbuuid) #else p.Identifier.Equals(uuid) #endif ); if (peripherial == null) { throw new Exception($"[Adapter] Device {deviceGuid} not found."); } } var device = new Device(this, peripherial, _bleCentralManagerDelegate, peripherial.Name, peripherial.RSSI?.Int32Value ?? 0, new List <AdvertisementRecord>()); await ConnectToDeviceAsync(device, connectParameters, cancellationToken); return(device); }
public Network GetNetwork(NSUuid uuid) => GetNetwork(uuid.ToString());
/// <summary> /// Connects to known device async. /// /// https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/BestPracticesForInteractingWithARemotePeripheralDevice/BestPracticesForInteractingWithARemotePeripheralDevice.html /// /// </summary> /// <returns>The to known device async.</returns> /// <param name="deviceGuid">Device GUID.</param> public override async Task<IDevice> ConnectToKnownDeviceAsync(Guid deviceGuid, CancellationToken cancellationToken = default(CancellationToken)) { // Wait for the PoweredOn state await WaitForState(CBCentralManagerState.PoweredOn, cancellationToken, true); if (cancellationToken.IsCancellationRequested) throw new TaskCanceledException("ConnectToKnownDeviceAsync cancelled"); //ToDo attempted to use tobyte array insetead of string but there was a roblem with byte ordering Guid->NSUui var uuid = new NSUuid(deviceGuid.ToString()); Trace.Message($"[Adapter] Attempting connection to {uuid.ToString()}"); var peripherials = _centralManager.RetrievePeripheralsWithIdentifiers(uuid); var peripherial = peripherials.SingleOrDefault(); if (peripherial == null) { var systemPeripherials = _centralManager.RetrieveConnectedPeripherals(new CBUUID[0]); var cbuuid = CBUUID.FromNSUuid(uuid); peripherial = systemPeripherials.SingleOrDefault(p => p.UUID.Equals(cbuuid)); if (peripherial == null) throw new Exception($"[Adapter] Device {deviceGuid} not found."); } var device = new Device(this, peripherial, peripherial.Name, peripherial.RSSI?.Int32Value ?? 0, new List<AdvertisementRecord>()); await ConnectToDeviceAsync(device, false, cancellationToken); return device; }