public BGLibApi(ISerialDevice serialDevice) { _serialDevice = serialDevice; if (!_serialDevice.IsAttached) { serialDevice.AttachAsync(256000).GetAwaiter().GetResult(); } _bglib = new BGLib(_serialDevice); StartSerialRxConsumerTask(); _serialDevice.DataReceived += Serial_DataReceived; SubscribeToCommandResponses(); SubscribeToEvents(); }