Skip to content

How to encode and receive struct? #160

Answered by chenjunbiao
kuredoro asked this question in Q&A
Discussion options

You must be logged in to vote

Please set member variables to start with an uppercase letter, like this:

type Data struct {
	A string `y3:"0x11"`
	B string `y3:"0x12"`
	C string `y3:"0x13"`
	D string `y3:"0x14"`
	E string `y3:"0x15"`
}

then you can receive the data:

Received: [144 24 17 1 97 18 2 98 99 19 3 100 101 102 20 3 103 104 105 21 5 106 107 108 109 110]
[StdOut]:  {a bc def ghi jklmn}
Received: [144 24 17 1 97 18 2 98 99 19 3 100 101 102 20 3 103 104 105 21 5 106 107 108 109 110]
[StdOut]:  {a bc def ghi jklmn}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kuredoro
Comment options

Answer selected by fanweixiao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants