Example #1
0
        public CentralContext(IServiceProvider serviceProvider, AndroidContext context, BleCentralConfiguration config)
        {
            this.Android       = context;
            this.Configuration = config;
            this.Manager       = context.GetBluetooth();

            this.sdelegate         = new Lazy <IBleCentralDelegate>(() => serviceProvider.Resolve <IBleCentralDelegate>());
            this.devices           = new ConcurrentDictionary <string, IPeripheral>();
            this.statusSubject     = new Subject <AccessState>();
            this.peripheralSubject = new Subject <NamedMessage <IPeripheral> >();
        }
Example #2
0
        public CentralContext(IServiceProvider serviceProvider,
                              AndroidContext context,
                              IMessageBus messageBus,
                              BleCentralConfiguration config)
        {
            this.Android       = context;
            this.Configuration = config;
            this.Manager       = context.GetBluetooth();

            this.sdelegate         = new Lazy <IBleCentralDelegate>(() => serviceProvider.Resolve <IBleCentralDelegate>());
            this.devices           = new ConcurrentDictionary <string, Peripheral>();
            this.peripheralSubject = new Subject <NamedMessage <Peripheral> >();
            this.messageBus        = messageBus;

            this.StatusChanged
            .Skip(1)
            .SubscribeAsync(status => Log.SafeExecute(
                                async() => await this.sdelegate.Value?.OnAdapterStateChanged(status)
                                ));
        }
Example #3
0
 public GattServerContext(AndroidContext context)
 {
     this.Context = context;
     this.Manager = context.GetBluetooth();
 }