73 lines
1.7 KiB
Erlang
73 lines
1.7 KiB
Erlang
%%%-------------------------------------------------------------------
|
||
%%% @author licheng5
|
||
%%% @copyright (C) 2023, <COMPANY>
|
||
%%% @doc
|
||
%%%
|
||
%%% @end
|
||
%%% Created : 14. 2月 2023 19:48
|
||
%%%-------------------------------------------------------------------
|
||
-author("licheng5").
|
||
|
||
%% 主机是否在线
|
||
-define(HOST_OFFLINE, 0).
|
||
-define(HOST_ONLINE, 1).
|
||
-define(HOST_NOT_JOINED, -1).
|
||
|
||
%% 设备是否在线状态
|
||
-define(DEVICE_OFFLINE, 0).
|
||
-define(DEVICE_ONLINE, 1).
|
||
-define(DEVICE_NOT_JOINED, -1).
|
||
|
||
%% 下发的任务状态
|
||
-define(TASK_STATUS_INIT, -1). %% 未接入
|
||
-define(TASK_STATUS_FAILED, 0). %% 离线
|
||
-define(TASK_STATUS_OK, 1). %% 在线
|
||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||
%%%% 二级分类定义
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||
|
||
%% 缓存数据库表
|
||
-record(kv, {
|
||
key :: binary(),
|
||
val :: binary() | list() | map() | sets:set(),
|
||
expire_at = 0 :: integer(),
|
||
type :: atom()
|
||
}).
|
||
|
||
%% id生成器
|
||
-record(id_generator, {
|
||
tab :: atom(),
|
||
increment_id = 0 :: integer()
|
||
}).
|
||
|
||
%% 统计项
|
||
-record(option, {
|
||
success_num = 0,
|
||
fail_num = 0
|
||
}).
|
||
|
||
%% 北向数据
|
||
-record(north_data, {
|
||
id = 0 :: integer(),
|
||
location_code :: binary(),
|
||
%% 数据库类型的endpoint, 可以返回list: [{K, V}, {K1, V1}]
|
||
fields :: [{K :: binary(), V :: any()}],
|
||
timestamp = 0 :: integer()
|
||
}).
|
||
|
||
%% 事件相关的数据
|
||
-record(event_data, {
|
||
id = 0 :: integer(),
|
||
location_code :: binary(),
|
||
event_type :: integer(),
|
||
params :: map()
|
||
}).
|
||
|
||
%% 发送数据
|
||
-record(post_data, {
|
||
id = 0 :: integer(),
|
||
location_code :: binary(),
|
||
%% 数据库类型的endpoint, 可以返回list: [{K, V}, {K1, V1}]
|
||
body :: binary() | list()
|
||
}). |