Giter Site home page Giter Site logo

Comments (4)

kimgr avatar kimgr commented on July 18, 2024

Probably, yes. Can you provide a self-contained example? I.e. how is MyType defined?

from asn1ate.

huaihuaiVV avatar huaihuaiVV commented on July 18, 2024

for example:

MyType ::= SEQUENCE
{
a INTEGER,
b INTEGER,
c INTEGER
}
myValue MyType ::=
{
a 100,
b 200,
c 300
}

then, it can generate the python value named :
myValue = MyType()
myValue.setComponentByname("a", univ.integer(100))
myValue.setComponentByname("a", univ.integer(200))
myValue.setComponentByname("a", univ.integer(300))

for more complex type:

MyType2 ::= SEQUENCE
{
a SET OF SEQUENCE { m0 INTEGER, m1 INTEGER, m2 INTEGER},
b SET OF SEQUENCE { m0 INTEGER, m1 INTEGER, m2 INTEGER},
c SET OF SEQUENCE { m0 INTEGER, m1 INTEGER, m2 INTEGER}
}

myValue MyType2 ::=
{
a {{m0 1, m1 2, m3 3}, {m0 1, m1 2, m3 3}, {m0 1, m1 2, m3 3}},
b {{m0 1, m1 2, m3 3}, {m0 1, m1 2, m3 3}, {m0 1, m1 2, m3 3}},
c {{m0 1, m1 2, m3 3}, {m0 1, m1 2, m3 3}, {m0 1, m1 2, m3 3}},
}

it can generate the value:

myValue = MyType2()
myValue.setComponentByName("a", ........)
myValue.setComponentByName("b", ........)
myValue.setComponentByName("c", ........)
...

like this .

it will be very useful,
we don'e need write python code to generate these data,
just need write the ASN1 file .

Thanks a lot ~

from asn1ate.

huaihuaiVV avatar huaihuaiVV commented on July 18, 2024

and for value reference by other value:

MyType ::= SEQUENCE
{
a INTEGER,
b INTEGER,
c INTEGER
}

MyType2 ::= SEQUENCE OF MyType

myValue MyType ::=
{
a 100,
b 200,
c 300
}

myValue2 MyType2 ::= { myValue, myValue, myValue }

can generate :

myValue = myType()

myValue2 = MyType2()
myValue2.SetComponenetByPosition(0, myValue)
myValue2.SetComponenetByPosition(1, myValue)
myValue2.SetComponenetByPosition(2, myValue)

That is all !!

from asn1ate.

huaihuaiVV avatar huaihuaiVV commented on July 18, 2024

for value notation details:
http://stackoverflow.com/questions/26760194/value-notation-for-this-asn-1-schema
http://www.oss.com/asn1/resources/reference/asn1-reference-card.html

Thanks a lot ~

from asn1ate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.