PAN 1026A Device Length
Why does the PAN 1026A accept only device names with 8 characters … or am I making an error within the TCU INIT REQUEST ?
// !!! "ICU xxxx" and all other 8 byte strings will work !!!
char pcName = "ICU xxx";
unsigned char ucNameLength = strlen(pcName);
unsigned short usTotalParameterLength = (unsigned short)ucNameLength + 3;
// 100 is more than we need!
char pcRequest =
// Total command length
0x12, 0x00, 0x00,
// Ser. OpCode
// Total Parameter length - 1 !!!!
// Supported profile: 0x04, SSP
// No other parameter
// Device name length, will be overwritten later on
// Device name, will be overwritten too.
'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X'
// Set the total parameter length
memcpy((char*)&pcRequest, (char*)&usTotalParameterLength, 2);
// Set the device name length
pcRequest = ucNameLength;
// Set the device name
memcpy((char*)&pcRequest, pcName, ucNameLength);
// Output the command binary
PANPrintBuffer(pcRequest, usTotalParameterLength + 7);
The device answers with 0xE1 0xFF ???
Any ideas ?
I can confirm that the TCU_MNG_INIT_REQ command accepts device names up to 128 bytes.
The example that you have given shows the usage of a device name with 8 bytes.
The code that you shared correctly modifies the "parameter length" to the desired length of the name, but it fails to modify the length of the total command in the first 3 bytes of the TCU datagram.
In the example for a device name with 8 bytes it is 0x12, but it must be increased accordingly, too.
For your code it must be ucNameLength + 10 in general instead.
Because the length of the TCU datagram can never exceed 255 for TCU_MNG_INIT_REQ, it is sufficient to write:
pcRequest = ucNameLength + 10;
Please note that for other TCU datagrams which are larger than 255 bytes it might be necessary to calculate all 3 length bytes correctly.