![]() |
VOOZH | about |
dotnet add package Smdn.TPSmartHomeDevices.MacAddressEndPoint --version 1.2.0
NuGet\Install-Package Smdn.TPSmartHomeDevices.MacAddressEndPoint -Version 1.2.0
<PackageReference Include="Smdn.TPSmartHomeDevices.MacAddressEndPoint" Version="1.2.0" />
<PackageVersion Include="Smdn.TPSmartHomeDevices.MacAddressEndPoint" Version="1.2.0" />Directory.Packages.props
<PackageReference Include="Smdn.TPSmartHomeDevices.MacAddressEndPoint" />Project file
paket add Smdn.TPSmartHomeDevices.MacAddressEndPoint --version 1.2.0
#r "nuget: Smdn.TPSmartHomeDevices.MacAddressEndPoint, 1.2.0"
#:package Smdn.TPSmartHomeDevices.MacAddressEndPoint@1.2.0
#addin nuget:?package=Smdn.TPSmartHomeDevices.MacAddressEndPoint&version=1.2.0Install as a Cake Addin
#tool nuget:?package=Smdn.TPSmartHomeDevices.MacAddressEndPoint&version=1.2.0Install as a Cake Tool
Smdn.TPSmartHomeDevices.MacAddressEndPoint is an extension library for the Smdn.TPSmartHomeDevices.Tapo and Smdn.TPSmartHomeDevices.Kasa
that enables to use MAC addresses to specify the device endpoints, instead of IP addresses or host names.
This library also enables to support following changes of the device endpoint in network where IP addresses are dynamic, such as networks using DHCP.
Add MacAddressDeviceEndPointFactory to the ServiceCollection and pass it as an IServiceProvider to the constructor of the Tapo or Kasa device class.
using System.Net.NetworkInformation;
using Microsoft.Extensions.DependencyInjection;
using Smdn.Net;
using Smdn.TPSmartHomeDevices;
using Smdn.TPSmartHomeDevices.Tapo;
var services = new ServiceCollection();
// By creating a MacAddressDeviceEndPointFactory and adding it with the
// AddDeviceEndPointFactory method, you can enable MAC address endpoint resolution.
// This can be applied to Kasa devices as well as Tapo devices.
services.AddDeviceEndPointFactory(
new MacAddressDeviceEndPointFactory(
// Select and use the network of the interface with ID 'wlan0'
IPNetworkProfile.CreateFromNetworkInterface(id: "wlan0")
)
);
var serviceProvider = services.BuildServiceProvider();
// Creates device controller for Tapo L530 multicolor light bulb.
using var bulb = new L530(
PhysicalAddress.Parse("00:00:5E:00:53:00"), // MAC address assigned to L530
"user@mail.test", // E-mail address for your Tapo account
"password", // Password for your Tapo account
serviceProvider // IServiceProvider that has a MacAddressDeviceEndPointFactory added
);
try {
// Turns on the bulb, and set the color temperature and brightness.
await bulb.SetColorTemperatureAsync(colorTemperature: 5500, brightness: 80);
// Turns off the bulb
await bulb.TurnOffAsync();
}
catch (DeviceEndPointResolutionException ex) {
// If the endpoint cannot be resolved, a DeviceEndPointResolutionException is thrown.
Console.Error.WriteLine(ex);
// In this example, address resolution is based on information cached in the
// system's address table (ARP table).
// If there is no IP address corresponding to the MAC address in the cache,
// address resolution will fail.
// The MacAddressResolver that MacAddressDeviceEndPointFactory uses internally
// supports network scanning to perform address table updates prior to address resolution.
// Documents for enabling network scanning with the MacAddressDeviceEndPointFactory
// will be added in the future.
// In MacAddressResolver, network scanning can be enabled by setting the
// properties NetworkScanInterval and NetworkScanMinInterval.
// See the MacAddressResolver documentation for detail.
// https://github.com/smdn/Smdn.Net.AddressResolution/blob/main/examples/network-scanning/Program.cs
}
More examples can be found on the GitHub repository.
This project welcomes contributions, feedbacks and suggestions. You can contribute to this project by submitting Issues or Pull Requests on the GitHub repository.
This project is licensed under the GNU GPL version 3 or later.
This project includes source code licensed under MIT or GPLv3 as described below and produces artifacts licensed in accordance therewith.
The some source files in the directory under the src/Smdn.TPSmartHomeDevices.Tapo/ include codes that has been ported from codes which licensed under the GPLv3, and are licensed under the GNU GPL version 3 or later.
Therefore, artifacts from this directory, including NuGet package Smdn.TPSmartHomeDevices.Tapo, are released under the GNU GPL version 3 or later.
For the license of individual files, refer to SPDX-License-Identifier at the top of each file header.
The source files and generated artifacts from the directory under the src/, excluding Smdn.TPSmartHomeDevices.Tapo, are licensed and released under the terms of the MIT License.
(An English translation for the reference follows the text written in Japanese.)
本プロジェクトは、TP-Linkとは無関係の非公式なものです。
This is an unofficial project that has no affiliation with TP-Link.
本プロジェクトが提供するソフトウェアは、デバイスの設定の取得・変更等、製品仕様の範囲内での操作のみを行うものであり、ファームウェアの改変・修正および製品の改造や製品仕様の変更を引き起こさないものの、製品使用上の許諾事項に抵触する可能性は否定できないため、使用の際はその点にご留意ください。
The software provided by this project is intended only for operations within the scope of the product specifications, such as acquiring and changing device settings, and while it does not cause altering the product itself, product's firmware or operating specifications. Nevertheless, please note that the possibility of violating terms of use of the product cannot be dismissed when using the software provided by this project.
Tapo、Kasa、および各製品名の著作権はTP-Linkに帰属します。
Tapo, Kasa and all respective product names are copyright of TP-Link.
This project incorporates implementations partially ported from the following projects. See also ThirdPartyNotices.md for detail.
List of APIs exposed by assembly Smdn.TPSmartHomeDevices.MacAddressEndPoint-1.2.0 (net8.0)
// Smdn.TPSmartHomeDevices.MacAddressEndPoint.dll (Smdn.TPSmartHomeDevices.MacAddressEndPoint-1.2.0)
// Name: Smdn.TPSmartHomeDevices.MacAddressEndPoint
// AssemblyVersion: 1.2.0.0
// InformationalVersion: 1.2.0+66f3966f8c2864562a16625b12052994056bc7d3
// TargetFramework: .NETCoreApp,Version=v8.0
// Configuration: Release
// Metadata: IsTrimmable=True
// Metadata: RepositoryUrl=https://github.com/smdn/Smdn.TPSmartHomeDevices
// Metadata: RepositoryBranch=main
// Metadata: RepositoryCommit=66f3966f8c2864562a16625b12052994056bc7d3
// Referenced assemblies:
// Smdn.Net.AddressResolution, Version=1.0.0.0, Culture=neutral
// Smdn.TPSmartHomeDevices.Primitives, Version=1.1.1.0, Culture=neutral
// System.ComponentModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Net.NetworkInformation, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Net.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
#nullable enable annotations
using System;
using System.Net;
using System.Net.NetworkInformation;
using System.Threading;
using System.Threading.Tasks;
using Smdn.Net;
using Smdn.Net.AddressResolution;
using Smdn.TPSmartHomeDevices;
namespace Smdn.TPSmartHomeDevices {
public class MacAddressDeviceEndPointFactory :
IDeviceEndPointFactory<PhysicalAddress>,
IDisposable
{
protected class MacAddressDeviceEndPoint : IDynamicDeviceEndPoint {
public MacAddressDeviceEndPoint(IAddressResolver<PhysicalAddress, IPAddress> resolver, PhysicalAddress address) {}
public void Invalidate() {}
public async ValueTask<EndPoint?> ResolveAsync(CancellationToken cancellationToken) {}
public override string ToString() {}
}
[Obsolete("Use an overload that specifies the parameter `shouldDisposeResolver`.")]
protected MacAddressDeviceEndPointFactory(IAddressResolver<PhysicalAddress, IPAddress> resolver, IServiceProvider? serviceProvider = null) {}
protected MacAddressDeviceEndPointFactory(IAddressResolver<PhysicalAddress, IPAddress> resolver, bool shouldDisposeResolver, IServiceProvider? serviceProvider) {}
public MacAddressDeviceEndPointFactory(IPNetworkProfile networkProfile, IServiceProvider? serviceProvider = null) {}
public MacAddressDeviceEndPointFactory(IPNetworkProfile networkProfile, TimeSpan networkScanInterval, TimeSpan networkScanMinInterval, IServiceProvider? serviceProvider = null) {}
[Obsolete("Use an overload that specifies the parameter `shouldDisposeResolver`.")]
public MacAddressDeviceEndPointFactory(MacAddressResolverBase resolver, IServiceProvider? serviceProvider = null) {}
public MacAddressDeviceEndPointFactory(MacAddressResolverBase resolver, bool shouldDisposeResolver, IServiceProvider? serviceProvider = null) {}
public virtual IDeviceEndPoint Create(PhysicalAddress address) {}
protected virtual void Dispose(bool disposing) {}
public void Dispose() {}
protected void ThrowIfDisposed() {}
}
}
// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.7.1.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.5.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on Smdn.TPSmartHomeDevices.MacAddressEndPoint:
| Package | Downloads |
|---|---|
|
Smdn.TPSmartHomeDevices
A meta package that addes the dependency of Smdn.TPSmartHomeDevices.Kasa, Smdn.TPSmartHomeDevices.Tapo and Smdn.TPSmartHomeDevices.MacAddressEndPoint. |
This package is not used by any popular GitHub repositories.