This commit is contained in:
anlicheng 2025-08-18 14:07:34 +08:00
parent 706c164163
commit b1eac4ff16
2 changed files with 72 additions and 94 deletions

View File

@ -31,7 +31,7 @@
-define('PUB_PB_H', true). -define('PUB_PB_H', true).
-record(pub, -record(pub,
{topic = <<>> :: unicode:chardata() | undefined, % = 1, optional {topic = <<>> :: unicode:chardata() | undefined, % = 1, optional
content = <<>> :: unicode:chardata() | undefined % = 2, optional content = <<>> :: iodata() | undefined % = 2, optional
}). }).
-endif. -endif.
@ -64,7 +64,7 @@
-define('INVOKE_PB_H', true). -define('INVOKE_PB_H', true).
-record(invoke, -record(invoke,
{service_id = <<>> :: unicode:chardata() | undefined, % = 1, optional {service_id = <<>> :: unicode:chardata() | undefined, % = 1, optional
payload = <<>> :: unicode:chardata() | undefined, % = 2, optional payload = <<>> :: iodata() | undefined, % = 2, optional
timeout = 0 :: non_neg_integer() | undefined % = 3, optional, 32 bits timeout = 0 :: non_neg_integer() | undefined % = 3, optional, 32 bits
}). }).
-endif. -endif.
@ -84,8 +84,7 @@
{service_id = <<>> :: unicode:chardata() | undefined, % = 1, optional {service_id = <<>> :: unicode:chardata() | undefined, % = 1, optional
device_uuid = <<>> :: unicode:chardata() | undefined, % = 2, optional device_uuid = <<>> :: unicode:chardata() | undefined, % = 2, optional
route_key = <<>> :: unicode:chardata() | undefined, % = 3, optional route_key = <<>> :: unicode:chardata() | undefined, % = 3, optional
format = <<>> :: unicode:chardata() | undefined, % = 4, optional metric = <<>> :: iodata() | undefined % = 4, optional
metric = <<>> :: unicode:chardata() | undefined % = 5, optional
}). }).
-endif. -endif.

View File

