} /* TransmitData() */ protected void TransmitRawData(byte[] data) { // get factory & instanciate en emplty shell message Ixxat.Vci4.IMessageFactory factory = Ixxat.Vci4.VciServer.Instance().MsgFactory; Ixxat.Vci4.Bal.Can.ICanMessage canMsg = (Ixxat.Vci4.Bal.Can.ICanMessage)factory.CreateMsg(typeof(Ixxat.Vci4.Bal.Can.ICanMessage)); // configure the empty shell canMsg.Identifier = 1; // Message ID canMsg.TimeStamp = 0; // No delay canMsg.ExtendedFrameFormat = false; // 11 bits canMsg.RemoteTransmissionRequest = false; canMsg.SelfReceptionRequest = false; // do not show this message in the console window canMsg.FrameType = Ixxat.Vci4.Bal.Can.CanMsgFrameType.Data; // Will allways be a data frame canMsg.DataLength = (byte)data.Length; // fill up the data for (int idx = 0; idx < data.Length; ++idx) { canMsg[idx] = data[idx]; } // Write the CAN message into the transmit FIFO this.m_CANMessageWriter.SendMessage(canMsg); } /* TransmitRawData() */
} /* InitSocket() */ #endregion #region CAN send/receive definition protected void TransmitData<T>(T obj) where T : struct { // get factory & instanciate en emplty shell message Ixxat.Vci4.IMessageFactory factory = Ixxat.Vci4.VciServer.Instance().MsgFactory; Ixxat.Vci4.Bal.Can.ICanMessage canMsg = (Ixxat.Vci4.Bal.Can.ICanMessage)factory.CreateMsg(typeof(Ixxat.Vci4.Bal.Can.ICanMessage)); // build up the data from object serializing byte[] data = AbstractCANHandle.Serialize<T>(obj); // configure the empty shell canMsg.TimeStamp = 0; canMsg.Identifier = 0x100; canMsg.FrameType = Ixxat.Vci4.Bal.Can.CanMsgFrameType.Data; canMsg.DataLength = (byte)data.Length; canMsg.SelfReceptionRequest = true; // show this message in the console window // fill up the data for (int idx = 0; idx < data.Length; ++idx) { canMsg[idx] = data[idx]; } // Write the CAN message into the transmit FIFO this.m_CANMessageWriter.SendMessage(canMsg); } /* TransmitData() */