Handle TypedParamStrings (#46)

* Handle TypedParamStrings

Add handling for TypedParamStrings, which are different from the other
TypedParam... types in that the decoded value is variable-sized.
This commit is contained in:
Geoff Hickey
2017-09-15 10:48:46 -04:00
committed by GitHub
parent c8e4b6a7b8
commit a339d0ac95
2 changed files with 146 additions and 48 deletions

View File

@@ -414,7 +414,7 @@ var testSetBlockIoTuneReply = []byte{
// the result returned by an actual call to GetBlockIoTune, and then adding the
// standard header to the beginning. The length parameter has to be correct!
var testGetBlockIoTuneReply = []byte{
0x00, 0x00, 0x02, 0xe0, // length
0x00, 0x00, 0x03, 0x00, // length
0x20, 0x00, 0x80, 0x86, // program
0x00, 0x00, 0x00, 0x01, // version
0x00, 0x00, 0x00, 0xfd, // procedure
@@ -422,7 +422,7 @@ var testGetBlockIoTuneReply = []byte{
0x00, 0x00, 0x00, 0x00, // serial
0x00, 0x00, 0x00, 0x00, // status
0x0, 0x0, 0x0, 0x13, // 13 TypedParams follow
0x0, 0x0, 0x0, 0x14, // 14 TypedParams follow
0x0, 0x0, 0x0, 0xf, // field name is 15 bytes, padded to a multiple of 4
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x0,
@@ -519,6 +519,12 @@ var testGetBlockIoTuneReply = []byte{
0x0, 0x0, 0x0, 0x4,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0xa, // This is field "group_name", a string (type 7), whose value is "somename"
0x67, 0x72, 0x6F, 0x75, 0x70, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x0, 0x0,
0x0, 0x0, 0x0, 0x7,
0x0, 0x0, 0x0, 0x8,
0x73, 0x6F, 0x6D, 0x65, 0x6E, 0x61, 0x6D, 0x65,
0x0, 0x0, 0x0, 0x0, // End of TypedParams
}