-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Smdn.TPSmartHomeDevices.Tapo.csproj
111 lines (93 loc) · 5.46 KB
/
Smdn.TPSmartHomeDevices.Tapo.csproj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!--
SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp>
SPDX-License-Identifier: MIT
-->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0;netstandard2.1</TargetFrameworks>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<PackageValidationBaselineVersion>2.0.0</PackageValidationBaselineVersion>
<RootNamespace/> <!-- empty the root namespace so that the namespace is determined only by the directory name, for code style rule IDE0030 -->
<Nullable>enable</Nullable>
<DefineConstants
Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '7.0.0'))"
>$(DefineConstants);LANG_VERSION_11_OR_GREATER</DefineConstants> <!-- required to use the UTF-8 string literals and the extended nameof scope in C# 11 -->
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
</PropertyGroup>
<PropertyGroup>
<NoWarn>CA1848;$(NoWarn)</NoWarn> <!-- CA1848: For improved performance, use the LoggerMessage delegates instead of calling 'LoggerExtensions.LogXxxxx(...)' -->
<NoWarn>CS1591;$(NoWarn)</NoWarn> <!-- CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' -->
</PropertyGroup>
<PropertyGroup Label="assembly attributes">
<Description>Provides APIs for operating Tapo devices, the TP-Link smart home devices.</Description>
<CopyrightYear>2023</CopyrightYear>
</PropertyGroup>
<PropertyGroup Label="package properties">
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
<PackageTags>tplink-tapo,tapo,L530,L900,P105,P110M,$(PackageCommonTags)</PackageTags>
<GenerateNupkgReadmeFileDependsOnTargets>$(GenerateNupkgReadmeFileDependsOnTargets);GenerateReadmeFileContent</GenerateNupkgReadmeFileDependsOnTargets>
</PropertyGroup>
<PropertyGroup Label="StyleCop code analysis">
<StyleCopAnalyzersConfigurationFile>..\stylecop.json</StyleCopAnalyzersConfigurationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Smdn.Fundamental.PrintableEncoding.Hexadecimal" Version="3.0.1" Condition="$(TargetFramework.StartsWith('netstandard'))" /> <!-- for alternative of System.Convert.ToHexString -->
<ProjectOrPackageReference ReferencePackageVersion="1.1.0" Include="..\Smdn.TPSmartHomeDevices.Primitives\Smdn.TPSmartHomeDevices.Primitives.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Common\Smdn.TPSmartHomeDevices\None.cs" />
<Compile Include="..\Common\Smdn.TPSmartHomeDevices\ServiceProviderExtensions.cs" />
<Compile Include="..\Common\System.Runtime.CompilerServices\IsExternalInit.cs" />
<Compile Include="..\Common\System.Security.Cryptography\AsymmetricAlgorithmShim.cs" />
</ItemGroup>
<ItemGroup>
<!-- COPYING.txt -->
<None
Include="$(MSBuildThisFileDirectory)..\..\COPYING.txt"
Visible="false"
Pack="true"
PackagePath="COPYING.txt"
CopyToOutputDirectory="None"
/>
<!-- Third party notice -->
<None
Include="$(MSBuildThisFileDirectory)..\..\ThirdPartyNotices.md"
Pack="true"
PackagePath="ThirdPartyNotices.md"
CopyToOutputDirectory="None"
/>
</ItemGroup>
<Target Name="GenerateReadmeFileContent" DependsOnTargets="ReadReadmeFileNoticeSectionContent">
<PropertyGroup>
<PackageReadmeFileContent><![CDATA[# $(PackageId) $(PackageVersion)
`$(PackageId)` is a library that provides APIs for operating Tapo, the TP-Link smart home devices.
This library performs operations by communicating directly with Tapo devices in the same network. Remote operation via the Internet is not supported.
This library also provides following features:
- Support for both older protocol (`securePassthrough`) and newer protocol (`KLAP`). The protocol selection is automatically performed according to the firmware of the target device.
- Automatic connection/authentication/session management, including reconnection and re-authentication.
- Built-in/customizable error handling for typical errors and retries (like device busy, session expired, request timeout).
- Using MAC address and following IP address change in DHCP networks (requires [Smdn.TPSmartHomeDevices.MacAddressEndPoint](https://www.nuget.org/packages/Smdn.TPSmartHomeDevices.MacAddressEndPoint/)).
- `async` operation and cancellation.
## Getting started
First, add package `$(PackageId)` to the project file.
```
dotnet add package $(PackageId)
```
To operate the Tapo device, write code like the following. Replace the Tapo device's IP address and Tapo account information with yours.
```cs
$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)..\..\examples\$(PackageId)\GettingStarted\Program.cs').TrimEnd())
```
More examples can be found on the [GitHub repository]($(RepositoryUrl)/tree/main/examples/$(PackageId)/), including examples of using other Tapo devices and their functionalities, and examples of using library features.
## Contributing
This project welcomes contributions, feedbacks and suggestions. You can contribute to this project by submitting [Issues]($(RepositoryUrl)/issues/new/choose) or [Pull Requests]($(RepositoryUrl)/pulls/) on the [GitHub repository]($(RepositoryUrl)).
## Notice
$(ReadmeFileNoticeSectionContent)
]]></PackageReadmeFileContent>
</PropertyGroup>
</Target>
</Project>