Exemplo n.º 1
0
        internal BleDevice(BGLib bgLib, BleModuleConnection bleModuleConnection, ILogger logger, byte connectionHandle, byte[] address, BleAddressType addressType, List <BleService> services)
        {
            _bgLib = bgLib;
            _bleModuleConnection = bleModuleConnection;
            _logger           = logger;
            _connectionHandle = connectionHandle;

            Address     = address;
            AddressType = addressType;
            Services    = services;

            services.ForEach(service =>
            {
                service.Characteristics.ForEach(characteristic =>
                {
                    CharacteristicsByUuid.Add(characteristic.Uuid, characteristic);
                });
            });

            services.ForEach(service =>
            {
                service.Characteristics.ForEach(characteristic =>
                {
                    CharacteristicsByHandle.Add(characteristic.Handle, characteristic);
                });
            });

            _bgLib.BLEEventATTClientAttributeValue += OnClientAttributeValue;
            _bgLib.BLEEventConnectionDisconnected  += OnDisconnected;

            IsConnected = true;
        }
Exemplo n.º 2
0
 internal BleCharacteristic(BGLib bgLib, BleModuleConnection bleModuleConnection, ILogger logger, byte connection, byte[] uuid, ushort handle)
 {
     _bgLib = bgLib;
     _bleModuleConnection = bleModuleConnection;
     _logger     = logger;
     _connection = connection;
     Uuid        = uuid.ToBleGuid();
     Handle      = handle;
 }
Exemplo n.º 3
0
 public BleDeviceManager(BGLib bgLib, BleModuleConnection bleModuleConnection, ILogger <BleDevice> logger = null)
 {
     _bgLib = bgLib;
     _bleModuleConnection = bleModuleConnection;
     _logger = logger;
 }
Exemplo n.º 4
0
 public BleDeviceDiscovery(BGLib bgLib, BleModuleConnection bleModuleConnection, ILogger <BleDeviceDiscovery> logger = null)
 {
     _bgLib = bgLib;
     _bleModuleConnection = bleModuleConnection;
     _logger = logger;
 }