private CommunicationError GetFaultIndices(ref UInt32 Oldest, ref UInt32 Newest) { Protocol.DataPacketProlog request = new Protocol.DataPacketProlog(); Byte[] txMessage = request.GetByteArray(null, Protocol.PacketType.GET_FAULT_INDICES, Protocol.ResponseType.COMMANDREQUEST, m_CommDevice.IsTargetBigEndian()); m_CommDevice.SendMessageToTarget(txMessage); m_CommDevice.ReceiveTargetDataPacket(m_RxMessage); Oldest = BitConverter.ToUInt32(m_RxMessage, 8); Newest = BitConverter.ToUInt32(m_RxMessage, 12); return CommunicationError.Success; }
/// <summary> /// /// </summary> /// <param name="getChartMode"></param> /// <returns></returns> public CommunicationError GetChartMode(ref Protocol.GetChartModeRes getChartMode) { Protocol.DataPacketProlog dpp = new Protocol.DataPacketProlog(); Byte[] txMessage = dpp.GetByteArray(null, Protocol.PacketType.GET_CHART_MODE, Protocol.ResponseType.DATAREQUEST, false); CommunicationError commError = SendDataRequestToEmbedded(txMessage); if (commError == CommunicationError.Success) { getChartMode.CurrentChartMode = m_RxMessage[8]; } return commError; }
/// <summary> /// /// </summary> /// <param name="getEmbInfo"></param> /// <returns></returns> public CommunicationError GetEmbeddedInformation(ref Protocol.GetEmbeddedInfoRes getEmbInfo) { Protocol.DataPacketProlog dpp = new Protocol.DataPacketProlog(); Byte[] txMessage = dpp.GetByteArray(null, Protocol.PacketType.GET_EMBEDDED_INFORMATION, Protocol.ResponseType.DATAREQUEST, m_CommDevice.IsTargetBigEndian()); CommunicationError commError = SendDataRequestToEmbedded(txMessage); if (commError == CommunicationError.Success) { // Map rxMessage to GetEmbeddedInfoRes; getEmbInfo.SoftwareVersion = Encoding.UTF8.GetString(m_RxMessage, 8, 41).Replace("\0", String.Empty); getEmbInfo.CarID = Encoding.UTF8.GetString(m_RxMessage, 49, 11).Replace("\0", String.Empty); getEmbInfo.SubSystemName = Encoding.UTF8.GetString(m_RxMessage, 60, 41).Replace("\0", String.Empty); getEmbInfo.IdentifierString = Encoding.UTF8.GetString(m_RxMessage, 101, 5).Replace("\0", String.Empty); getEmbInfo.ConfigurationMask = BitConverter.ToUInt32(m_RxMessage, 106); } return commError; }
/// <summary> /// /// </summary> /// <returns></returns> public CommunicationError StartClock() { Protocol.DataPacketProlog dpp = new Protocol.DataPacketProlog(); Byte[] txMessage = dpp.GetByteArray(null, Protocol.PacketType.START_CLOCK, Protocol.ResponseType.COMMANDREQUEST, false); CommunicationError commError = SendCommandToEmbedded(txMessage); return commError; }
/// <summary> /// /// </summary> /// <param name="CurrentChartMode"></param> /// <returns></returns> public CommunicationError GetChartMode(ref UInt16 CurrentChartMode) { Protocol.DataPacketProlog request = new Protocol.DataPacketProlog(); Byte[] txMessage = request.GetByteArray(null, Protocol.PacketType.GET_CHART_MODE, Protocol.ResponseType.DATAREQUEST, m_CommDevice.IsTargetBigEndian()); Int32 errorCode = m_CommDevice.SendMessageToTarget(txMessage); if (errorCode < 0) { return CommunicationError.BadRequest; } m_CommDevice.ReceiveTargetDataPacket(m_RxMessage); CurrentChartMode = BitConverter.ToUInt16(m_RxMessage, 8); // check for endianess if (m_CommDevice.IsTargetBigEndian()) { CurrentChartMode = Utils.ReverseByteOrder(CurrentChartMode); } return CommunicationError.Success; }