/* * Constructs a message from the form and sends it * to the channel */ private bool SendMessage(int dlc, List <Signal> signals) { byte[] data = new byte[dlc]; Kvadblib.Status status = Kvadblib.Status.OK; Kvadblib.SignalHnd sh; bool error = false; foreach (Signal s in signals) { double min, max; status = Kvadblib.GetSignalByName(msgHandle, s.name, out sh); if (status != Kvadblib.Status.OK) { error = true; break; } Kvadblib.GetSignalValueLimits(sh, out min, out max); status = Kvadblib.StoreSignalValuePhys(sh, data, dlc, s.Value); //Check if the signal value was successfully stored and that it's in the correct interval if (status != Kvadblib.Status.OK || s.Value < min || s.Value > max) { error = true; break; } } if (!error) { Canlib.canWriteWait(chanHandle, msgId, data, dlc, msgFlags, 50); } return(error); }