示例#1
0
        protected override async Task DoExecuteAsync()
        {
            if (_deviceController.ConnectedDevice == null)
            {
                throw new InvalidOperationException("Device not connected.");
            }

            if (_deviceController.ConnectedDevice.DeviceId != _serviceInfo.Device.DeviceId)
            {
                throw new InvalidOperationException("Command executed against not connected device.");
            }

            // ToDo: cache services on controller
            var characteristics = _deviceController.ConnectedDevice.GetGattService(_serviceInfo.Uuid).GetAllCharacteristics().ToList();

            Characteristics = await _infoManager.GetAllCharacteristicsInfo(_serviceInfo, characteristics);
        }