@ -222,9 +222,9 @@ encode_msg_pub(#pub{topic = F1, content = F2}, Bin, TrUserData) ->
true -> true ->
begin begin
TrF2 = id(F2, TrUserData), TrF2 = id(F2, TrUserData),
case is_empty_string(TrF2) of case iolist_size(TrF2) of
true -> B1; 0 -> B1;
false -> e_type_string(TrF2, <<B1/binary, 18>>, TrUserData) _ -> e_type_bytes(TrF2, <<B1/binary, 18>>, TrUserData)
end end
end end
end. end.
@ -329,9 +329,9 @@ encode_msg_invoke(#invoke{service_id = F1, payload = F2, timeout = F3}, Bin, TrU
true -> true ->
begin begin
TrF2 = id(F2, TrUserData), TrF2 = id(F2, TrUserData),
case is_empty_string(TrF2) of case iolist_size(TrF2) of
true -> B1; 0 -> B1;
false -> e_type_string(TrF2, <<B1/binary, 18>>, TrUserData) _ -> e_type_bytes(TrF2, <<B1/binary, 18>>, TrUserData)
end end
end end
end, end,
@ -382,7 +382,7 @@ encode_msg_push_service_config(#push_service_config{service_id = F1, config_json
encode_msg_data(Msg, TrUserData) -> encode_msg_data(Msg, <<>>, TrUserData). encode_msg_data(Msg, TrUserData) -> encode_msg_data(Msg, <<>>, TrUserData).
encode_msg_data(#data{service_id = F1, device_uuid = F2, route_key = F3, format = F4, metric = F5}, Bin, TrUserData) -> encode_msg_data(#data{service_id = F1, device_uuid = F2, route_key = F3, metric = F4}, Bin, TrUserData) ->
B1 = if F1 == undefined -> Bin; B1 = if F1 == undefined -> Bin;
true -> true ->
begin begin
@ -413,23 +413,13 @@ encode_msg_data(#data{service_id = F1, device_uuid = F2, route_key = F3, format
end end
end end
end, end,
B4 = if F4 == undefined -> B3; if F4 == undefined -> B3;
true ->
begin
TrF4 = id(F4, TrUserData),
case is_empty_string(TrF4) of
true -> B3;
false -> e_type_string(TrF4, <<B3/binary, 34>>, TrUserData)
end
end
end,
if F5 == undefined -> B4;
true -> true ->
begin begin
TrF5 = id(F5, TrUserData), TrF4 = id(F4, TrUserData),
case is_empty_string(TrF5) of case iolist_size(TrF4) of
true -> B4; 0 -> B3;
false -> e_type_string(TrF5, <<B4/binary, 42>>, TrUserData) _ -> e_type_bytes(TrF4, <<B3/binary, 34>>, TrUserData)
end end
end end
end. end.
@ -1289,77 +1279,70 @@ skip_32_push_service_config(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3,
skip_64_push_service_config(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_push_service_config(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData). skip_64_push_service_config(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_push_service_config(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
decode_msg_data(Bin, TrUserData) -> dfp_read_field_def_data(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData). decode_msg_data(Bin, TrUserData) -> dfp_read_field_def_data(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData).
dfp_read_field_def_data(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_data_service_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); dfp_read_field_def_data(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_data_service_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData);
dfp_read_field_def_data(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_data_device_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); dfp_read_field_def_data(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_data_device_uuid(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData);
dfp_read_field_def_data(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_data_route_key(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); dfp_read_field_def_data(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_data_route_key(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData);
dfp_read_field_def_data(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_data_format(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); dfp_read_field_def_data(<<34, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> d_field_data_metric(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData);
dfp_read_field_def_data(<<42, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_data_metric(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); dfp_read_field_def_data(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #data{service_id = F@_1, device_uuid = F@_2, route_key = F@_3, metric = F@_4};
dfp_read_field_def_data(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> #data{service_id = F@_1, device_uuid = F@_2, route_key = F@_3, format = F@_4, metric = F@_5}; dfp_read_field_def_data(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dg_read_field_def_data(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData).
dfp_read_field_def_data(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dg_read_field_def_data(Other, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData).
dg_read_field_def_data(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 32 - 7 -> dg_read_field_def_data(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); dg_read_field_def_data(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 32 - 7 -> dg_read_field_def_data(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData);
dg_read_field_def_data(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dg_read_field_def_data(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, F@_4, TrUserData) ->
Key = X bsl N + Acc, Key = X bsl N + Acc,
case Key of case Key of
10 -> d_field_data_service_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); 10 -> d_field_data_service_id(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData);
18 -> d_field_data_device_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); 18 -> d_field_data_device_uuid(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData);
26 -> d_field_data_route_key(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); 26 -> d_field_data_route_key(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData);
34 -> d_field_data_format(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); 34 -> d_field_data_metric(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, TrUserData);
42 -> d_field_data_metric(Rest, 0, 0, 0, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData);
_ -> _ ->
case Key band 7 of case Key band 7 of
0 -> skip_varint_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); 0 -> skip_varint_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData);
1 -> skip_64_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); 1 -> skip_64_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData);
2 -> skip_length_delimited_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); 2 -> skip_length_delimited_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData);
3 -> skip_group_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); 3 -> skip_group_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData);
5 -> skip_32_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) 5 -> skip_32_data(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, F@_4, TrUserData)
end end
end; end;
dg_read_field_def_data(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, F@_5, _) -> #data{service_id = F@_1, device_uuid = F@_2, route_key = F@_3, format = F@_4, metric = F@_5}. dg_read_field_def_data(<<>>, 0, 0, _, F@_1, F@_2, F@_3, F@_4, _) -> #data{service_id = F@_1, device_uuid = F@_2, route_key = F@_3, metric = F@_4}.
d_field_data_service_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_data_service_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); d_field_data_service_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_data_service_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData);
d_field_data_service_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, F@_5, TrUserData) -> d_field_data_service_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, F@_4, TrUserData) ->
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, {NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end,
dfp_read_field_def_data(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, F@_5, TrUserData). dfp_read_field_def_data(RestF, 0, 0, F, NewFValue, F@_2, F@_3, F@_4, TrUserData).
d_field_data_device_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_data_device_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); d_field_data_device_uuid(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_data_device_uuid(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData);
d_field_data_device_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, F@_5, TrUserData) -> d_field_data_device_uuid(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, F@_4, TrUserData) ->
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, {NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end,
dfp_read_field_def_data(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, F@_5, TrUserData). dfp_read_field_def_data(RestF, 0, 0, F, F@_1, NewFValue, F@_3, F@_4, TrUserData).
d_field_data_route_key(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_data_route_key(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); d_field_data_route_key(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_data_route_key(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData);
d_field_data_route_key(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, F@_5, TrUserData) -> d_field_data_route_key(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, F@_4, TrUserData) ->
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, {NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end,
dfp_read_field_def_data(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, F@_5, TrUserData). dfp_read_field_def_data(RestF, 0, 0, F, F@_1, F@_2, NewFValue, F@_4, TrUserData).
d_field_data_format(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_data_format(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); d_field_data_metric(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> d_field_data_metric(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData);
d_field_data_format(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, F@_5, TrUserData) -> d_field_data_metric(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, _, TrUserData) ->
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end, {NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end,
dfp_read_field_def_data(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, F@_5, TrUserData). dfp_read_field_def_data(RestF, 0, 0, F, F@_1, F@_2, F@_3, NewFValue, TrUserData).
d_field_data_metric(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> d_field_data_metric(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); skip_varint_data(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> skip_varint_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData);
d_field_data_metric(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, _, TrUserData) -> skip_varint_data(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData).
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end,
dfp_read_field_def_data(RestF, 0, 0, F, F@_1, F@_2, F@_3, F@_4, NewFValue, TrUserData).
skip_varint_data(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> skip_varint_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData); skip_length_delimited_data(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) when N < 57 -> skip_length_delimited_data(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData);
skip_varint_data(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). skip_length_delimited_data(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, TrUserData) ->
skip_length_delimited_data(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) when N < 57 -> skip_length_delimited_data(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData);
skip_length_delimited_data(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) ->
Length = X bsl N + Acc, Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest, <<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_data(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). dfp_read_field_def_data(Rest2, 0, 0, F, F@_1, F@_2, F@_3, F@_4, TrUserData).
skip_group_data(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> skip_group_data(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData) ->
{_, Rest} = read_group(Bin, FNum), {_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_data(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). dfp_read_field_def_data(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, F@_4, TrUserData).
skip_32_data(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). skip_32_data(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData).
skip_64_data(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData) -> dfp_read_field_def_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, F@_5, TrUserData). skip_64_data(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData) -> dfp_read_field_def_data(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, F@_4, TrUserData).
decode_msg_ping(Bin, TrUserData) -> decode_msg_ping(Bin, TrUserData) ->
dfp_read_field_def_ping(Bin, dfp_read_field_def_ping(Bin,
@ -1949,8 +1932,7 @@ merge_msg_push_service_config(#push_service_config{service_id = PFservice_id, co
end}. end}.
-compile({nowarn_unused_function,merge_msg_data/3}). -compile({nowarn_unused_function,merge_msg_data/3}).
merge_msg_data(#data{service_id = PFservice_id, device_uuid = PFdevice_uuid, route_key = PFroute_key, format = PFformat, metric = PFmetric}, merge_msg_data(#data{service_id = PFservice_id, device_uuid = PFdevice_uuid, route_key = PFroute_key, metric = PFmetric}, #data{service_id = NFservice_id, device_uuid = NFdevice_uuid, route_key = NFroute_key, metric = NFmetric}, _) ->
#data{service_id = NFservice_id, device_uuid = NFdevice_uuid, route_key = NFroute_key, format = NFformat, metric = NFmetric}, _) ->
#data{service_id = #data{service_id =
if NFservice_id =:= undefined -> PFservice_id; if NFservice_id =:= undefined -> PFservice_id;
true -> NFservice_id true -> NFservice_id
@ -1963,10 +1945,6 @@ merge_msg_data(#data{service_id = PFservice_id, device_uuid = PFdevice_uuid, rou
if NFroute_key =:= undefined -> PFroute_key; if NFroute_key =:= undefined -> PFroute_key;
true -> NFroute_key true -> NFroute_key
end, end,
format =
if NFformat =:= undefined -> PFformat;
true -> NFformat
end,
metric = metric =
if NFmetric =:= undefined -> PFmetric; if NFmetric =:= undefined -> PFmetric;
true -> NFmetric true -> NFmetric
@ -2147,7 +2125,7 @@ v_msg_pub(#pub{topic = F1, content = F2}, Path, TrUserData) ->
true -> v_type_string(F1, [topic | Path], TrUserData) true -> v_type_string(F1, [topic | Path], TrUserData)
end, end,
if F2 == undefined -> ok; if F2 == undefined -> ok;
true -> v_type_string(F2, [content | Path], TrUserData) true -> v_type_bytes(F2, [content | Path], TrUserData)
end, end,
ok; ok;
v_msg_pub(X, Path, _TrUserData) -> mk_type_error({expected_msg, pub}, X, Path). v_msg_pub(X, Path, _TrUserData) -> mk_type_error({expected_msg, pub}, X, Path).
@ -2198,7 +2176,7 @@ v_msg_invoke(#invoke{service_id = F1, payload = F2, timeout = F3}, Path, TrUserD
true -> v_type_string(F1, [service_id | Path], TrUserData) true -> v_type_string(F1, [service_id | Path], TrUserData)
end, end,
if F2 == undefined -> ok; if F2 == undefined -> ok;
true -> v_type_string(F2, [payload | Path], TrUserData) true -> v_type_bytes(F2, [payload | Path], TrUserData)
end, end,
if F3 == undefined -> ok; if F3 == undefined -> ok;
true -> v_type_uint32(F3, [timeout | Path], TrUserData) true -> v_type_uint32(F3, [timeout | Path], TrUserData)
@ -2223,7 +2201,7 @@ v_msg_push_service_config(X, Path, _TrUserData) -> mk_type_error({expected_msg,
-compile({nowarn_unused_function,v_msg_data/3}). -compile({nowarn_unused_function,v_msg_data/3}).
-dialyzer({nowarn_function,v_msg_data/3}). -dialyzer({nowarn_function,v_msg_data/3}).
v_msg_data(#data{service_id = F1, device_uuid = F2, route_key = F3, format = F4, metric = F5}, Path, TrUserData) -> v_msg_data(#data{service_id = F1, device_uuid = F2, route_key = F3, metric = F4}, Path, TrUserData) ->
if F1 == undefined -> ok; if F1 == undefined -> ok;
true -> v_type_string(F1, [service_id | Path], TrUserData) true -> v_type_string(F1, [service_id | Path], TrUserData)
end, end,
@ -2234,10 +2212,7 @@ v_msg_data(#data{service_id = F1, device_uuid = F2, route_key = F3, format = F4,
true -> v_type_string(F3, [route_key | Path], TrUserData) true -> v_type_string(F3, [route_key | Path], TrUserData)
end, end,
if F4 == undefined -> ok; if F4 == undefined -> ok;
true -> v_type_string(F4, [format | Path], TrUserData) true -> v_type_bytes(F4, [metric | Path], TrUserData)
end,
if F5 == undefined -> ok;
true -> v_type_string(F5, [metric | Path], TrUserData)
end, end,
ok; ok;
v_msg_data(X, Path, _TrUserData) -> mk_type_error({expected_msg, data}, X, Path). v_msg_data(X, Path, _TrUserData) -> mk_type_error({expected_msg, data}, X, Path).
@ -2370,6 +2345,12 @@ v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) ->
end; end;
v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path). v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path).
-compile({nowarn_unused_function,v_type_bytes/3}).
-dialyzer({nowarn_function,v_type_bytes/3}).
v_type_bytes(B, _Path, _TrUserData) when is_binary(B) -> ok;
v_type_bytes(B, _Path, _TrUserData) when is_list(B) -> ok;
v_type_bytes(X, Path, _TrUserData) -> mk_type_error(bad_binary_value, X, Path).
-compile({nowarn_unused_function,mk_type_error/3}). -compile({nowarn_unused_function,mk_type_error/3}).
-spec mk_type_error(_, _, list()) -> no_return(). -spec mk_type_error(_, _, list()) -> no_return().
mk_type_error(Error, ValueSeen, Path) -> mk_type_error(Error, ValueSeen, Path) ->
@ -2415,7 +2396,7 @@ get_msg_defs() ->
#field{name = token, fnum = 5, rnum = 5, type = string, occurrence = optional, opts = []}, #field{name = token, fnum = 5, rnum = 5, type = string, occurrence = optional, opts = []},
#field{name = timestamp, fnum = 6, rnum = 6, type = uint32, occurrence = optional, opts = []}]}, #field{name = timestamp, fnum = 6, rnum = 6, type = uint32, occurrence = optional, opts = []}]},
{{msg, auth_reply}, [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = message, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]}, {{msg, auth_reply}, [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = message, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]},
{{msg, pub}, [#field{name = topic, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = content, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]}, {{msg, pub}, [#field{name = topic, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = content, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}]},
{{msg, async_call_reply}, {{msg, async_call_reply},
[#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
#field{name = result, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, #field{name = result, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
@ -2427,7 +2408,7 @@ get_msg_defs() ->
{{msg, fetch_task_log}, [#field{name = task_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}]}, {{msg, fetch_task_log}, [#field{name = task_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}]},
{{msg, invoke}, {{msg, invoke},
[#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
#field{name = payload, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, #field{name = payload, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []},
#field{name = timeout, fnum = 3, rnum = 4, type = uint32, occurrence = optional, opts = []}]}, #field{name = timeout, fnum = 3, rnum = 4, type = uint32, occurrence = optional, opts = []}]},
{{msg, push_service_config}, {{msg, push_service_config},
[#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
@ -2437,8 +2418,7 @@ get_msg_defs() ->
[#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
#field{name = device_uuid, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, #field{name = device_uuid, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
#field{name = route_key, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}, #field{name = route_key, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []},
#field{name = format, fnum = 4, rnum = 5, type = string, occurrence = optional, opts = []}, #field{name = metric, fnum = 4, rnum = 5, type = bytes, occurrence = optional, opts = []}]},
#field{name = metric, fnum = 5, rnum = 6, type = string, occurrence = optional, opts = []}]},
{{msg, ping}, {{msg, ping},
[#field{name = adcode, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, [#field{name = adcode, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
#field{name = boot_time, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []}, #field{name = boot_time, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []},
@ -2495,7 +2475,7 @@ find_msg_def(auth_request) ->
#field{name = token, fnum = 5, rnum = 5, type = string, occurrence = optional, opts = []}, #field{name = token, fnum = 5, rnum = 5, type = string, occurrence = optional, opts = []},
#field{name = timestamp, fnum = 6, rnum = 6, type = uint32, occurrence = optional, opts = []}]; #field{name = timestamp, fnum = 6, rnum = 6, type = uint32, occurrence = optional, opts = []}];
find_msg_def(auth_reply) -> [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = message, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]; find_msg_def(auth_reply) -> [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = message, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}];
find_msg_def(pub) -> [#field{name = topic, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = content, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]; find_msg_def(pub) -> [#field{name = topic, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = content, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}];
find_msg_def(async_call_reply) -> find_msg_def(async_call_reply) ->
[#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
#field{name = result, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, #field{name = result, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
@ -2507,7 +2487,7 @@ find_msg_def(deploy) ->
find_msg_def(fetch_task_log) -> [#field{name = task_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}]; find_msg_def(fetch_task_log) -> [#field{name = task_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}];
find_msg_def(invoke) -> find_msg_def(invoke) ->
[#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
#field{name = payload, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, #field{name = payload, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []},
#field{name = timeout, fnum = 3, rnum = 4, type = uint32, occurrence = optional, opts = []}]; #field{name = timeout, fnum = 3, rnum = 4, type = uint32, occurrence = optional, opts = []}];
find_msg_def(push_service_config) -> find_msg_def(push_service_config) ->
[#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
@ -2517,8 +2497,7 @@ find_msg_def(data) ->
[#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
#field{name = device_uuid, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}, #field{name = device_uuid, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
#field{name = route_key, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}, #field{name = route_key, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []},
#field{name = format, fnum = 4, rnum = 5, type = string, occurrence = optional, opts = []}, #field{name = metric, fnum = 4, rnum = 5, type = bytes, occurrence = optional, opts = []}];
#field{name = metric, fnum = 5, rnum = 6, type = string, occurrence = optional, opts = []}];
find_msg_def(ping) -> find_msg_def(ping) ->
[#field{name = adcode, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, [#field{name = adcode, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
#field{name = boot_time, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []}, #field{name = boot_time, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []},