-
Notifications
You must be signed in to change notification settings - Fork 6
User guide
mts-asn1 is a multi-platform project written in JAVA. It aims to use protocols described in ASN.1 PER. In order to do that, it allows you to write your data in various format (JSON, XML, ...).
- Create a new ASN1Translator which take ASN.1 encoding and the grammar in parameters
Example :
asn1Translator = new ASN1Translator(new PERFactory(true), Arrays.asList(S1APTests.class.getResourceAsStream("/grammar/S1AP/S1AP.asn")));
- Invoke decode or encode on it with proper parameter and your chosen dataformat
Example :
XMLFormatWriter formatWriter = new XMLFormatWriter(); asn1Translator.decode(type, this.getClass().getResourceAsStream(binaryPath), formatWriter);
or
JSONFormatReader jsonFormatReader = new JSONFormatReader(this.getClass().getResourceAsStream(expectedJsonPath), type); BitArray bitArray = new BitArray(); asn1Translator.encode(type, bitArray, jsonFormatReader);
Full example here
If you want to test a single binary message, you may want to convert your hexadecimal file to a binary file using a converter (example : here).