Skip to content

Commit a94eea6

Browse files
authored
Fix net ids export string (#316)
1 parent bf766a0 commit a94eea6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/cli/hpr_cli_info.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ info_ips(["info", "ips"], [], []) ->
6767
end,
6868
gproc:lookup_local_properties(hpr_packet_router_service:ip_key())
6969
),
70-
Json = jsx:encode(List),
70+
Json = jsx:encode(List, [{indent, 2}]),
7171
case file:open("/tmp/hotspot_ip.json", [write]) of
7272
{ok, File} ->
7373
file:write(File, Json),
@@ -83,14 +83,14 @@ info_netids(["info", "netids"], [], []) ->
8383
List = lists:map(
8484
fun({NetID, Count}) ->
8585
#{
86-
net_id_str => hpr_utils:net_id_display(NetID),
86+
net_id_str => erlang:list_to_binary(hpr_utils:net_id_display(NetID)),
8787
net_id_int => NetID,
8888
count => Count
8989
}
9090
end,
9191
hpr_netid_stats:export()
9292
),
93-
Json = jsx:encode(List),
93+
Json = jsx:encode(List, [{indent, 2}]),
9494
case file:open("/tmp/net_ids.json", [write]) of
9595
{ok, File} ->
9696
file:write(File, Json),

src/grpc/packet_router/hpr_packet_up.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ type(Packet) ->
171171
-spec net_id(Packet :: packet()) -> {ok, lora_subnet:net_id()} | {error, any()}.
172172
net_id(Packet) ->
173173
case ?MODULE:payload(Packet) of
174-
<<?JOIN_REQUEST:3, _:5, _AppEUI:64/integer-unsigned-little,
175-
_DevEUI:64/integer-unsigned-little, _DevNonce:2/binary, _MIC:4/binary>> ->
174+
<<?JOIN_REQUEST:3, _:5, _AppEUI:64/little-unsigned-integer,
175+
_DevEUI:64/little-unsigned-integer, _DevNonce:2/binary, _MIC:4/binary>> ->
176176
{error, join};
177-
(<<FType:3, _:5, DevAddr:32/integer-unsigned-little, _ADR:1, _ADRACKReq:1, _ACK:1, _RFU:1,
177+
(<<FType:3, _:5, DevAddr:32/little-unsigned-integer, _ADR:1, _ADRACKReq:1, _ACK:1, _RFU:1,
178178
FOptsLen:4, _FCnt:16/little-unsigned-integer, _FOpts:FOptsLen/binary,
179179
PayloadAndMIC/binary>>) when
180180
(FType == ?UNCONFIRMED_UP orelse FType == ?CONFIRMED_UP) andalso

0 commit comments

Comments
 (0)