From 70fa960771aecee7cc9c07c0786c5b5641e7ae08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= The generic encode and decode functions can be invoked like this: Or, preferable like: In Erlang code it may look like: Below follows a description of how
values of each type can be represented in Erlang.
-asn1ct:encode('H323-MESSAGES','SomeChoiceType',{call,"octetstring"}).
-asn1ct:decode('H323-MESSAGES','SomeChoiceType',Bytes).
-
'H323-MESSAGES':encode('SomeChoiceType',{call,"octetstring"}).
'H323-MESSAGES':decode('SomeChoiceType',Bytes).
@@ -466,7 +462,7 @@ Operational ::= BOOLEAN --ASN.1 definition
Val = true,
-{ok,Bytes}=asn1rt:encode(MyModule,'Operational',Val),
+{ok,Bytes} = MyModule:encode('Operational', Val),
-1> {ok,Bytes1} = asn1rt:encode('PrimStrings','BMP',[{0,0,53,53},{0,0,45,56}]). +1> {ok,Bytes1} = 'PrimStrings':encode('BMP', [{0,0,53,53},{0,0,45,56}]). {ok,[30,4,"55-8"]} -2> asn1rt:decode('PrimStrings','BMP',list_to_binary(Bytes1)). +2> 'PrimStrings':decode('BMP', list_to_binary(Bytes1)). {ok,[{0,0,53,53},{0,0,45,56}]} -3> {ok,Bytes2} = asn1rt:encode('PrimStrings','BMP',[{0,0,53,53},{0,0,0,65}]). +3> {ok,Bytes2} = 'PrimStrings':encode('BMP', [{0,0,53,53},{0,0,0,65}]). {ok,[30,4,[53,53,0,65]]} -4> asn1rt:decode('PrimStrings','BMP',list_to_binary(Bytes2)). +4> 'PrimStrings':decode('BMP', list_to_binary(Bytes2)). {ok,[{0,0,53,53},65]} -5> {ok,Bytes3} = asn1rt:encode('PrimStrings','BMP',"BMP string"). +5> {ok,Bytes3} = 'PrimStrings':encode('BMP', "BMP string"). {ok,[30,20,[0,66,0,77,0,80,0,32,0,115,0,116,0,114,0,105,0,110,0,103]]} -6> asn1rt:decode('PrimStrings','BMP',list_to_binary(Bytes3)). +6> 'PrimStrings':decode('BMP', list_to_binary(Bytes3)). {ok,"BMP string"}
The UTF8String is represented in Erlang as a list of integers, where each integer represents the unicode value of one -- cgit v1.2.3