Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IoTSharp
IoTSharp
提交
8f29aedb
IoTSharp
项目概览
IoTSharp
/
IoTSharp
12 个月 前同步成功
通知
15
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
IoTSharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8f29aedb
编写于
9月 08, 2022
作者:
麦壳饼
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
重构
上级
d77d7848
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
90 addition
and
90 deletion
+90
-90
IoTSharp/Extensions/MqttExtension.cs
IoTSharp/Extensions/MqttExtension.cs
+2
-3
IoTSharp/IoTSharp.csproj
IoTSharp/IoTSharp.csproj
+1
-0
IoTSharp/Services/CoAPService.cs
IoTSharp/Services/CoAPService.cs
+1
-0
IoTSharp/Services/CoApResources/CoAPResource.cs
IoTSharp/Services/CoApResources/CoAPResource.cs
+3
-3
IoTSharp/Services/MQTTService.cs
IoTSharp/Services/MQTTService.cs
+83
-84
未找到文件。
IoTSharp/Extensions/MqttExtension.cs
浏览文件 @
8f29aedb
...
...
@@ -8,7 +8,6 @@ using Microsoft.Extensions.DependencyInjection;
using
Microsoft.AspNetCore.Builder
;
using
MQTTnet.AspNetCore
;
using
MQTTnet.Diagnostics
;
using
IoTSharp.Handlers
;
using
IoTSharp.Services
;
using
MQTTnet.Server
;
using
System.Diagnostics
;
...
...
@@ -51,11 +50,11 @@ namespace IoTSharp
}).
AddMqttConnectionHandler
()
.
AddConnections
();
services
.
AddMqttWebSocketServerAdapter
();
services
.
AddSingleton
<
MQTTServ
erHandler
>();
services
.
AddSingleton
<
MQTTServ
ice
>();
}
public
static
void
UseIotSharpMqttServer
(
this
IApplicationBuilder
app
)
{
var
mqttEvents
=
app
.
ApplicationServices
.
CreateScope
().
ServiceProvider
.
GetService
<
MQTTServ
erHandler
>();
var
mqttEvents
=
app
.
ApplicationServices
.
CreateScope
().
ServiceProvider
.
GetService
<
MQTTServ
ice
>();
app
.
UseMqttServer
(
server
=>
{
server
.
ClientConnectedAsync
+=
mqttEvents
.
Server_ClientConnectedAsync
;
...
...
IoTSharp/IoTSharp.csproj
浏览文件 @
8f29aedb
...
...
@@ -211,6 +211,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="ClientApp\" />
<Folder Include="Services\MQTTControllers\" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
...
...
IoTSharp/Services/CoAPService.cs
浏览文件 @
8f29aedb
...
...
@@ -2,6 +2,7 @@
using
DotNetCore.CAP
;
using
IoTSharp.Data
;
using
IoTSharp.Handlers
;
using
IoTSharp.Services.CoApResources
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Logging
;
...
...
IoTSharp/
Handler
s/CoAPResource.cs
→
IoTSharp/
Services/CoApResource
s/CoAPResource.cs
浏览文件 @
8f29aedb
...
...
@@ -10,7 +10,7 @@ using System;
using
System.Collections.Generic
;
using
System.Linq
;
namespace
IoTSharp.
Handler
s
namespace
IoTSharp.
Services.CoApResource
s
{
public
class
CoApResource
:
Resource
{
...
...
@@ -114,12 +114,12 @@ namespace IoTSharp.Handlers
switch
(
_res
)
{
case
CoApRes
.
Attributes
:
_eventBus
.
PublishAttributeData
(
new
PlayloadData
()
{
MsgBody
=
keyValues
,
DataCatalog
=
DataCatalog
.
AttributeData
,
DataSide
=
DataSide
.
ClientSide
,
DeviceId
=
dev
.
Id
});
_eventBus
.
PublishAttributeData
(
new
PlayloadData
()
{
MsgBody
=
keyValues
,
DataCatalog
=
DataCatalog
.
AttributeData
,
DataSide
=
DataSide
.
ClientSide
,
DeviceId
=
dev
.
Id
});
exchange
.
Respond
(
StatusCode
.
Changed
,
$"OK"
);
break
;
case
CoApRes
.
Telemetry
:
_eventBus
.
PublishTelemetryData
(
new
PlayloadData
()
{
MsgBody
=
keyValues
,
DataCatalog
=
DataCatalog
.
AttributeData
,
DataSide
=
DataSide
.
ClientSide
,
DeviceId
=
dev
.
Id
});
_eventBus
.
PublishTelemetryData
(
new
PlayloadData
()
{
MsgBody
=
keyValues
,
DataCatalog
=
DataCatalog
.
AttributeData
,
DataSide
=
DataSide
.
ClientSide
,
DeviceId
=
dev
.
Id
});
exchange
.
Respond
(
StatusCode
.
Created
,
$"OK"
);
break
;
...
...
IoTSharp/
Handlers/MQTTServerHandler
.cs
→
IoTSharp/
Services/MQTTService
.cs
浏览文件 @
8f29aedb
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录