예제 #1
0
파일: BleDevice.cs 프로젝트: windoze/blego
        protected async Task Initialize()
        {
            await _device.WaitForPropertyValueAsync("Connected", value : true, TIMEOUT);

            _properties = await _device.GetAllAsync();

            Log.Debug("Waiting for services to resolve...");
            await _device.WaitForPropertyValueAsync("ServicesResolved", value : true, TIMEOUT);

            foreach (var s in await _device.GetUUIDsAsync())
            {
                var g   = Guid.Parse(s);
                var svc = await _device.GetServiceAsync(s);

                _services[Guid.Parse(s)] = svc;
                if (g == DEVICE_INFORMATION_SERVICE)
                {
                    Log.Debug("Found DeviceInformationService.");
                    DeviceInformationService = new DeviceInformationService(svc);
                }
                else if (g == BATTERY_SERVICE)
                {
                    Log.Debug("Found BatteryService.");
                    BatteryService = new BatteryService(svc);
                }
            }

            Log.Debug("Services resolved.");

            await BleDeviceConnected();

            Log.Information($"Connected to {this}.");
        }
예제 #2
0
        protected override IMvxApplication CreateApp()
        {
            var storage    = new LocalStorageContainer();
            var keyStorage = new LocalKeyStorageContainer(storage);
            var deviceInformationService = new DeviceInformationService();

            return(new App(keyStorage, storage, null, deviceInformationService));
        }
예제 #3
0
        protected override IMvxApplication CreateApp()
        {
            Mvx.ConstructAndRegisterSingleton <IMvxJsonConverter, JsonSerializer>();
            var preferencesManager       = new PreferencesManager();
            var storageContainer         = new LocalStorageContainer();
            var keyStorage               = new LocalKeyStorageContainer(storageContainer);
            var deviceInformationService = new DeviceInformationService();

            return(new Client.Shared.App(keyStorage, storageContainer, preferencesManager, deviceInformationService));
        }
예제 #4
0
 public DeviceInformationPage(DeviceInformationService service)
 {
     InitializeComponent();
     _service       = service;
     BindingContext = _service;
 }