-
Notifications
You must be signed in to change notification settings - Fork 29
SWCOMMAND class
Daniel Berenguer edited this page Apr 13, 2015
·
2 revisions
If you need to send a SWAP command to another device then this is your class. SWAP commands address a given remote register in order to alter it. If the remote device can not alter the addressed register then it must respond with a status message containing the unaltered value. Otherwise, the remote device responds with a status message after having modified the register value.
/**
* SWCOMMAND
*
* Class constructor
*
* 'destAddr' Destination address
* 'secNonce' Security nonce
* 'rAddr' Register address
* 'rId' Register id
* '*val' New value
* 'len' Buffer length
*/
SWCOMMAND(byte destAddr, byte secNonce, byte rAddr, byte rId, byte *val, byte len);
The rest of arguments and methods are heritaded from the SWPACKET class.
// New value for the remote device
byte value[] = {'A', 'B', 'C'};
// Create SWAP command packet, to be sent to the device with address 7
SWCOMMAND command = SWCOMMAND(7, 0, 7, 11, value, sizeof(value));
// Send SWAP command to device address = 7, register id = 11
command.send();