示例#1
0
        public CentralContext(IServiceProvider services, BleConfiguration config)
        {
            if (!PlatformExtensions.HasPlistValue("NSBluetoothPeripheralUsageDescription"))
            {
                Console.WriteLine("NSBluetoothPeripheralUsageDescription needs to be set - you will likely experience a native crash after this log");
            }

            if (!PlatformExtensions.HasPlistValue("NSBluetoothAlwaysUsageDescription", 13))
            {
                Console.WriteLine("NSBluetoothAlwaysUsageDescription needs to be set - you will likely experience a native crash after this log");
            }

            this.services = services;

            var opts = new CBCentralInitOptions
            {
                ShowPowerAlert = config.iOSShowPowerAlert
            };

            if (!config.iOSRestoreIdentifier.IsEmpty())
            {
                opts.RestoreIdentifier = config.iOSRestoreIdentifier;
            }

            this.Manager = new CBCentralManager(this, null, opts);
        }
示例#2
0
 public BleShinyModule(BleConfiguration config) => this.config = config ?? new BleConfiguration();