83 lines
1.9 KiB
Erlang
83 lines
1.9 KiB
Erlang
%%%-------------------------------------------------------------------
|
|
%%% @author anlicheng
|
|
%%% @copyright (C) 2025, <COMPANY>
|
|
%%% @doc
|
|
%%% 扩展部分, 1: 支持基于topic的pub/sub机制; 2. 基于target的单点通讯和广播
|
|
%%% @end
|
|
%%% Created : 21. 4月 2025 17:28
|
|
%%%-------------------------------------------------------------------
|
|
-author("anlicheng").
|
|
|
|
%% efka主动发起的消息体类型, 消息大类
|
|
-define(PACKET_REQUEST, 16#01).
|
|
-define(PACKET_RESPONSE, 16#02).
|
|
|
|
%% efka主动发起不需要返回的数据
|
|
-define(PACKET_CAST, 16#03).
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
%%%% 二级分类定义
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%% 主机端上报数据类型标识
|
|
-define(MESSAGE_AUTH_REQUEST, 16#01).
|
|
-define(MESSAGE_PUB, 16#02).
|
|
-define(MESSAGE_COMMAND, 16#03).
|
|
-define(MESSAGE_RPC_DEPLOY, 16#04).
|
|
-define(MESSAGE_RPC_CONTAINER, 16#05).
|
|
-define(MESSAGE_DATA, 16#06).
|
|
-define(MESSAGE_EVENT, 16#07).
|
|
|
|
%% 响应数据
|
|
-define(MESSAGE_RPC_REPLY, 16#FF).
|
|
|
|
%%%% 命令类型子分类, 不需要返回值
|
|
%% 授权
|
|
-define(COMMAND_AUTH, 16#08).
|
|
|
|
-record(auth_request, {
|
|
uuid :: binary(),
|
|
username :: binary(),
|
|
salt :: binary(),
|
|
token :: binary(),
|
|
timestamp :: integer()
|
|
}).
|
|
|
|
-record(pub, {
|
|
topic :: binary(),
|
|
content :: binary()
|
|
}).
|
|
|
|
-record(command, {
|
|
command_type :: integer(),
|
|
command :: binary()
|
|
}).
|
|
|
|
-record(rpc_deploy, {
|
|
task_id :: integer(),
|
|
config :: binary()
|
|
}).
|
|
|
|
-record(rpc_container, {
|
|
method :: binary(),
|
|
container_name :: binary(),
|
|
params = <<>> :: binary()
|
|
}).
|
|
|
|
-record(rpc_reply, {
|
|
code :: integer(),
|
|
payload :: binary()
|
|
}).
|
|
|
|
-record(data, {
|
|
service_id :: binary(),
|
|
device_uuid :: binary(),
|
|
route_key :: binary(),
|
|
metric :: binary()
|
|
}).
|
|
|
|
-record(event, {
|
|
service_id :: binary(),
|
|
event_type :: integer(),
|
|
params :: binary()
|
|
}). |