Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Dgiot
Commits
1da746f7
Commit
1da746f7
authored
3 years ago
by
dawnwinterLiu
Browse files
Options
Download
Email Patches
Plain Diff
feat: topic add /user;modbus env = <<>>
parent
36231702
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
apps/dgiot_bamis/src/dgiot_dashboard.erl
+1
-1
apps/dgiot_bamis/src/dgiot_dashboard.erl
apps/dgiot_device/src/dgiot_notification_channel.erl
+1
-1
apps/dgiot_device/src/dgiot_notification_channel.erl
apps/dgiot_modbus/src/dgiot_modbus_tcp.erl
+2
-2
apps/dgiot_modbus/src/dgiot_modbus_tcp.erl
apps/dgiot_topo/src/dgiot_topo.erl
+1
-1
apps/dgiot_topo/src/dgiot_topo.erl
with
5 additions
and
5 deletions
+5
-5
apps/dgiot_bamis/src/dgiot_dashboard.erl
+
1
-
1
View file @
1da746f7
...
...
@@ -141,5 +141,5 @@ do_task(_Task, _State) ->
ok
.
send
(
DashboardId
,
Base64
)
->
Topic
=
<<
"$dg/dashboard/"
,
DashboardId
/
binary
,
"/report"
>>
,
Topic
=
<<
"$dg/
user/
dashboard/"
,
DashboardId
/
binary
,
"/report"
>>
,
dgiot_mqtt
:
publish
(
self
(),
Topic
,
Base64
).
This diff is collapsed.
Click to expand it.
apps/dgiot_device/src/dgiot_notification_channel.erl
+
1
-
1
View file @
1da746f7
...
...
@@ -113,7 +113,7 @@ handle_message({rule, #{clientid := _DevAddr, connected_at := _ConnectedAt} = _M
handle_message
({
rule
,
#
{
clientid
:
=
_
DevAddr
,
disconnected_at
:
=
_
DisconnectedAt
}
=
_
Msg
,
_
Context
},
State
)
->
{
ok
,
State
};
%% SELECT payload.electricity as electricity FROM "$dg/alarm/94656917ab/157d0ff60f/#" where electricity > 20
%% SELECT payload.electricity as electricity FROM "$dg/
user/
alarm/94656917ab/157d0ff60f/#" where electricity > 20
handle_message
({
rule
,
#
{
metadata
:
=
#
{
rule_id
:
=
<<
"rule:Notification_"
,
Ruleid
/
binary
>>
},
clientid
:
=
DeviceId
,
payload
:
=
_
Payload
,
topic
:
=
_
Topic
}
=
_
Msg
,
Context
},
State
)
->
dgiot_umeng
:
add_notification
(
Ruleid
,
DeviceId
,
Context
),
{
ok
,
State
};
...
...
This diff is collapsed.
Click to expand it.
apps/dgiot_modbus/src/dgiot_modbus_tcp.erl
+
2
-
2
View file @
1da746f7
...
...
@@ -76,7 +76,7 @@ handle_info({tcp, Buff}, #tcp{socket = Socket, state = #state{id = ChannelId, de
end
end
;
handle_info
({
tcp
,
Buff
},
#tcp
{
state
=
#state
{
id
=
ChannelId
,
devaddr
=
DtuAddr
,
env
=
#
{
product
:
=
ProductId
,
pn
:
=
Pn
,
di
:
=
Di
},
product
=
DtuProductId
}}
=
TCPState
)
->
handle_info
({
tcp
,
Buff
},
#tcp
{
state
=
#state
{
id
=
ChannelId
,
devaddr
=
DtuAddr
,
env
=
#
{
product
:
=
ProductId
,
pn
:
=
Pn
,
di
:
=
Di
},
product
=
DtuProductId
}
=
State
}
=
TCPState
)
->
dgiot_bridge
:
send_log
(
ChannelId
,
ProductId
,
DtuAddr
,
"
~s
~p
DTU
~p
recv
~p
"
,
[
?
FILE
,
?
LINE
,
DtuAddr
,
dgiot_utils
:
binary_to_hex
(
Buff
)]),
<<
H
:
8
,
L
:
8
>>
=
dgiot_utils
:
hex_to_binary
(
modbus_rtu
:
is16
(
Di
)),
<<
Sh
:
8
,
Sl
:
8
>>
=
dgiot_utils
:
hex_to_binary
(
modbus_rtu
:
is16
(
Pn
)),
...
...
@@ -96,7 +96,7 @@ handle_info({tcp, Buff}, #tcp{state = #state{id = ChannelId, devaddr = DtuAddr,
?
LOG
(
info
,
"Other
~p
"
,
[
Other
]),
pass
end
,
{
noreply
,
TCPState
#tcp
{
buff
=
<<>>
}};
{
noreply
,
TCPState
#tcp
{
buff
=
<<>>
,
state
=
State
#state
{
env
=
<<>>
}
}};
handle_info
({
deliver
,
_,
Msg
},
#tcp
{
state
=
#state
{
id
=
ChannelId
}
=
State
}
=
TCPState
)
->
Payload
=
dgiot_mqtt
:
get_payload
(
Msg
),
...
...
This diff is collapsed.
Click to expand it.
apps/dgiot_topo/src/dgiot_topo.erl
+
1
-
1
View file @
1da746f7
...
...
@@ -81,7 +81,7 @@ get_name(ProductId, K, V) ->
%% 发送实时卡片数据
send_realtime_card
(
ProductId
,
DeviceId
,
Payload
)
->
Data
=
dgiot_device_card
:
get_card
(
ProductId
,
[
Payload
],
DeviceId
,
#
{}),
Pubtopic
=
<<
"$dg/user/"
,
DeviceId
/
binary
,
"/
realtimecard/
report"
>>
,
Pubtopic
=
<<
"$dg/user/
realtimecard/
"
,
DeviceId
/
binary
,
"/report"
>>
,
dgiot_mqtt
:
publish
(
self
(),
Pubtopic
,
base64
:
encode
(
jsx
:
encode
(
#
{
<<
"data"
>>
=>
Data
}))).
%% 发送实时组态数据
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment