The system is a control system for making beer, that is my highest level objective (yes I know people have done similar things already in far simpler ways, but that is not how you learn new things)
The system consists of several nodes, using the CAN bus each node is a peer (no masters). Sensor readings and output values are needed by several of the nodes. So when a value is updated it is broadcast across the network. The nodes which need to know that value will receive the value and update it in the Arduino/nodes memory. Filtering of which values are needed is done by the CAN controller.
The actual data transmission is pretty quick, the data gets held in the CAN controller. When a message comes, and has been verified, in it generates an interrupt, which triggers my routine. The actual message consists of a message header, which gets stored in 2 bytes. The header identifies which variable the message contains, as well as the data type.
The message it self is stored as individual bytes in the CAN controller buffer. I am reading the individual bytes and assembling them into the appropriate data type. I am getting the data from the CAN controller using the SPI library. Each transmission contains only one variable. I have successfully read the header information, as well as get the message and process it into the appropriate data type.
The variables contain data like temperature, volume (gallons), and output power (byte sent to PWM).
I have complete control over what gets sent. I have chosen to let the CAN controller deal with the specifics of the communications. I think I have a pretty good handle on how to get the actual communications, and have been able to get data out of the CAN controller.
Once I have the actual value (which could be any one of 6 data types) and have an ID for which variable it is (byte), is there some data structure I can use to store that value into memory without having to check each of the possible variables if the ID's match. I have used a Python dictionary to do something similar in the past.
I should add part of my motivation is to avoid occupying the processor for too long. I am running 7 segment displays on most of the nodes, which are being driven with the Sparkfun 7 segment library. I learned with another project that if the processor gets tied up for to long there is a noticeable flash in the display. By the time I finish checking 30+ if statements I fully expect to see a flash, that and the code gets hard to read (at least for me).
Does that make it easier to understand?