fix
This commit is contained in:
parent
1ad849c058
commit
e7ef3350f0
@ -3,6 +3,9 @@ iot
|
|||||||
|
|
||||||
An OTP application
|
An OTP application
|
||||||
|
|
||||||
|
## erlang client sdk
|
||||||
|
https://github.com/emqx/emqtt
|
||||||
|
|
||||||
Build
|
Build
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@
|
|||||||
%% 主机定义
|
%% 主机定义
|
||||||
-record(host, {
|
-record(host, {
|
||||||
%% ID
|
%% ID
|
||||||
id :: binary(),
|
host_id :: binary(),
|
||||||
%% 名称
|
%% 名称
|
||||||
name :: binary(),
|
name :: binary(),
|
||||||
%% 型号
|
%% 型号
|
||||||
@ -104,7 +104,7 @@
|
|||||||
%% 终端设备表
|
%% 终端设备表
|
||||||
-record(terminal, {
|
-record(terminal, {
|
||||||
%% 设备ID
|
%% 设备ID
|
||||||
id :: binary(),
|
terminal_id :: binary(),
|
||||||
%% 关联主机
|
%% 关联主机
|
||||||
host_id :: binary(),
|
host_id :: binary(),
|
||||||
%% 名称
|
%% 名称
|
||||||
@ -132,7 +132,7 @@
|
|||||||
%% 微服务表
|
%% 微服务表
|
||||||
-record(microservice, {
|
-record(microservice, {
|
||||||
%% ID, 基于UUID生成
|
%% ID, 基于UUID生成
|
||||||
id :: binary(),
|
service_id :: binary(),
|
||||||
%% 关联主机
|
%% 关联主机
|
||||||
host_id :: binary(),
|
host_id :: binary(),
|
||||||
%% 名称
|
%% 名称
|
||||||
|
|||||||
@ -11,14 +11,15 @@
|
|||||||
-include("iot.hrl").
|
-include("iot.hrl").
|
||||||
|
|
||||||
%% API
|
%% API
|
||||||
-export([]).
|
-export([handle/2]).
|
||||||
|
|
||||||
handle(<<"server.register">>, Msg = #{<<"c_id">> := ClientId, <<"r">> := PubKey,
|
handle(<<"server.register">>, Msg = #{<<"c_id">> := ClientId, <<"r">> := PubKey,
|
||||||
<<"m">> := #{<<"cpu_core">> := CpuCore, <<"memory">> := Memory, <<"disk">> := Disk, <<"boot_time">> := BootTime, <<"efka_version">> := EfkaVersion, <<"kernel_arch">> := KernelArch, <<"ipv4_1">> := Ip1, <<"ipv4_2">> := Ip2}}) ->
|
<<"m">> := #{<<"cpu_core">> := CpuCore, <<"memory">> := Memory, <<"disk">> := Disk, <<"boot_time">> := BootTime, <<"efka_version">> := EfkaVersion, <<"kernel_arch">> := KernelArch, <<"ipv4_1">> := Ip1, <<"ipv4_2">> := Ip2}}) ->
|
||||||
|
lager:debug("[iot_message_handler] get server register message: ~p", [Msg]),
|
||||||
|
|
||||||
Aes = iot_util:rand_bytes(16),
|
Aes = iot_util:rand_bytes(16),
|
||||||
Host = #host{
|
Host = #host{
|
||||||
id = ClientId,
|
host_id = ClientId,
|
||||||
aes = Aes,
|
aes = Aes,
|
||||||
metric = #host_metric{
|
metric = #host_metric{
|
||||||
%% cpu相关
|
%% cpu相关
|
||||||
|
|||||||
@ -18,7 +18,7 @@ insert_hosts() ->
|
|||||||
lists:foreach(fun(Id0) ->
|
lists:foreach(fun(Id0) ->
|
||||||
%Id0 = iot_util:rand_bytes(16),
|
%Id0 = iot_util:rand_bytes(16),
|
||||||
Host = #host{
|
Host = #host{
|
||||||
id = integer_to_binary(Id0),
|
host_id = integer_to_binary(Id0),
|
||||||
name = <<"N1000_0001">>,
|
name = <<"N1000_0001">>,
|
||||||
model = <<"N1000">>,
|
model = <<"N1000">>,
|
||||||
cell_id = <<"公共教学楼"/utf8>>
|
cell_id = <<"公共教学楼"/utf8>>
|
||||||
|
|||||||
@ -47,7 +47,7 @@ get_status_stat() ->
|
|||||||
|
|
||||||
insert(Id, HostId, Name, ProductId, VendorId, Model, CellId) ->
|
insert(Id, HostId, Name, ProductId, VendorId, Model, CellId) ->
|
||||||
Terminal = #terminal{
|
Terminal = #terminal{
|
||||||
id = Id,
|
terminal_id = Id,
|
||||||
name = Name,
|
name = Name,
|
||||||
product_id = ProductId,
|
product_id = ProductId,
|
||||||
vendor_id = VendorId,
|
vendor_id = VendorId,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user