VixenModules.Controller.OpenDMX.FTDI.updateData C# (CSharp) Method

updateData() public method

public updateData ( ICommand outputStates ) : void
outputStates ICommand
return void
        public void updateData(ICommand[] outputStates)
        {
            var channelValues = new byte[outputStates.Length];

            //Make sure that editing the output buffer is thread safe
            lock (buffer)
            {

                //copy the lighting commands to the DMX Buffer
                for (int i = 0; i < outputStates.Length; i++)
                {
                    _8BitCommand command = outputStates[i] as _8BitCommand;

                    //Reset the channel if the command is null
                    if (command == null)
                    {
                        // State reset
                        buffer[i + 1] = 0;
                        continue;
                    }

                    //Copy the new intensity value to the output buffer
                    buffer[i + 1] = command.CommandValue;

                }
            }
        }

Usage Example

 public override void UpdateState(int chainInex, ICommand[] outputStates)
 {
     //Pass the lighting data onto the hardware controller class
     _dmxPort.updateData(outputStates);
 }