%% Generated by the Erlang ASN.1 PER (unaligned) compiler. Version: 5.0.9 %% Purpose: Encoding and decoding of the types in AddGrpC. -module('AddGrpC'). -compile(nowarn_unused_vars). -dialyzer(no_improper_lists). -asn1_info([{vsn,'5.0.9'}, {module,'AddGrpC'}, {options,[{i,"src"},maps,uper,noobj,{outdir,"src"},{i,"."},{i,"asn1"}]}]). -export([encoding_rule/0,maps/0,bit_string_format/0, legacy_erlang_types/0]). -export(['dialyzer-suppressions'/1]). -export([ enc_AltitudeConfidence/1, enc_AltitudeValue/1, enc_EmissionType/1, enc_Altitude/1, enc_PrioritizationResponse/1, enc_PrioritizationResponseList/1, 'enc_ConnectionManeuverAssist-addGrpC'/1, 'enc_IntersectionState-addGrpC'/1, 'enc_MapData-addGrpC'/1, 'enc_Position3D-addGrpC'/1, 'enc_RestrictionUserType-addGrpC'/1, enc_SignalHeadLocation/1, enc_SignalHeadLocationList/1, enc_VehicleToLanePosition/1, enc_VehicleToLanePositionList/1 ]). -export([ dec_AltitudeConfidence/1, dec_AltitudeValue/1, dec_EmissionType/1, dec_Altitude/1, dec_PrioritizationResponse/1, dec_PrioritizationResponseList/1, 'dec_ConnectionManeuverAssist-addGrpC'/1, 'dec_IntersectionState-addGrpC'/1, 'dec_MapData-addGrpC'/1, 'dec_Position3D-addGrpC'/1, 'dec_RestrictionUserType-addGrpC'/1, dec_SignalHeadLocation/1, dec_SignalHeadLocationList/1, dec_VehicleToLanePosition/1, dec_VehicleToLanePositionList/1 ]). -export([info/0]). -export([encode/2,decode/2]). encoding_rule() -> uper. maps() -> true. bit_string_format() -> bitstring. legacy_erlang_types() -> false. encode(Type, Data) -> try complete(encode_disp(Type, Data)) of Bytes -> {ok,Bytes} catch Class:Exception:Stk when Class =:= error; Class =:= exit -> case Exception of {error,{asn1,Reason}} -> {error,{asn1,{Reason,Stk}}}; Reason -> {error,{asn1,{Reason,Stk}}} end end. decode(Type, Data) -> try {Result,_Rest} = decode_disp(Type, Data), {ok,Result} catch Class:Exception:Stk when Class =:= error; Class =:= exit -> case Exception of {error,{asn1,Reason}} -> {error,{asn1,{Reason,Stk}}}; Reason -> {error,{asn1,{Reason,Stk}}} end end. encode_disp('AltitudeConfidence', Data) -> enc_AltitudeConfidence(Data); encode_disp('AltitudeValue', Data) -> enc_AltitudeValue(Data); encode_disp('EmissionType', Data) -> enc_EmissionType(Data); encode_disp('Altitude', Data) -> enc_Altitude(Data); encode_disp('PrioritizationResponse', Data) -> enc_PrioritizationResponse(Data); encode_disp('PrioritizationResponseList', Data) -> enc_PrioritizationResponseList(Data); encode_disp('ConnectionManeuverAssist-addGrpC', Data) -> 'enc_ConnectionManeuverAssist-addGrpC'(Data); encode_disp('IntersectionState-addGrpC', Data) -> 'enc_IntersectionState-addGrpC'(Data); encode_disp('MapData-addGrpC', Data) -> 'enc_MapData-addGrpC'(Data); encode_disp('Position3D-addGrpC', Data) -> 'enc_Position3D-addGrpC'(Data); encode_disp('RestrictionUserType-addGrpC', Data) -> 'enc_RestrictionUserType-addGrpC'(Data); encode_disp('SignalHeadLocation', Data) -> enc_SignalHeadLocation(Data); encode_disp('SignalHeadLocationList', Data) -> enc_SignalHeadLocationList(Data); encode_disp('VehicleToLanePosition', Data) -> enc_VehicleToLanePosition(Data); encode_disp('VehicleToLanePositionList', Data) -> enc_VehicleToLanePositionList(Data); encode_disp(Type, _Data) -> exit({error,{asn1,{undefined_type,Type}}}). decode_disp('AltitudeConfidence', Data) -> dec_AltitudeConfidence(Data); decode_disp('AltitudeValue', Data) -> dec_AltitudeValue(Data); decode_disp('EmissionType', Data) -> dec_EmissionType(Data); decode_disp('Altitude', Data) -> dec_Altitude(Data); decode_disp('PrioritizationResponse', Data) -> dec_PrioritizationResponse(Data); decode_disp('PrioritizationResponseList', Data) -> dec_PrioritizationResponseList(Data); decode_disp('ConnectionManeuverAssist-addGrpC', Data) -> 'dec_ConnectionManeuverAssist-addGrpC'(Data); decode_disp('IntersectionState-addGrpC', Data) -> 'dec_IntersectionState-addGrpC'(Data); decode_disp('MapData-addGrpC', Data) -> 'dec_MapData-addGrpC'(Data); decode_disp('Position3D-addGrpC', Data) -> 'dec_Position3D-addGrpC'(Data); decode_disp('RestrictionUserType-addGrpC', Data) -> 'dec_RestrictionUserType-addGrpC'(Data); decode_disp('SignalHeadLocation', Data) -> dec_SignalHeadLocation(Data); decode_disp('SignalHeadLocationList', Data) -> dec_SignalHeadLocationList(Data); decode_disp('VehicleToLanePosition', Data) -> dec_VehicleToLanePosition(Data); decode_disp('VehicleToLanePositionList', Data) -> dec_VehicleToLanePositionList(Data); decode_disp(Type, _Data) -> exit({error,{asn1,{undefined_type,Type}}}). info() -> case ?MODULE:module_info(attributes) of Attributes when is_list(Attributes) -> case lists:keyfind(asn1_info, 1, Attributes) of {_,Info} when is_list(Info) -> Info; _ -> [] end; _ -> [] end. enc_AltitudeConfidence(Val) -> if Val =:= 'alt-000-01' -> <<0:4>>; Val =:= 'alt-000-02' -> <<1:4>>; Val =:= 'alt-000-05' -> <<2:4>>; Val =:= 'alt-000-10' -> <<3:4>>; Val =:= 'alt-000-20' -> <<4:4>>; Val =:= 'alt-000-50' -> <<5:4>>; Val =:= 'alt-001-00' -> <<6:4>>; Val =:= 'alt-002-00' -> <<7:4>>; Val =:= 'alt-005-00' -> <<8:4>>; Val =:= 'alt-010-00' -> <<9:4>>; Val =:= 'alt-020-00' -> <<10:4>>; Val =:= 'alt-050-00' -> <<11:4>>; Val =:= 'alt-100-00' -> <<12:4>>; Val =:= 'alt-200-00' -> <<13:4>>; Val =:= outOfRange -> <<14:4>>; Val =:= unavailable -> <<15:4>>; true -> exit({error,{asn1,{illegal_enumerated,Val}}}) end. dec_AltitudeConfidence(Bytes) -> begin <> = Bytes, V1@Int2 = case V1@V0 of 0 -> 'alt-000-01'; 1 -> 'alt-000-02'; 2 -> 'alt-000-05'; 3 -> 'alt-000-10'; 4 -> 'alt-000-20'; 5 -> 'alt-000-50'; 6 -> 'alt-001-00'; 7 -> 'alt-002-00'; 8 -> 'alt-005-00'; 9 -> 'alt-010-00'; 10 -> 'alt-020-00'; 11 -> 'alt-050-00'; 12 -> 'alt-100-00'; 13 -> 'alt-200-00'; 14 -> outOfRange; 15 -> unavailable end, {V1@Int2,V1@Buf1} end. enc_AltitudeValue(Val) -> Val@sub = Val - -100000, if 0 =< Val@sub, Val@sub < 900002 -> <>; true -> exit({error,{asn1,{illegal_integer,Val}}}) end. dec_AltitudeValue(Bytes) -> begin <> = Bytes, V1@Add2 = V1@V0 + -100000, {V1@Add2,V1@Buf1} end. enc_EmissionType(Val) -> if Val =:= typeA -> <<0:1,0:3>>; Val =:= typeB -> <<0:1,1:3>>; Val =:= typeC -> <<0:1,2:3>>; Val =:= typeD -> <<0:1,3:3>>; Val =:= typeE -> <<0:1,4:3>>; true -> exit({error,{asn1,{illegal_enumerated,Val}}}) end. dec_EmissionType(Bytes) -> begin {V1@V0,V1@Buf1} = case Bytes of <<0:1,V1@V3:3,V1@Buf4/bitstring>> -> V1@Int5 = case V1@V3 of 0 -> typeA; 1 -> typeB; 2 -> typeC; 3 -> typeD; 4 -> typeE; _ -> exit({error,{asn1,{decode_enumerated,V1@V3}}}) end, {V1@Int5,V1@Buf4}; <<1:1,V1@Buf2/bitstring>> -> {V1@V3,V1@Buf4} = case V1@Buf2 of <<0:1,V1@V6:6,V1@Buf7/bitstring>> -> {V1@V6,V1@Buf7}; <<1:1,V1@Buf5/bitstring>> -> {V1@V6,V1@Buf7} = case V1@Buf5 of <<0:1,V1@V9:7,V1@Buf10/bitstring>> when V1@V9 =/= 0 -> {V1@V9,V1@Buf10}; <<1:1,0:1,V1@V10:14,V1@Buf11/bitstring>> when V1@V10 =/= 0 -> {V1@V10,V1@Buf11} end, <> = V1@Buf7, {V1@V12,V1@Buf13} end, V1@Int14 = case V1@V3 of _ -> {asn1_enum,V1@V3} end, {V1@Int14,V1@Buf4} end, {V1@V0,V1@Buf1} end. enc_Altitude(Val) -> #{value:=Input@1,confidence:=Input@2} = Val, [begin %% attribute value(1) with type INTEGER Input@1@sub = Input@1 - -100000, if 0 =< Input@1@sub, Input@1@sub < 900002 -> <>; true -> exit({error,{asn1,{illegal_integer,Input@1}}}) end end|begin %% attribute confidence(2) with type ENUMERATED if Input@2 =:= 'alt-000-01' -> <<0:4>>; Input@2 =:= 'alt-000-02' -> <<1:4>>; Input@2 =:= 'alt-000-05' -> <<2:4>>; Input@2 =:= 'alt-000-10' -> <<3:4>>; Input@2 =:= 'alt-000-20' -> <<4:4>>; Input@2 =:= 'alt-000-50' -> <<5:4>>; Input@2 =:= 'alt-001-00' -> <<6:4>>; Input@2 =:= 'alt-002-00' -> <<7:4>>; Input@2 =:= 'alt-005-00' -> <<8:4>>; Input@2 =:= 'alt-010-00' -> <<9:4>>; Input@2 =:= 'alt-020-00' -> <<10:4>>; Input@2 =:= 'alt-050-00' -> <<11:4>>; Input@2 =:= 'alt-100-00' -> <<12:4>>; Input@2 =:= 'alt-200-00' -> <<13:4>>; Input@2 =:= outOfRange -> <<14:4>>; Input@2 =:= unavailable -> <<15:4>>; true -> exit({error,{asn1,{illegal_enumerated,Input@2}}}) end end]. dec_Altitude(Bytes) -> %% attribute value(1) with type INTEGER {Term1,Bytes1} = begin <> = Bytes, V1@Add2 = V1@V0 + -100000, {V1@Add2,V1@Buf1} end, %% attribute confidence(2) with type ENUMERATED {Term2,Bytes2} = begin <> = Bytes1, V2@Int2 = case V2@V0 of 0 -> 'alt-000-01'; 1 -> 'alt-000-02'; 2 -> 'alt-000-05'; 3 -> 'alt-000-10'; 4 -> 'alt-000-20'; 5 -> 'alt-000-50'; 6 -> 'alt-001-00'; 7 -> 'alt-002-00'; 8 -> 'alt-005-00'; 9 -> 'alt-010-00'; 10 -> 'alt-020-00'; 11 -> 'alt-050-00'; 12 -> 'alt-100-00'; 13 -> 'alt-200-00'; 14 -> outOfRange; 15 -> unavailable end, {V2@Int2,V2@Buf1} end, Res1 = #{value=>Term1,confidence=>Term2}, {Res1,Bytes2}. enc_PrioritizationResponse(Val) -> #{stationID:=Input@1,priorState:=Input@2,signalGroup:=Input@3} = Val, [begin %% attribute stationID(1) with type INTEGER if Input@1 bsr 32 =:= 0 -> <<0:1,Input@1:32>>; true -> exit({error,{asn1,{illegal_integer,Input@1}}}) end end, begin %% attribute priorState(2) with type ENUMERATED if Input@2 =:= unknown -> <<0:1,0:3>>; Input@2 =:= requested -> <<0:1,1:3>>; Input@2 =:= processing -> <<0:1,2:3>>; Input@2 =:= watchOtherTraffic -> <<0:1,3:3>>; Input@2 =:= granted -> <<0:1,4:3>>; Input@2 =:= rejected -> <<0:1,5:3>>; Input@2 =:= maxPresence -> <<0:1,6:3>>; Input@2 =:= reserviceLocked -> <<0:1,7:3>>; true -> exit({error,{asn1,{illegal_enumerated,Input@2}}}) end end|begin %% attribute signalGroup(3) with type INTEGER if Input@3 bsr 8 =:= 0 -> [Input@3]; true -> exit({error,{asn1,{illegal_integer,Input@3}}}) end end]. dec_PrioritizationResponse(Bytes) -> {Ext,Bytes1} = begin <> = Bytes, {V1@V0,V1@Buf1} end, %% attribute stationID(1) with type INTEGER {Term1,Bytes2} = begin <> = Bytes1, {V2@V0,V2@Buf1} end, %% attribute priorState(2) with type ENUMERATED {Term2,Bytes3} = begin {V3@V0,V3@Buf1} = case Bytes2 of <<0:1,V3@V3:3,V3@Buf4/bitstring>> -> V3@Int5 = case V3@V3 of 0 -> unknown; 1 -> requested; 2 -> processing; 3 -> watchOtherTraffic; 4 -> granted; 5 -> rejected; 6 -> maxPresence; 7 -> reserviceLocked end, {V3@Int5,V3@Buf4}; <<1:1,V3@Buf2/bitstring>> -> {V3@V3,V3@Buf4} = case V3@Buf2 of <<0:1,V3@V6:6,V3@Buf7/bitstring>> -> {V3@V6,V3@Buf7}; <<1:1,V3@Buf5/bitstring>> -> {V3@V6,V3@Buf7} = case V3@Buf5 of <<0:1,V3@V9:7,V3@Buf10/bitstring>> when V3@V9 =/= 0 -> {V3@V9,V3@Buf10}; <<1:1,0:1,V3@V10:14,V3@Buf11/bitstring>> when V3@V10 =/= 0 -> {V3@V10,V3@Buf11} end, <> = V3@Buf7, {V3@V12,V3@Buf13} end, V3@Int14 = case V3@V3 of _ -> {asn1_enum,V3@V3} end, {V3@Int14,V3@Buf4} end, {V3@V0,V3@Buf1} end, %% attribute signalGroup(3) with type INTEGER {Term3,Bytes4} = begin <> = Bytes3, {V4@V0,V4@Buf1} end, %% Extensions {Extensions,Bytes5} = case Ext of 0 -> {<<>>,Bytes4}; 1 -> {V5@V0,V5@Buf1} = case Bytes4 of <<0:1,V5@V3:6,V5@Buf4/bitstring>> -> V5@Add5 = V5@V3 + 1, {V5@Add5,V5@Buf4}; <<1:1,V5@Buf2/bitstring>> -> {V5@V3,V5@Buf4} = case V5@Buf2 of <<0:1,V5@V6:7,V5@Buf7/bitstring>> when V5@V6 =/= 0 -> {V5@V6,V5@Buf7}; <<1:1,0:1,V5@V7:14,V5@Buf8/bitstring>> when V5@V7 =/= 0 -> {V5@V7,V5@Buf8} end, {V5@V3,V5@Buf4} end, <> = V5@Buf1, {V5@V9,V5@Buf10} end, Bytes6= skipextensions(Bytes5, 1, Extensions), Res1 = #{stationID=>Term1,priorState=>Term2,signalGroup=>Term3}, {Res1,Bytes6}. enc_PrioritizationResponseList(Val) -> Enc1@len = length(Val), Enc1@len@sub = Enc1@len - 1, if 0 =< Enc1@len@sub, Enc1@len@sub < 10 -> [<>|[enc_PrioritizationResponse(Comp) || Comp <- Val]] end. dec_PrioritizationResponseList(Bytes) -> %% Length with constraint {1,10} <> = Bytes, V1@Add2 = V1@V0 + 1, dec_components1(V1@Add2, V1@Buf1, []). 'enc_ConnectionManeuverAssist-addGrpC'(Val) -> #{vehicleToLanePositions:=Input@1} = Val, Input@2 = case Val of #{rsuDistanceFromAnchor:=Input@2_0} -> Input@2_0; _ -> asn1__MISSING_IN_MAP end, [if Input@2 =:= asn1__MISSING_IN_MAP -> <<0:1>>; true -> <<1:1>> end, begin %% attribute vehicleToLanePositions(1) with type VehicleToLanePositionList enc_VehicleToLanePositionList(Input@1) end|begin %% attribute rsuDistanceFromAnchor(2) with type NodeOffsetPointXY if Input@2 =:= asn1__MISSING_IN_MAP -> []; true -> 'DSRC':enc_NodeOffsetPointXY(Input@2) end end]. 'dec_ConnectionManeuverAssist-addGrpC'(Bytes) -> {Opt,Bytes1} = begin <> = Bytes, {V1@V0,V1@Buf1} end, %% attribute vehicleToLanePositions(1) with type VehicleToLanePositionList {Term1,Bytes2} = dec_VehicleToLanePositionList(Bytes1), %% attribute rsuDistanceFromAnchor(2) with type NodeOffsetPointXY {Term2,Bytes3} = case Opt band 1 of 1 -> 'DSRC':dec_NodeOffsetPointXY(Bytes2); 0 -> {asn1_NOVALUE,Bytes2} end, Res1 = #{vehicleToLanePositions=>Term1}, Res2 = case Term2 of asn1_NOVALUE -> Res1; _ -> Res1#{rsuDistanceFromAnchor=>Term2} end, {Res2,Bytes3}. 'enc_IntersectionState-addGrpC'(Val) -> Input@1 = case Val of #{activePrioritizations:=Input@1_0} -> Input@1_0; _ -> asn1__MISSING_IN_MAP end, [if Input@1 =:= asn1__MISSING_IN_MAP -> <<0:1,0:1>>; true -> <<0:1,1:1>> end|begin %% attribute activePrioritizations(1) with type PrioritizationResponseList if Input@1 =:= asn1__MISSING_IN_MAP -> []; true -> enc_PrioritizationResponseList(Input@1) end end]. 'dec_IntersectionState-addGrpC'(Bytes) -> {Ext,Bytes1} = begin <> = Bytes, {V1@V0,V1@Buf1} end, {Opt,Bytes2} = begin <> = Bytes1, {V2@V0,V2@Buf1} end, %% attribute activePrioritizations(1) with type PrioritizationResponseList {Term1,Bytes3} = case Opt band 1 of 1 -> dec_PrioritizationResponseList(Bytes2); 0 -> {asn1_NOVALUE,Bytes2} end, %% Extensions {Extensions,Bytes4} = case Ext of 0 -> {<<>>,Bytes3}; 1 -> {V3@V0,V3@Buf1} = case Bytes3 of <<0:1,V3@V3:6,V3@Buf4/bitstring>> -> V3@Add5 = V3@V3 + 1, {V3@Add5,V3@Buf4}; <<1:1,V3@Buf2/bitstring>> -> {V3@V3,V3@Buf4} = case V3@Buf2 of <<0:1,V3@V6:7,V3@Buf7/bitstring>> when V3@V6 =/= 0 -> {V3@V6,V3@Buf7}; <<1:1,0:1,V3@V7:14,V3@Buf8/bitstring>> when V3@V7 =/= 0 -> {V3@V7,V3@Buf8} end, {V3@V3,V3@Buf4} end, <> = V3@Buf1, {V3@V9,V3@Buf10} end, Bytes5= skipextensions(Bytes4, 1, Extensions), Res1 = #{}, Res2 = case Term1 of asn1_NOVALUE -> Res1; _ -> Res1#{activePrioritizations=>Term1} end, {Res2,Bytes5}. 'enc_MapData-addGrpC'(Val) -> Input@1 = case Val of #{signalHeadLocations:=Input@1_0} -> Input@1_0; _ -> asn1__MISSING_IN_MAP end, [if Input@1 =:= asn1__MISSING_IN_MAP -> <<0:1,0:1>>; true -> <<0:1,1:1>> end|begin %% attribute signalHeadLocations(1) with type SignalHeadLocationList if Input@1 =:= asn1__MISSING_IN_MAP -> []; true -> enc_SignalHeadLocationList(Input@1) end end]. 'dec_MapData-addGrpC'(Bytes) -> {Ext,Bytes1} = begin <> = Bytes, {V1@V0,V1@Buf1} end, {Opt,Bytes2} = begin <> = Bytes1, {V2@V0,V2@Buf1} end, %% attribute signalHeadLocations(1) with type SignalHeadLocationList {Term1,Bytes3} = case Opt band 1 of 1 -> dec_SignalHeadLocationList(Bytes2); 0 -> {asn1_NOVALUE,Bytes2} end, %% Extensions {Extensions,Bytes4} = case Ext of 0 -> {<<>>,Bytes3}; 1 -> {V3@V0,V3@Buf1} = case Bytes3 of <<0:1,V3@V3:6,V3@Buf4/bitstring>> -> V3@Add5 = V3@V3 + 1, {V3@Add5,V3@Buf4}; <<1:1,V3@Buf2/bitstring>> -> {V3@V3,V3@Buf4} = case V3@Buf2 of <<0:1,V3@V6:7,V3@Buf7/bitstring>> when V3@V6 =/= 0 -> {V3@V6,V3@Buf7}; <<1:1,0:1,V3@V7:14,V3@Buf8/bitstring>> when V3@V7 =/= 0 -> {V3@V7,V3@Buf8} end, {V3@V3,V3@Buf4} end, <> = V3@Buf1, {V3@V9,V3@Buf10} end, Bytes5= skipextensions(Bytes4, 1, Extensions), Res1 = #{}, Res2 = case Term1 of asn1_NOVALUE -> Res1; _ -> Res1#{signalHeadLocations=>Term1} end, {Res2,Bytes5}. 'enc_Position3D-addGrpC'(Val) -> #{altitude:=Input@1} = Val, [<<0:1>>|begin %% attribute altitude(1) with type Altitude enc_Altitude(Input@1) end]. 'dec_Position3D-addGrpC'(Bytes) -> {Ext,Bytes1} = begin <> = Bytes, {V1@V0,V1@Buf1} end, %% attribute altitude(1) with type Altitude {Term1,Bytes2} = dec_Altitude(Bytes1), %% Extensions {Extensions,Bytes3} = case Ext of 0 -> {<<>>,Bytes2}; 1 -> {V2@V0,V2@Buf1} = case Bytes2 of <<0:1,V2@V3:6,V2@Buf4/bitstring>> -> V2@Add5 = V2@V3 + 1, {V2@Add5,V2@Buf4}; <<1:1,V2@Buf2/bitstring>> -> {V2@V3,V2@Buf4} = case V2@Buf2 of <<0:1,V2@V6:7,V2@Buf7/bitstring>> when V2@V6 =/= 0 -> {V2@V6,V2@Buf7}; <<1:1,0:1,V2@V7:14,V2@Buf8/bitstring>> when V2@V7 =/= 0 -> {V2@V7,V2@Buf8} end, {V2@V3,V2@Buf4} end, <> = V2@Buf1, {V2@V9,V2@Buf10} end, Bytes4= skipextensions(Bytes3, 1, Extensions), Res1 = #{altitude=>Term1}, {Res1,Bytes4}. 'enc_RestrictionUserType-addGrpC'(Val) -> Input@1 = case Val of #{emission:=Input@1_0} -> Input@1_0; _ -> asn1__MISSING_IN_MAP end, [if Input@1 =:= asn1__MISSING_IN_MAP -> <<0:1,0:1>>; true -> <<0:1,1:1>> end|begin %% attribute emission(1) with type ENUMERATED if Input@1 =:= asn1__MISSING_IN_MAP -> []; Input@1 =:= typeA -> <<0:1,0:3>>; Input@1 =:= typeB -> <<0:1,1:3>>; Input@1 =:= typeC -> <<0:1,2:3>>; Input@1 =:= typeD -> <<0:1,3:3>>; Input@1 =:= typeE -> <<0:1,4:3>>; true -> exit({error,{asn1,{illegal_enumerated,Input@1}}}) end end]. 'dec_RestrictionUserType-addGrpC'(Bytes) -> {Ext,Bytes1} = begin <> = Bytes, {V1@V0,V1@Buf1} end, {Opt,Bytes2} = begin <> = Bytes1, {V2@V0,V2@Buf1} end, %% attribute emission(1) with type ENUMERATED {Term1,Bytes3} = case Opt band 1 of 1 -> begin {V3@V0,V3@Buf1} = case Bytes2 of <<0:1,V3@V3:3,V3@Buf4/bitstring>> -> V3@Int5 = case V3@V3 of 0 -> typeA; 1 -> typeB; 2 -> typeC; 3 -> typeD; 4 -> typeE; _ -> exit({error,{asn1,{decode_enumerated,V3@V3}}}) end, {V3@Int5,V3@Buf4}; <<1:1,V3@Buf2/bitstring>> -> {V3@V3,V3@Buf4} = case V3@Buf2 of <<0:1,V3@V6:6,V3@Buf7/bitstring>> -> {V3@V6,V3@Buf7}; <<1:1,V3@Buf5/bitstring>> -> {V3@V6,V3@Buf7} = case V3@Buf5 of <<0:1,V3@V9:7,V3@Buf10/bitstring>> when V3@V9 =/= 0 -> {V3@V9,V3@Buf10}; <<1:1,0:1,V3@V10:14,V3@Buf11/bitstring>> when V3@V10 =/= 0 -> {V3@V10,V3@Buf11} end, <> = V3@Buf7, {V3@V12,V3@Buf13} end, V3@Int14 = case V3@V3 of _ -> {asn1_enum,V3@V3} end, {V3@Int14,V3@Buf4} end, {V3@V0,V3@Buf1} end; 0 -> {asn1_NOVALUE,Bytes2} end, %% Extensions {Extensions,Bytes4} = case Ext of 0 -> {<<>>,Bytes3}; 1 -> {V4@V0,V4@Buf1} = case Bytes3 of <<0:1,V4@V3:6,V4@Buf4/bitstring>> -> V4@Add5 = V4@V3 + 1, {V4@Add5,V4@Buf4}; <<1:1,V4@Buf2/bitstring>> -> {V4@V3,V4@Buf4} = case V4@Buf2 of <<0:1,V4@V6:7,V4@Buf7/bitstring>> when V4@V6 =/= 0 -> {V4@V6,V4@Buf7}; <<1:1,0:1,V4@V7:14,V4@Buf8/bitstring>> when V4@V7 =/= 0 -> {V4@V7,V4@Buf8} end, {V4@V3,V4@Buf4} end, <> = V4@Buf1, {V4@V9,V4@Buf10} end, Bytes5= skipextensions(Bytes4, 1, Extensions), Res1 = #{}, Res2 = case Term1 of asn1_NOVALUE -> Res1; _ -> Res1#{emission=>Term1} end, {Res2,Bytes5}. enc_SignalHeadLocation(Val) -> #{node:=Input@1,signalGroupID:=Input@2} = Val, [<<0:1>>, begin %% attribute node(1) with type NodeOffsetPointXY 'DSRC':enc_NodeOffsetPointXY(Input@1) end|begin %% attribute signalGroupID(2) with type INTEGER if Input@2 bsr 8 =:= 0 -> [Input@2]; true -> exit({error,{asn1,{illegal_integer,Input@2}}}) end end]. dec_SignalHeadLocation(Bytes) -> {Ext,Bytes1} = begin <> = Bytes, {V1@V0,V1@Buf1} end, %% attribute node(1) with type NodeOffsetPointXY {Term1,Bytes2} = 'DSRC':dec_NodeOffsetPointXY(Bytes1), %% attribute signalGroupID(2) with type INTEGER {Term2,Bytes3} = begin <> = Bytes2, {V2@V0,V2@Buf1} end, %% Extensions {Extensions,Bytes4} = case Ext of 0 -> {<<>>,Bytes3}; 1 -> {V3@V0,V3@Buf1} = case Bytes3 of <<0:1,V3@V3:6,V3@Buf4/bitstring>> -> V3@Add5 = V3@V3 + 1, {V3@Add5,V3@Buf4}; <<1:1,V3@Buf2/bitstring>> -> {V3@V3,V3@Buf4} = case V3@Buf2 of <<0:1,V3@V6:7,V3@Buf7/bitstring>> when V3@V6 =/= 0 -> {V3@V6,V3@Buf7}; <<1:1,0:1,V3@V7:14,V3@Buf8/bitstring>> when V3@V7 =/= 0 -> {V3@V7,V3@Buf8} end, {V3@V3,V3@Buf4} end, <> = V3@Buf1, {V3@V9,V3@Buf10} end, Bytes5= skipextensions(Bytes4, 1, Extensions), Res1 = #{node=>Term1,signalGroupID=>Term2}, {Res1,Bytes5}. enc_SignalHeadLocationList(Val) -> Enc1@len = length(Val), Enc1@len@sub = Enc1@len - 1, if 0 =< Enc1@len@sub, Enc1@len@sub < 20 -> [<>|[enc_SignalHeadLocation(Comp) || Comp <- Val]] end. dec_SignalHeadLocationList(Bytes) -> %% Length with constraint {1,20} <> = Bytes, V1@Add2 = V1@V0 + 1, dec_components2(V1@Add2, V1@Buf1, []). enc_VehicleToLanePosition(Val) -> #{stationID:=Input@1,laneID:=Input@2} = Val, [begin %% attribute stationID(1) with type INTEGER if Input@1 bsr 32 =:= 0 -> <<0:1,Input@1:32>>; true -> exit({error,{asn1,{illegal_integer,Input@1}}}) end end|begin %% attribute laneID(2) with type INTEGER if Input@2 bsr 8 =:= 0 -> [Input@2]; true -> exit({error,{asn1,{illegal_integer,Input@2}}}) end end]. dec_VehicleToLanePosition(Bytes) -> {Ext,Bytes1} = begin <> = Bytes, {V1@V0,V1@Buf1} end, %% attribute stationID(1) with type INTEGER {Term1,Bytes2} = begin <> = Bytes1, {V2@V0,V2@Buf1} end, %% attribute laneID(2) with type INTEGER {Term2,Bytes3} = begin <> = Bytes2, {V3@V0,V3@Buf1} end, %% Extensions {Extensions,Bytes4} = case Ext of 0 -> {<<>>,Bytes3}; 1 -> {V4@V0,V4@Buf1} = case Bytes3 of <<0:1,V4@V3:6,V4@Buf4/bitstring>> -> V4@Add5 = V4@V3 + 1, {V4@Add5,V4@Buf4}; <<1:1,V4@Buf2/bitstring>> -> {V4@V3,V4@Buf4} = case V4@Buf2 of <<0:1,V4@V6:7,V4@Buf7/bitstring>> when V4@V6 =/= 0 -> {V4@V6,V4@Buf7}; <<1:1,0:1,V4@V7:14,V4@Buf8/bitstring>> when V4@V7 =/= 0 -> {V4@V7,V4@Buf8} end, {V4@V3,V4@Buf4} end, <> = V4@Buf1, {V4@V9,V4@Buf10} end, Bytes5= skipextensions(Bytes4, 1, Extensions), Res1 = #{stationID=>Term1,laneID=>Term2}, {Res1,Bytes5}. enc_VehicleToLanePositionList(Val) -> Enc1@len = length(Val), Enc1@len@sub = Enc1@len - 1, if 0 =< Enc1@len@sub, Enc1@len@sub < 5 -> [<>|[enc_VehicleToLanePosition(Comp) || Comp <- Val]] end. dec_VehicleToLanePositionList(Bytes) -> %% Length with constraint {1,5} <> = Bytes, V1@Add2 = V1@V0 + 1, dec_components3(V1@Add2, V1@Buf1, []). %%% %%% Run-time functions. %%% 'dialyzer-suppressions'(Arg) -> complete(element(1, Arg)), ok. dec_components1(0, Bytes, Acc) -> {lists:reverse(Acc),Bytes}; dec_components1(Num, Bytes, Acc) -> {Term,Remain} = dec_PrioritizationResponse(Bytes), dec_components1(Num-1, Remain, [Term|Acc]). dec_components2(0, Bytes, Acc) -> {lists:reverse(Acc),Bytes}; dec_components2(Num, Bytes, Acc) -> {Term,Remain} = dec_SignalHeadLocation(Bytes), dec_components2(Num-1, Remain, [Term|Acc]). dec_components3(0, Bytes, Acc) -> {lists:reverse(Acc),Bytes}; dec_components3(Num, Bytes, Acc) -> {Term,Remain} = dec_VehicleToLanePosition(Bytes), dec_components3(Num-1, Remain, [Term|Acc]). complete(InList) when is_list(InList) -> case list_to_bitstring(InList) of <<>> -> <<0>>; Res -> Sz = bit_size(Res), case Sz band 7 of 0 -> Res; Bits -> <> end end; complete(Bin) when is_binary(Bin) -> case Bin of <<>> -> <<0>>; _ -> Bin end; complete(InList) when is_bitstring(InList) -> Sz = bit_size(InList), PadLen = 8 - Sz band 7, <>. decode_length(<<0:1,Oct:7,Rest/bitstring>>) -> {Oct, Rest}; decode_length(<<2:2,Val:14,Rest/bitstring>>) -> {Val, Rest}; decode_length(<<3:2,_:14,_Rest/bitstring>>) -> exit({error, {asn1, {decode_length, {nyi, above_16k}}}}). skipextensions(Bytes0, Nr, ExtensionBitstr) when is_bitstring(ExtensionBitstr) -> Prev = Nr - 1, case ExtensionBitstr of <<_:Prev,1:1,_/bitstring>> -> {Len, Bytes1} = decode_length(Bytes0), <<_:Len/binary,Bytes2/bitstring>> = Bytes1, skipextensions(Bytes2, Nr + 1, ExtensionBitstr); <<_:Prev,0:1,_/bitstring>> -> skipextensions(Bytes0, Nr + 1, ExtensionBitstr); _ -> Bytes0 end.