DataView.asn 768 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
TASTE-Dataview DEFINITIONS ::=
BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;

-- A few simple types to start with ASN.1
MyInteger   ::= T-UInt8

MyReal      ::= REAL (0.0 .. 1000.0)

MyBool      ::= BOOLEAN

MyEnum      ::= ENUMERATED { hello, world, howareyou }

MySeq       ::= SEQUENCE {
    input-data  MyInteger,
    output-data MyInteger,
    validity    ENUMERATED { valid, invalid }
}

MyChoice    ::= CHOICE {
    a BOOLEAN,
    b MySeq
}

MySeqOf     ::= SEQUENCE (SIZE (2)) OF MyEnum

MyOctStr    ::= OCTET STRING (SIZE (3))

-- You can also declare constants
myVar       MySeqOf     ::= { hello, world }

-- Gyroscope
MyGyroVal ::= REAL (-100000.0 .. 100000.0)

-- Acceleration
MyAccVal  ::= REAL (-16.0 .. 16.0)

END