Skip to content

Commit

Permalink
ConfigureAwait (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjorgo authored Dec 15, 2024
1 parent 104a7d2 commit 663b11b
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 74 deletions.
14 changes: 7 additions & 7 deletions src/HeboTech.ATLib.Modems/Adafruit/Fona3G.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ public Fona3G(IAtChannel channel)

public override async Task<bool> SetRequiredSettingsBeforePinAsync()
{
ModemResponse echo = await DisableEchoAsync();
ModemResponse errorFormat = await SetErrorFormatAsync(1);
ModemResponse echo = await DisableEchoAsync().ConfigureAwait(false);
ModemResponse errorFormat = await SetErrorFormatAsync(1).ConfigureAwait(false);
return echo.Success && errorFormat.Success;
}

public override async Task<bool> SetRequiredSettingsAfterPinAsync()
{
ModemResponse currentCharacterSet = await SetCharacterSetAsync(CharacterSet.UCS2);
ModemResponse smsMessageFormat = await SetSmsMessageFormatAsync(SmsTextFormat.PDU);
ModemResponse currentCharacterSet = await SetCharacterSetAsync(CharacterSet.UCS2).ConfigureAwait(false);
ModemResponse smsMessageFormat = await SetSmsMessageFormatAsync(SmsTextFormat.PDU).ConfigureAwait(false);
return currentCharacterSet.Success && smsMessageFormat.Success;
}

Expand All @@ -37,7 +37,7 @@ public override async Task<bool> SetRequiredSettingsAfterPinAsync()
// switch (smsTextFormat)
// {
// case SmsTextFormat.PDU:
// AtResponse pduResponse = await channel.SendMultilineCommand($"AT+CMGR={index}", null);
// AtResponse pduResponse = await channel.SendMultilineCommand($"AT+CMGR={index}", null).ConfigureAwait(false);

// if (pduResponse.Success)
// {
Expand All @@ -60,7 +60,7 @@ public override async Task<bool> SetRequiredSettingsAfterPinAsync()
// }
// break;
// case SmsTextFormat.Text:
// AtResponse textResponse = await channel.SendMultilineCommand($"AT+CMGR={index}", null);
// AtResponse textResponse = await channel.SendMultilineCommand($"AT+CMGR={index}", null).ConfigureAwait(false);

// if (textResponse.Success && textResponse.Intermediates.Count > 0)
// {
Expand Down Expand Up @@ -114,7 +114,7 @@ public override async Task<bool> SetRequiredSettingsAfterPinAsync()
// _ => throw new Exception("Unknown SMS Text Format")
// };

// AtResponse response = await channel.SendMultilineCommand(command, null);
// AtResponse response = await channel.SendMultilineCommand(command, null).ConfigureAwait(false);

// List<SmsWithIndex> smss = new List<SmsWithIndex>();
// if (response.Success)
Expand Down
8 changes: 4 additions & 4 deletions src/HeboTech.ATLib.Modems/Cinterion/MC55i.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public override async Task<IEnumerable<ModemResponse<SmsReference>>> SendSmsAsyn
{
string cmd1 = $"AT+CMGS={(pdu.Length - 2) / 2}"; // Subtract 2 (one octet) for SMSC.
string cmd2 = pdu;
AtResponse response = await channel.SendSmsAsync(cmd1, cmd2, "+CMGS:", TimeSpan.FromSeconds(30));
AtResponse response = await channel.SendSmsAsync(cmd1, cmd2, "+CMGS:", TimeSpan.FromSeconds(30)).ConfigureAwait(false);

if (response.Success)
{
Expand All @@ -59,7 +59,7 @@ public override async Task<IEnumerable<ModemResponse<SmsReference>>> SendSmsAsyn

public override async Task<ModemResponse<BatteryStatus>> GetBatteryStatusAsync()
{
AtResponse response = await channel.SendSingleLineCommandAsync("AT^SBC?", "^SBC:");
AtResponse response = await channel.SendSingleLineCommandAsync("AT^SBC?", "^SBC:").ConfigureAwait(false);

if (response.Success)
{
Expand All @@ -79,7 +79,7 @@ public override async Task<ModemResponse<BatteryStatus>> GetBatteryStatusAsync()

public async Task<ModemResponse<MC55iBatteryStatus>> MC55i_GetBatteryStatusAsync()
{
AtResponse response = await channel.SendSingleLineCommandAsync("AT^SBC?", "^SBC:");
AtResponse response = await channel.SendSingleLineCommandAsync("AT^SBC?", "^SBC:").ConfigureAwait(false);

if (response.Success)
{
Expand Down Expand Up @@ -109,7 +109,7 @@ public async Task<ModemResponse<MC55iBatteryStatus>> MC55i_GetBatteryStatusAsync
/// <returns>Command status</returns>
public override async Task<ModemResponse> SetNewSmsIndicationAsync(int mode, int mt, int bm, int ds, int bfr)
{
AtResponse response = await channel.SendCommand($"AT+CNMI={mode},{mt},{bm},{ds}");
AtResponse response = await channel.SendCommand($"AT+CNMI={mode},{mt},{bm},{ds}").ConfigureAwait(false);

if (response.Success)
return ModemResponse.IsSuccess();
Expand Down
Loading

0 comments on commit 663b11b

Please sign in to comment.