public object CreateRxHandle(int Addr, byte Mode, byte[] Params) { J1850Message message = new J1850Message(default_message_prototype); message.TargetAddress = Addr; message.SAEMode = Mode; message.Data = Params; message.RxDataIndex = Params.Length; return(message.DefaultRxComparer); }
public void StartPeriodicMessage(SAEMessage Message) { J1850Message MessageParser = new J1850Message(default_message_prototype); MessageParser.TargetAddress = Message.Address; MessageParser.SAEMode = Message.Mode; MessageParser.Data = Message.Data; J2534Message TesterPresent = new J2534Message(J2534PROTOCOL.J1850PWM, J2534TXFLAG.NONE, MessageParser.RawMessage); channel.StartPeriodicMessage(TesterPresent, 3000); }
public List <byte[]> SAERx(object RxHandle, int NumOfMsgs, int Timeout, bool DestroyHandle = false) { List <byte[]> Messages = new List <byte[]>(); J1850Message MessageParser = new J1850Message(default_message_prototype); GetMessageResults Results = channel.GetMessages(NumOfMsgs, Timeout, (Predicate <J2534Message>)RxHandle, DestroyHandle); if (Results.Messages.Count > NumOfMsgs) { int a = 1; } Results.Messages.ForEach(j2534message => { MessageParser.RawMessage = (byte [])j2534message.Data; //This should always be a byte [] so, no type checking is done. Messages.Add(MessageParser.Data); }); return(Messages); }
private void InitializeDefaultConfigs() { J1850Message default_message_builder = new J1850Message(); default_message_builder.J1850_byte0 = 0xC4; default_message_prototype = default_message_builder.RawMessage; channel.ClearMsgFilters(); channel.ClearFunctMsgLookupTable(); channel.AddToFunctMsgLookupTable(0x6B); channel.StartMsgFilter(new MessageFilter() { Mask = new byte[] { 0x00, 0xFF, 0x00 }, Pattern = new byte[] { 0x00, 0xF1, 0x00 }, FilterType = J2534FILTER.PASS_FILTER }); ToolAddress = 0xF1; }
protected void InitializeDefaultConfigs() { SessionTxFlags = J2534TXFLAG.NONE; J1850Message default_message_builder = new J1850Message(); default_message_builder.J1850_byte0 = 0xC4; default_message_prototype = default_message_builder.RawMessage; channel.SetConfig(J2534PARAMETER.DATA_RATE, (int)J2534BAUD.J1850PWM_41600); channel.ClearMsgFilters(); channel.ClearFunctMsgLookupTable(); channel.AddToFunctMsgLookupTable(0x6B); channel.StartMsgFilter(new MessageFilter() { Mask = new byte[] { 0x00, 0xFF, 0x00 }, Pattern = new byte[] { 0x00, 0xF1, 0x00 }, FilterType = J2534FILTER.PASS_FILTER }); ToolAddress = 0xF1; }
public object CreateRxHandle(int Addr, SAEModes Mode) { J1850Message MessageParser = new J1850Message(default_message_prototype); MessageParser.TargetAddress = Addr; MessageParser.SAEMode = Mode; Predicate <J2534Message> Comparer = (TestMessage => { if (TestMessage.Data.Skip(1).Take(3).SequenceEqual(MessageParser.RawMessage.Skip(1).Take(3)) && TestMessage.RxStatus == J2534.J2534RXFLAG.NONE) { return(true); } return(false); }); channel.AddMessageScreen(Comparer); return((object)Comparer); }
public SAEMessage SAETxRx(SAEMessage Message, int RxDataIndex) { J1850Message message = new J1850Message(default_message_prototype); GetMessageResults Results; SAEMessage ReturnMessage = new SAEMessage(); message.TargetAddress = Message.Addr; message.SAEMode = Message.Mode; message.Data = Message.Data; message.RxDataIndex = RxDataIndex; Results = channel.MessageTransaction(message.RawMessage, 1, message.DefaultRxComparer); if (Results.Status == J2534ERR.STATUS_NOERROR) { message.RawMessage = Results.Messages[0].Data; ReturnMessage.Mode = message.SAEMode; ReturnMessage.Data = message.Data; ReturnMessage.IsValid = true; } return(ReturnMessage); }
public void SAETx(int Addr, byte Mode, List <byte[]> Data) { J1850Message message = new J1850Message(default_message_prototype); message.TargetAddress = Addr; message.SAEMode = Mode; List <J2534Message> J2534Messages = new List <J2534Message>(); Data.ForEach(data => { message.Data = data; J2534Messages.Add(new J2534Message(SessionProtocol, SessionTxFlags, message.RawMessage)); }); J2534ERR Status = channel.SendMessages(J2534Messages); if (Status != J2534ERR.STATUS_NOERROR) { throw new J2534Exception(Status, channel.GetLastError()); } }
public void SAETx(SAEMessage Message) { J1850Message MessageParser = new J1850Message(default_message_prototype); MessageParser.TargetAddress = Message.Address; MessageParser.SAEMode = Message.Mode; List <J2534Message> J2534Messages = new List <J2534Message>(); Message.DataList.ForEach(data => { MessageParser.Data = data; J2534Messages.Add(new J2534Message(SessionProtocol, SessionTxFlags, MessageParser.RawMessage)); }); J2534Status Status = channel.SendMessages(J2534Messages); if (Status.IsNotOK) { throw new J2534Exception(Status); } }
public SAEMessage SAETxRx(SAEMessage Message, int RxDataIndex) { J1850Message MessageParser = new J1850Message(default_message_prototype); GetMessageResults Results; SAEMessage ReturnMessage = new SAEMessage(); MessageParser.TargetAddress = Message.Address; MessageParser.SAEMode = Message.Mode; MessageParser.Data = Message.Data; MessageParser.RxDataIndex = RxDataIndex; Results = channel.MessageTransaction(MessageParser.RawMessage, 1, MessageParser.DefaultRxComparer); if (Results.Status.IsOK) { MessageParser.RawMessage = (byte [])Results.Messages[0].Data; ReturnMessage.Mode = MessageParser.SAEMode; ReturnMessage.Data = MessageParser.Data; ReturnMessage.Response = MessageParser.ResponseByte; ReturnMessage.IsValid = true; } return(ReturnMessage); }