Multicast Groups

By default, all devices belong to the “broadcast” group 0x0001. You can configure your devices to belong to different or additional groups.

In the following example, all devices within 5 hops and belonging to group 1 or group 2 are asked to run the reboot() function:

mcastRpc(3, 5, 'reboot')

While this example will ask all devices within 2 hops and belonging to group 2 or group 4 to run the reboot() function:

mcastRpc(6, 2,'reboot')

Remember that the group parameter is a bit mask and is not specific group numbers. To calculate the groups for the two examples above, we need to represent the group value as a binary number to see which bits are set:

Value

Hex Value

Binary Value

Groups Included

3

0x0003

0000000000000011b

1 and 2

6

0x0006

0000000000000110b

2 and 3

If you are broadcasting to multiple groups concurrently, you may find it easier to use hexadecimal notation for your group parameter. The following two commands are equivalent:

mcastRpc(19753, 5, 'reboot')   # decimal 19753  = 0100110100101001b
mcastRpc(0x4d29, 5, 'reboot')  # hex     0x4d29 = 0100110100101001b

Value

Hex Value

Binary Value

Groups Included

19753

0x4d29

0100110100101001b

1, 4, 6, 9, 11, 12 and 15