提交 59d8c2d0 编写于 作者: 麦壳饼's avatar 麦壳饼

修正rpc 以及 许可路径

上级 7b89dcb2
......@@ -22,6 +22,7 @@ namespace IoTSharp.Extensions
private readonly ConcurrentDictionary<string, TaskCompletionSource<byte[]>> _waitingCalls = new ConcurrentDictionary<string, TaskCompletionSource<byte[]>>();
private readonly IMqttClient _mqttClient;
private IMqttClientOptions _mqtt;
private bool disposedValue;
public RpcClient(IMqttClient mqttClient)
{
......@@ -35,8 +36,8 @@ namespace IoTSharp.Extensions
_mqtt = mqtt;
}
public Task<byte[]> ExecuteAsync(TimeSpan timeout, string deviceid, string methodName, string payload, MqttQualityOfServiceLevel qualityOfServiceLevel)
{
return ExecuteAsync(timeout, deviceid, methodName, Encoding.UTF8.GetBytes(payload), qualityOfServiceLevel, CancellationToken.None);
......@@ -133,15 +134,7 @@ namespace IoTSharp.Extensions
tcs.TrySetResult(eventArgs.ApplicationMessage.Payload);
}
public void Dispose()
{
foreach (var tcs in _waitingCalls)
{
tcs.Value.SetCanceled();
}
_waitingCalls.Clear();
}
public async Task ConnectAsync()
{
......@@ -152,5 +145,33 @@ namespace IoTSharp.Extensions
{
await _mqttClient.DisconnectAsync();
}
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
foreach (var tcs in _waitingCalls)
{
tcs.Value.SetCanceled();
}
_waitingCalls.Clear();
}
// TODO: 释放未托管的资源(未托管的对象)并替代终结器
// TODO: 将大型字段设置为 null
disposedValue = true;
}
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
}
}
......@@ -128,13 +128,5 @@
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="..\LICENSE.txt">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="LICENSE.txt">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -527,6 +527,12 @@
用户名密码
</summary>
</member>
<member name="M:IoTSharp.IoTSharpExtension.CheckOrUpdateDevStatus(IoTSharp.Data.Device)">
<summary>
//如果上次活动时间距离当前时间超过10秒 或者 设备离线状态, 则更新状态。
</summary>
<param name="device"></param>
</member>
<member name="T:IoTSharp.Handlers.EventBusHandler">
<summary>
iotsharp.services.datastream
......
MIT License
Copyright (c) 2018-2020 IoT#
Copyright (c) 2018-2020 IoTSahrp Maikebing(Yanhong Ma)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册