public async Task Initialize() { _name = null; var data = await _conn.ReadAsync(CHAR_NAME_R); if (data != null) { _name = Encoding.ASCII.GetString(data); int index = _name.IndexOf('\0'); if (index > 0) { _name = _name.Substring(0, index); } } }
/// <summary> /// Retrieve the current battery state. /// </summary> /// <returns>Current battery state</returns> public async Task <BatteryState> ReadAsync() { return(ParseMessage(await _conn.ReadAsync(CHAR_VOLTAGE))); }