ASN.1 multiple records with multiple record definitions

Papa Tana papa.tana101@REDACTED
Tue Jun 30 14:23:22 CEST 2020


This project is SOLVED!!
Let me share here the solution provided by some OTP team in my inbox.

===> SOLUTION: need to specify that there will be a sequence of RecordType.

%% update People.asn
List ::= SEQUENCE OF RecordType

%% insert Data in the CDR-people.dat
{ok, Binx} =
         'People':encode('PList',
                         [{person, {'Person', "John Smith", 5, 38}},
                          {contact, {'Contact', "Vanessa", "123 456"}},
                          {contact, {'Contact', "Alicia", "987 654"}},
                          {person, {'Person', "Mercator", 0, 32}}]).

file:write_file("CDR-people.dat", Binx).

%% Retrieving all the values is successful
{ok, Txt} = file:read_file("CDR-people.dat").
'People':decode('PList', Txt).


N.B:
But it works at THE ONLY CONDITION that I can change People.asn
My project in the real world is that some vendor provides me a
non-editable CDR.asn and a list of CDRxxxx.dat files containing
different types of record.
Maybe there is some Header as specified by OTP team, or any additional
field that I am missing in the Binary result decoding, I will explore
this way.



> 2020-06-30 10:13 UTC+03:00, Papa Tana <papa.tana101@REDACTED>:
> But when I'm reading the file, and decode, it only returns the first
> Person, sounds like the 3 upcoming records are ignored:
>


More information about the erlang-questions mailing list