-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using IoTEdge; | ||
using NewLife.Log; | ||
|
||
namespace IoTZero.Clients; | ||
|
||
/// <summary>客户端测试入口。主程序通过反射调用</summary> | ||
public static class ClientTest | ||
{ | ||
private static ITracer _tracer; | ||
private static HttpDevice _device; | ||
|
||
public static async Task Main(IServiceProvider serviceProvider) | ||
{ | ||
await Task.Delay(3_000); | ||
|
||
XTrace.WriteLine("开始IoT客户端测试"); | ||
|
||
_tracer = serviceProvider.GetService<ITracer>(); | ||
|
||
var set = ClientSetting.Current; | ||
|
||
// 产品编码、产品密钥从IoT管理平台获取,设备编码支持自动注册 | ||
var device = new HttpDevice(set) | ||
{ | ||
Tracer = _tracer, | ||
Log = XTrace.Log, | ||
}; | ||
|
||
await device.LoginAsync(); | ||
|
||
_device = device; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters