I tried to follow this example to encore data and send them to the server.
CertainStructure_t *cs = 0;
ber_decode(0, &asn_DEF_CertainStructure, &cs, buffer, buffer_length);
cs->val1 = 123; /* Modify the contents */
der_encode(&asn_DEF_CertainStructure, cs, write_handle, 0);
I wrote this code
Message01_t *a;
a->number = 123;
der_encode(&Message01, a, write_handle, 0);
the description of Message01 is
Message01 ::= SEQUENCE
{
number INTEGER -- inital integer
}
I got this error
error: incompatible types in assignment
error: ‘Message01’ undeclared (first use in this function)
On the assumption this is the online ASN.1 Compiler at http://lionet.info/asn1c/asn1c.cgi
And just trying to get it compiling.... Not really knowing what I'm doing:
The following just compiled:
#include <Message01.h>
int write_handle(void const*, unsigned long, void*) {
// no idea what this is
return 0;
}
int main() {
Message01_t *a=new Message01_t(); // Must be created/allocated/whatever
a->number = 123;
der_encode(&asn_DEF_Message01, a, write_handle, 0);
}
Notes:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.