internal CanMessage UnpackCanMessage(BinaryReader br) { UInt32 cob = br.ReadUInt32(); UInt16 tim = br.ReadUInt16(); byte src = br.ReadByte(); byte rs1 = br.ReadByte(); /* zero */ byte[] d = br.ReadBytes(8); byte dlen = br.ReadByte(); byte[] p = br.ReadBytes(7); /* PAD */ UInt64 t = br.ReadUInt64(); Array.Resize(ref d, dlen); return(new CanMessage( CanSourceId.Source(_BoardID, (byte)((src & 7) - 1)), CanMailboxId.Mailbox((src & 0x08) != 0, (byte)(src >> 4)), cob, d) { Time = tim, Sec = (UInt32)(long)(t / (1000 * 1000)), Usec = (UInt32)((long)(t % (1000 * 1000))) }); }
public CanMessage(CanSourceId src, CanMailboxId mbox, CanObjectId cob, byte[] data) { Source = src; Mailbox = mbox; COB = cob; Data = data; }
public static void RegisterBoard(byte id, object board, int numsources) { Boards.TryAdd(id, board); for (byte i = 0; i < numsources; i++) { CanSharkCore.Sources.Add(CanSourceId.Source(id, i)); } }
private void button3_Click(object sender, EventArgs e) { Random r = new Random(); CanSharkCore.InputQueue.Enqueue( new CanMessage( CanSourceId.Source(0, 0), CanMailboxId.Mailbox(true, 0x00), CanObjectId.Std(0x80)) { Time = 0, Usec = 0 }); CanSharkCore.InputQueue.Enqueue( new CanMessage( CanSourceId.Source(0, 1), CanMailboxId.Mailbox(true, 0x00), CanObjectId.Std(0x80)) { Time = 0, Usec = 0 }); for (int i = 0; i < 10000; i++) { uint id = (uint)r.Next(0x800); while (id == 0x80) { id = (uint)r.Next(0x800); } CanSharkCore.InputQueue.Enqueue( new CanMessage( CanSourceId.Source(0, (byte)(i % 2)), CanMailboxId.Mailbox(false, 0x00), CanObjectId.Std(id)) { Time = (ushort)(i * 44), Usec = (ushort)((i * 44) % 1000000), Sec = (ushort)((i * 44) / 1000000) }); } }
private void frmMain_Load(object sender, EventArgs e) { CanSharkCore.DataSources.Add(new EthBoard()); CanSharkCore.Analyzers.Add(Cycle); CanSharkCore.Analyzers.Add(HistogramData); CanSharkCore.Analyzers.Add(PortStats); CanSharkCore.Analyzers.Add(MessageLog); frameStatistics1.SetSource(PortStats, CanSourceId.Source(0, 0)); frameStatistics2.SetSource(PortStats, CanSourceId.Source(0, 1)); frameCanopenCycleLog1.SetSource(Cycle, CanSourceId.Source(0, 0)); frameCanopenCycleLog2.SetSource(Cycle, CanSourceId.Source(0, 1)); frameMessageMatrix1.SetSource(HistogramData, CanSourceId.Source(0, 0)); frameMessageMatrix2.SetSource(HistogramData, CanSourceId.Source(0, 1)); frameMessages1.SetSource(MessageLog, CanSourceId.Source(0, 0)); frameMessages2.SetSource(MessageLog, CanSourceId.Source(0, 1)); }
public void SetSource(AnalyseMessageLog stats, CanSourceId id) { _Source = id; _Stats = stats; }
public void SetSource(PortStatistics stats, CanSourceId id) { _Source = id; _Stats = stats; }
public CanMessage(CanSourceId src, CanMailboxId mbox, CanObjectId cob) { Source = src; Mailbox = mbox; COB = cob; }
internal void SetSource(CanBusHistogram data, CanSourceId src) { _Stats = data; _Source = src; }
public void SetSource(CanopenCycle stats, CanSourceId id) { _Source = id; _Stats = stats; }