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> >(); }
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) )); }
public GattServerContext(AndroidContext context) { this.Context = context; this.Manager = context.GetBluetooth(); }