public void ParseCommand(PacketCommand command, SerialDataChannel channel) { if (command.PacketID == PhysLoggerPacketCommandID.GetHWSignatures) { var parts = command.PayLoadString.Split(new char[] { '=' }); if (parts[0] == "ver") { if (parts[1] == PhysLoggerHWSignature.PhysLogger1_0.ToString()) { HWProps = new PhysLogger1_0HWProperties(); HWProps.OnNewGainValues += HWProps_OnNewGainValues; new PacketCommand(PhysLoggerPacketCommandID.BeginFire, new byte[] { 1 }).SendCommand(channel); } else { return; } OnSignatureUpdate(this, new EventArgs()); } else { if (HWProps != null) { if (HWProps.UpdateProp(parts)) { OnSignatureUpdate?.Invoke(this, new EventArgs()); } } } } if (HWProps.Signature == PhysLoggerHWSignature.Unknown) { new PacketCommand(PhysLoggerPacketCommandID.GetHWSignatures).SendCommand(channel); return; } if (command.PacketID == PhysLoggerPacketCommandID.DataPacket) { float t = 0; float[] values = null; HWProps.HandleDataPacket(command, ref t, ref values); if (values != null) { NewPointReceived(t, values); } } }
protected virtual void SignatureUpdates(PhysLoggerHWSignature oldSignature, PhysLoggerHWSignature newSignature) { OnSignatureUpdate?.Invoke(oldSignature, newSignature); }