This commit is contained in:
anlicheng 2025-04-21 17:14:06 +08:00
parent 261477ba86
commit 6a01bddd24
4 changed files with 2960 additions and 0 deletions

1
apps/endpoint/rebar.lock Normal file
View File

@ -0,0 +1 @@
[].

View File

@ -0,0 +1,134 @@
%% -*- coding: utf-8 -*-
%% Automatically generated, do not edit
%% Generated by gpb_compile version 4.21.1
-ifndef(message_pb).
-define(message_pb, true).
-define(message_pb_gpb_version, "4.21.1").
-ifndef('AUTH_REQUEST_PB_H').
-define('AUTH_REQUEST_PB_H', true).
-record(auth_request,
{uuid = <<>> :: unicode:chardata() | undefined, % = 1, optional
username = <<>> :: unicode:chardata() | undefined, % = 2, optional
password = <<>> :: unicode:chardata() | undefined, % = 3, optional
salt = <<>> :: unicode:chardata() | undefined, % = 4, optional
token = <<>> :: unicode:chardata() | undefined, % = 5, optional
timestamp = 0 :: non_neg_integer() | undefined % = 6, optional, 32 bits
}).
-endif.
-ifndef('AUTH_REPLY_PB_H').
-define('AUTH_REPLY_PB_H', true).
-record(auth_reply,
{code = 0 :: non_neg_integer() | undefined, % = 1, optional, 32 bits
message = <<>> :: unicode:chardata() | undefined % = 2, optional
}).
-endif.
-ifndef('SESSION_REQUEST_PB_H').
-define('SESSION_REQUEST_PB_H', true).
-record(session_request,
{
}).
-endif.
-ifndef('SESSION_REPLY_PB_H').
-define('SESSION_REPLY_PB_H', true).
-record(session_reply,
{a = false :: boolean() | 0 | 1 | undefined % = 1, optional
}).
-endif.
-ifndef('DATA_PB_H').
-define('DATA_PB_H', true).
-record(data,
{device_uuid = <<>> :: unicode:chardata() | undefined, % = 1, optional
service_name = <<>> :: unicode:chardata() | undefined, % = 2, optional
at = 0 :: integer() | undefined, % = 3, optional, 32 bits
tags = [] :: [{unicode:chardata(), unicode:chardata()}] | undefined, % = 4
fields = [] :: [iodata()] | undefined % = 5, repeated
}).
-endif.
-ifndef('PING_PB_H').
-define('PING_PB_H', true).
-record(ping,
{adcode = <<>> :: unicode:chardata() | undefined, % = 1, optional
boot_time = 0 :: non_neg_integer() | undefined, % = 2, optional, 32 bits
province = <<>> :: unicode:chardata() | undefined, % = 3, optional
city = <<>> :: unicode:chardata() | undefined, % = 4, optional
efka_version = <<>> :: unicode:chardata() | undefined, % = 5, optional
kernel_arch = <<>> :: unicode:chardata() | undefined, % = 6, optional
ips = [] :: [unicode:chardata()] | undefined, % = 7, repeated
cpu_core = 0 :: non_neg_integer() | undefined, % = 8, optional, 32 bits
cpu_load = 0 :: non_neg_integer() | undefined, % = 9, optional, 32 bits
cpu_temperature = 0.0 :: float() | integer() | infinity | '-infinity' | nan | undefined, % = 10, optional
disk = [] :: [integer()] | undefined, % = 11, repeated, 32 bits
memory = [] :: [integer()] | undefined, % = 12, repeated, 32 bits
interfaces = [] :: [iodata()] | undefined % = 13, repeated
}).
-endif.
-ifndef('SERVICE_INFORM_PB_H').
-define('SERVICE_INFORM_PB_H', true).
-record(service_inform,
{name = <<>> :: unicode:chardata() | undefined, % = 1, optional
props = <<>> :: unicode:chardata() | undefined, % = 2, optional
version = <<>> :: unicode:chardata() | undefined, % = 3, optional
version_copy = <<>> :: unicode:chardata() | undefined, % = 4, optional
status = 0 :: non_neg_integer() | undefined, % = 5, optional, 32 bits
at = 0 :: non_neg_integer() | undefined % = 6, optional, 32 bits
}).
-endif.
-ifndef('FEEDBACK_STEP_PB_H').
-define('FEEDBACK_STEP_PB_H', true).
-record(feedback_step,
{task_id = <<>> :: unicode:chardata() | undefined, % = 1, optional
code = 0 :: non_neg_integer() | undefined % = 2, optional, 32 bits
}).
-endif.
-ifndef('FEEDBACK_RESULT_PB_H').
-define('FEEDBACK_RESULT_PB_H', true).
-record(feedback_result,
{task_id = <<>> :: unicode:chardata() | undefined, % = 1, optional
task_type = <<>> :: unicode:chardata() | undefined, % = 2, optional
time = 0 :: non_neg_integer() | undefined, % = 3, optional, 32 bits
code = 0 :: non_neg_integer() | undefined, % = 4, optional, 32 bits
reason = <<>> :: unicode:chardata() | undefined, % = 5, optional
error = <<>> :: unicode:chardata() | undefined % = 6, optional
}).
-endif.
-ifndef('EVENT_PB_H').
-define('EVENT_PB_H', true).
-record(event,
{event_type = 0 :: non_neg_integer() | undefined, % = 1, optional, 32 bits
params = <<>> :: iodata() | undefined % = 2, optional
}).
-endif.
-ifndef('AI_EVENT_PB_H').
-define('AI_EVENT_PB_H', true).
-record(ai_event,
{event_type = 0 :: non_neg_integer() | undefined, % = 1, optional, 32 bits
params = <<>> :: iodata() | undefined % = 2, optional
}).
-endif.
-ifndef('DIRECTIVE_PB_H').
-define('DIRECTIVE_PB_H', true).
-record(directive,
{device_uuid = <<>> :: unicode:chardata() | undefined, % = 1, optional
version = <<>> :: unicode:chardata() | undefined, % = 2, optional
directive_type = 0 :: non_neg_integer() | undefined, % = 3, optional, 32 bits
timeout = 0 :: non_neg_integer() | undefined, % = 4, optional, 32 bits
directive = <<>> :: iodata() | undefined % = 5, optional
}).
-endif.
-endif.

File diff suppressed because it is too large Load Diff

View File

@ -74,6 +74,10 @@ handle_call(_Request, _From, State) ->
handle_cast(_Msg, State) ->
{noreply, State}.
handle_info({tcp, Socket, <<?PACKET_REQUEST, PacketId:32, ?METHOD_AUTH:8, Request/binary>>}, State = #state{socket = Socket}) ->
lager:debug("get request: ~p, packet_id: ~p", [Request, PacketId]),
{noreply, State};
handle_info({binary, <<?PACKET_REQUEST, PacketId:32, ?METHOD_AUTH:8, Data/binary>>}, State) ->
#{<<"uuid">> := UUID, <<"timestamp">> := Timestamp, <<"salt">> := Salt, <<"username">> := Username, <<"token">> := Token} = jiffy:decode(Data, [return_maps]),
lager:debug("[ws_channel] auth uuid: ~p, request message: ~p", [UUID, Data]),