Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/tuyanet.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-11-13 09:54:42 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-11-13 09:54:42 +0300
commitf02ea6d5655d9f5f7f3a3b855d6803c5b3eab987 (patch)
tree8f972e0fcce99c69577c5dfa9546512bd9ec56aa
parent2b2f1480e69e4631b93b60254baecffbd61ebfc2 (diff)
Typo fix and C# version update
-rw-r--r--TuyaCommand.cs2
-rw-r--r--TuyaDevice.cs8
-rw-r--r--TuyaNet.csproj1
-rw-r--r--TuyaParser.cs2
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)