diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2021-11-13 09:54:42 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2021-11-13 09:54:42 +0300 |
commit | f02ea6d5655d9f5f7f3a3b855d6803c5b3eab987 (patch) | |
tree | 8f972e0fcce99c69577c5dfa9546512bd9ec56aa | |
parent | 2b2f1480e69e4631b93b60254baecffbd61ebfc2 (diff) |
Typo fix and C# version update
-rw-r--r-- | TuyaCommand.cs | 2 | ||||
-rw-r--r-- | TuyaDevice.cs | 8 | ||||
-rw-r--r-- | TuyaNet.csproj | 1 | ||||
-rw-r--r-- | TuyaParser.cs | 2 |
4 files changed, 4 insertions, 9 deletions
diff --git a/TuyaCommand.cs b/TuyaCommand.cs index 720edfb..52a93b4 100644 --- a/TuyaCommand.cs +++ b/TuyaCommand.cs @@ -22,7 +22,7 @@ ENABLE_WIFI = 14,
DP_QUERY_NEW = 16,
SCENE_EXECUTE = 17,
- UPDATED_PS = 18,
+ UPDATE_DPS = 18,
UDP_NEW = 19,
AP_CONFIG_NEW = 20,
GET_LOCAL_TIME_CMD = 28,
diff --git a/TuyaDevice.cs b/TuyaDevice.cs index d0d5c52..bd84ec1 100644 --- a/TuyaDevice.cs +++ b/TuyaDevice.cs @@ -147,13 +147,7 @@ namespace com.clusterrr.TuyaNet await stream.WriteAsync(data, 0, data.Length).ConfigureAwait(false);
return await Receive(stream, nullRetries);
}
- catch (IOException ex)
- {
- // sockets sometimes drop the connection unexpectedly, so let's
- // retry at least once
- lastException = ex;
- }
- catch (TimeoutException ex)
+ catch (Exception ex) when (ex is IOException or TimeoutException)
{
// sockets sometimes drop the connection unexpectedly, so let's
// retry at least once
diff --git a/TuyaNet.csproj b/TuyaNet.csproj index 6bd1b03..9884672 100644 --- a/TuyaNet.csproj +++ b/TuyaNet.csproj @@ -14,6 +14,7 @@ <RepositoryType>Git</RepositoryType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
+ <LangVersion>9.0</LangVersion>
</PropertyGroup>
<ItemGroup>
diff --git a/TuyaParser.cs b/TuyaParser.cs index c8b87b3..3d86419 100644 --- a/TuyaParser.cs +++ b/TuyaParser.cs @@ -69,7 +69,7 @@ namespace com.clusterrr.TuyaNet // Encrypt
payload = Encrypt(payload, key);
// Add protocol 3.3 header
- if ((command != TuyaCommand.DP_QUERY) && (command != TuyaCommand.UPDATED_PS))
+ if ((command != TuyaCommand.DP_QUERY) && (command != TuyaCommand.UPDATE_DPS))
payload = Enumerable.Concat(PROTOCOL_33_HEADER, payload).ToArray();
}
else if (command == TuyaCommand.CONTROL)
|