|
@@ -97,7 +97,7 @@ tlv_single_resource(BaseName, Id, Value, ObjDefinition) ->
|
|
|
[#{path => BaseName, value => Val}].
|
|
[#{path => BaseName, value => Val}].
|
|
|
|
|
|
|
|
basename(OldBaseName, _ObjectId, ObjectInstanceId, ResourceId, 3) ->
|
|
basename(OldBaseName, _ObjectId, ObjectInstanceId, ResourceId, 3) ->
|
|
|
- case binary:split(binary_util:trim(OldBaseName, $/), [<<$/>>], [global]) of
|
|
|
|
|
|
|
+ case binary:split(emqx_utils_binary:trim(OldBaseName, $/), [<<$/>>], [global]) of
|
|
|
[ObjId, ObjInsId, ResId] ->
|
|
[ObjId, ObjInsId, ResId] ->
|
|
|
<<$/, ObjId/binary, $/, ObjInsId/binary, $/, ResId/binary>>;
|
|
<<$/, ObjId/binary, $/, ObjInsId/binary, $/, ResId/binary>>;
|
|
|
[ObjId, ObjInsId] ->
|
|
[ObjId, ObjInsId] ->
|
|
@@ -113,13 +113,13 @@ basename(OldBaseName, _ObjectId, ObjectInstanceId, ResourceId, 3) ->
|
|
|
>>
|
|
>>
|
|
|
end;
|
|
end;
|
|
|
basename(OldBaseName, _ObjectId, ObjectInstanceId, _ResourceId, 2) ->
|
|
basename(OldBaseName, _ObjectId, ObjectInstanceId, _ResourceId, 2) ->
|
|
|
- case binary:split(binary_util:trim(OldBaseName, $/), [<<$/>>], [global]) of
|
|
|
|
|
|
|
+ case binary:split(emqx_utils_binary:trim(OldBaseName, $/), [<<$/>>], [global]) of
|
|
|
[ObjId, ObjInsId, _ResId] -> <<$/, ObjId/binary, $/, ObjInsId/binary>>;
|
|
[ObjId, ObjInsId, _ResId] -> <<$/, ObjId/binary, $/, ObjInsId/binary>>;
|
|
|
[ObjId, ObjInsId] -> <<$/, ObjId/binary, $/, ObjInsId/binary>>;
|
|
[ObjId, ObjInsId] -> <<$/, ObjId/binary, $/, ObjInsId/binary>>;
|
|
|
[ObjId] -> <<$/, ObjId/binary, $/, (integer_to_binary(ObjectInstanceId))/binary>>
|
|
[ObjId] -> <<$/, ObjId/binary, $/, (integer_to_binary(ObjectInstanceId))/binary>>
|
|
|
end.
|
|
end.
|
|
|
% basename(OldBaseName, _ObjectId, _ObjectInstanceId, _ResourceId, 1) ->
|
|
% basename(OldBaseName, _ObjectId, _ObjectInstanceId, _ResourceId, 1) ->
|
|
|
-% case binary:split(binary_util:trim(OldBaseName, $/), [<<$/>>], [global]) of
|
|
|
|
|
|
|
+% case binary:split(emqx_utils_binary:trim(OldBaseName, $/), [<<$/>>], [global]) of
|
|
|
% [ObjId, _ObjInsId, _ResId] -> <<$/, ObjId/binary>>;
|
|
% [ObjId, _ObjInsId, _ResId] -> <<$/, ObjId/binary>>;
|
|
|
% [ObjId, _ObjInsId] -> <<$/, ObjId/binary>>;
|
|
% [ObjId, _ObjInsId] -> <<$/, ObjId/binary>>;
|
|
|
% [ObjId] -> <<$/, ObjId/binary>>
|
|
% [ObjId] -> <<$/, ObjId/binary>>
|
|
@@ -129,7 +129,7 @@ make_path(RelativePath, Id) ->
|
|
|
<<RelativePath/binary, $/, (integer_to_binary(Id))/binary>>.
|
|
<<RelativePath/binary, $/, (integer_to_binary(Id))/binary>>.
|
|
|
|
|
|
|
|
object_id(BaseName) ->
|
|
object_id(BaseName) ->
|
|
|
- case binary:split(binary_util:trim(BaseName, $/), [<<$/>>], [global]) of
|
|
|
|
|
|
|
+ case binary:split(emqx_utils_binary:trim(BaseName, $/), [<<$/>>], [global]) of
|
|
|
[ObjId] -> binary_to_integer(ObjId);
|
|
[ObjId] -> binary_to_integer(ObjId);
|
|
|
[ObjId, _] -> binary_to_integer(ObjId);
|
|
[ObjId, _] -> binary_to_integer(ObjId);
|
|
|
[ObjId, _, _] -> binary_to_integer(ObjId);
|
|
[ObjId, _, _] -> binary_to_integer(ObjId);
|
|
@@ -137,7 +137,7 @@ object_id(BaseName) ->
|
|
|
end.
|
|
end.
|
|
|
|
|
|
|
|
object_resource_id(BaseName) ->
|
|
object_resource_id(BaseName) ->
|
|
|
- case binary:split(binary_util:trim(BaseName, $/), [<<$/>>], [global]) of
|
|
|
|
|
|
|
+ case binary:split(emqx_utils_binary:trim(BaseName, $/), [<<$/>>], [global]) of
|
|
|
[_ObjIdBin1] ->
|
|
[_ObjIdBin1] ->
|
|
|
error({invalid_basename, BaseName});
|
|
error({invalid_basename, BaseName});
|
|
|
[_ObjIdBin2, _] ->
|
|
[_ObjIdBin2, _] ->
|
|
@@ -371,8 +371,8 @@ translate_element(BaseName, [Element | ElementList], Acc) ->
|
|
|
translate_element(BaseName, ElementList, NewAcc).
|
|
translate_element(BaseName, ElementList, NewAcc).
|
|
|
|
|
|
|
|
full_path(BaseName, RelativePath) ->
|
|
full_path(BaseName, RelativePath) ->
|
|
|
- Prefix = binary_util:rtrim(BaseName, $/),
|
|
|
|
|
- Path = binary_util:ltrim(RelativePath, $/),
|
|
|
|
|
|
|
+ Prefix = emqx_utils_binary:rtrim(BaseName, $/),
|
|
|
|
|
+ Path = emqx_utils_binary:ltrim(RelativePath, $/),
|
|
|
<<Prefix/binary, $/, Path/binary>>.
|
|
<<Prefix/binary, $/, Path/binary>>.
|
|
|
|
|
|
|
|
get_element_value(#{<<"t">> := Value}) -> Value;
|
|
get_element_value(#{<<"t">> := Value}) -> Value;
|