The ArtTodData packet is used to encode a list of UIDs received from a particular physical port. This is the Table of Devices or ToD.
It is often useful to identify the physical port that generated the packet. Because Art-Net (for historical reasons) allows a variable number of ports to be encoded in an ArtPollReply, the calculation is not trivial.
ArtTodData->Port is limited to a range of 1-4. It is used in combination with BindIndex to identify the physical port that generated the packet. This is done by referencing data in the ArtPollReply with a matching BindIndex:
ArtPollReplyData->BindIndex == ArtTodData->BindIndex
An ArtPollReply can encode between 1 and 4 physical ports, defined by ArtPollReply->NumPortsLo. This number must be used when calculating the physical port in order to allow for the variable encoding.
The calculation is:
Physical Port = (BindIndex-1) * ArtPollReply->NumPortsLo + ArtTodData->Port
As most modern Art-Net gateways implement one universe per ArtPollReply, ArtTodData->Port will usually be set to a value of 1.
The following tables show how this works in practice:
A gateway that has 5 physical ports and encodes 1 port per ArtPollReply (the recommended modern implementation).
Physical port 1-x | ArtTodData->BindIndex | ArtPollReply->NumPortsLo | ArtTodData->Port |
1 | 1 | 1 | 1 |
2 | 2 | 1 | 1 |
3 | 3 | 1 | 1 |
4 | 4 | 1 | 1 |
5 | 5 | 1 | 1 |
A gateway that has 9 physical ports and encodes 2 ports per ArtPollReply (very widely implemented in Art-Net 3 era products).
Physical port 1-x | ArtTodData->BindIndex | ArtPollReply->NumPortsLo | ArtTodData->Port |
1 | 1 | 2 | 1 |
2 | 1 | 2 | 2 |
3 | 2 | 2 | 1 |
4 | 2 | 2 | 2 |
5 | 3 | 2 | 1 |
6 | 3 | 2 | 2 |
7 | 4 | 2 | 1 |
8 | 4 | 2 | 2 |
9 | 5 | 2 | 1 |
A gateway that has 9 physical ports and encodes 4 ports per ArtPollReply (very widely implemented in Art-Net 3 era products).
Physical port 1-x | ArtTodData->BindIndex | ArtPollReply->NumPortsLo | ArtTodData->Port |
1 | 1 | 4 | 1 |
2 | 1 | 4 | 2 |
3 | 1 | 4 | 3 |
4 | 1 | 4 | 4 |
5 | 2 | 4 | 1 |
6 | 2 | 4 | 2 |
7 | 2 | 4 | 3 |
8 | 2 | 4 | 4 |
9 | 3 | 4 | 1 |