26 lines
1.1 KiB
Erlang
26 lines
1.1 KiB
Erlang
%%%-------------------------------------------------------------------
|
|
%%% @author aresei
|
|
%%% @copyright (C) 2023, <COMPANY>
|
|
%%% @doc
|
|
%%%
|
|
%%% @end
|
|
%%% Created : 04. 7月 2023 11:30
|
|
%%%-------------------------------------------------------------------
|
|
-module(iot_router).
|
|
-author("aresei").
|
|
-include("iot.hrl").
|
|
|
|
%% API
|
|
-export([route_uuid/3]).
|
|
|
|
-spec route_uuid(RouterUUID :: binary(), Fields :: list(), Timestamp :: integer()) -> no_return().
|
|
route_uuid(RouterUUID, Fields, Timestamp) when is_binary(RouterUUID), is_list(Fields), is_integer(Timestamp) ->
|
|
%% 查找终端设备对应的点位信息
|
|
case redis_client:hget(RouterUUID, <<"location_code">>) of
|
|
{ok, undefined} ->
|
|
lager:warning("[iot_host] the north_data hget location_code, uuid: ~p, not found, fields: ~p", [RouterUUID, Fields]);
|
|
{ok, LocationCode} when is_binary(LocationCode) ->
|
|
iot_zd_endpoint:forward(LocationCode, Fields, Timestamp);
|
|
{error, Reason} ->
|
|
lager:warning("[iot_host] the north_data hget location_code uuid: ~p, get error: ~p, fields: ~p", [RouterUUID, Reason, Fields])
|
|
end. |