Skip to content

Commit

Permalink
feat: bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
dawnwinterLiu committed Apr 21, 2023
1 parent b8e564e commit 52012a9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/dgiot_task/src/dgiot_task.erl
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,14 @@ dealwith_data(ProductId, DevAddr, DeviceId, AllData, Storage) ->
%% 告警
NotificationTopic = <<"$dg/user/alarm/", ProductId/binary, "/", DeviceId/binary, "/properties/report">>,
dgiot_mqtt:publish(DeviceId, NotificationTopic, jsx:encode(AllData)),
%% 桥接转发
case dgiot_mqtt:has_routes(<<"forward/#">>) of
true ->
ForwardTopic = <<"forward/$dg/thing/", ProductId/binary, "/", DevAddr/binary, "/properties/report">>,
dgiot_mqtt:publish(DeviceId, ForwardTopic, jsx:encode(AllData));
_ ->
pass
end,
%% 实时数据
ChannelId = dgiot_parse_id:get_channelid(dgiot_utils:to_binary(?BRIDGE_CHL), <<"DGIOTTOPO">>, <<"TOPO组态通道"/utf8>>),
dgiot_channelx:do_message(ChannelId, {topo_thing, ProductId, DeviceId, AllData}),
Expand Down

0 comments on commit 52012a9

Please sign in to comment.