New analyzer

This commit is contained in:
Thomas Roth
2023-10-12 00:21:47 +02:00
parent c05378e34b
commit 665cfdee89
8 changed files with 160 additions and 205 deletions

View File

@@ -1,14 +1,31 @@
#include "SimpleSerialAnalyzerSettings.h"
#include "LPCClocklessAnalyzerSettings.h"
#include <AnalyzerHelpers.h>
SimpleSerialAnalyzerSettings::SimpleSerialAnalyzerSettings()
: mInputChannel( UNDEFINED_CHANNEL ),
LPCClocklessAnalyzerSettings::LPCClocklessAnalyzerSettings() :
// : mInputChannel( UNDEFINED_CHANNEL ),
mFrameChannel( UNDEFINED_CHANNEL ),
mBitRate( 9600 )
{
mInputChannelInterface.reset( new AnalyzerSettingInterfaceChannel() );
mInputChannelInterface->SetTitleAndTooltip( "Serial", "Standard Simple Serial" );
mInputChannelInterface->SetChannel( mInputChannel );
ClearChannels();
for(int i=0; i < 4; i++) {
mLaddChannel[i] = Channel(UNDEFINED_CHANNEL);
// }
mLaddChannelInterface[i].reset( new AnalyzerSettingInterfaceChannel() );
// const char *name = std::string("Ladd" + std::to_string(i)).c_str();
mLaddChannelInterface[i]->SetTitleAndTooltip(std::string("Ladd" + std::to_string(i)).c_str(), "Signal.");
mLaddChannelInterface[i]->SetChannel( mLaddChannel[i] );
AddInterface( mLaddChannelInterface[i].get() );
AddChannel( mLaddChannel[i], std::string("Ladd" + std::to_string(i)).c_str(), false );
}
mFrameChannelInterface.reset( new AnalyzerSettingInterfaceChannel() );
mFrameChannelInterface->SetTitleAndTooltip( "Frame", "Frame signal" );
mFrameChannelInterface->SetChannel( mFrameChannel );
AddInterface(mFrameChannelInterface.get());
// mInputChannelInterface.reset( new AnalyzerSettingInterfaceChannel() );
// mInputChannelInterface->SetTitleAndTooltip( "Serial", "Standard LPC Clockless" );
// mInputChannelInterface->SetChannel( mInputChannel );
mBitRateInterface.reset( new AnalyzerSettingInterfaceInteger() );
mBitRateInterface->SetTitleAndTooltip( "Bit Rate (Bits/S)", "Specify the bit rate in bits per second." );
@@ -16,57 +33,80 @@ SimpleSerialAnalyzerSettings::SimpleSerialAnalyzerSettings()
mBitRateInterface->SetMin( 1 );
mBitRateInterface->SetInteger( mBitRate );
AddInterface( mInputChannelInterface.get() );
// AddInterface( mInputChannelInterface.get() );
AddInterface( mBitRateInterface.get() );
AddExportOption( 0, "Export as text/csv file" );
AddExportExtension( 0, "text", "txt" );
AddExportExtension( 0, "csv", "csv" );
ClearChannels();
AddChannel( mInputChannel, "Serial", false );
// ClearChannels();
AddChannel( mFrameChannel, "Frame", false );
}
SimpleSerialAnalyzerSettings::~SimpleSerialAnalyzerSettings()
LPCClocklessAnalyzerSettings::~LPCClocklessAnalyzerSettings()
{
}
bool SimpleSerialAnalyzerSettings::SetSettingsFromInterfaces()
bool LPCClocklessAnalyzerSettings::SetSettingsFromInterfaces()
{
mInputChannel = mInputChannelInterface->GetChannel();
// mInputChannel = mInputChannelInterface->GetChannel();
mFrameChannel = mFrameChannelInterface->GetChannel();
for(int i=0; i < 4; i++) {
mLaddChannel[i] = mLaddChannelInterface[i]->GetChannel();
}
mBitRate = mBitRateInterface->GetInteger();
ClearChannels();
AddChannel( mInputChannel, "Simple Serial", true );
for(int i=0; i < 4; i++) {
AddChannel( mLaddChannel[i], std::string("Ladd" + std::to_string(i)).c_str(), true);
}
// AddChannel( mInputChannel, "LPC Clockless", true );
AddChannel( mFrameChannel, "Frame", true );
return true;
}
void SimpleSerialAnalyzerSettings::UpdateInterfacesFromSettings()
void LPCClocklessAnalyzerSettings::UpdateInterfacesFromSettings()
{
mInputChannelInterface->SetChannel( mInputChannel );
for(int i=0; i < 4; i++) {
mLaddChannelInterface[i]->SetChannel( mLaddChannel[i] );
}
mFrameChannelInterface->SetChannel( mFrameChannel );
// mInputChannelInterface->SetChannel( mInputChannel );
mBitRateInterface->SetInteger( mBitRate );
}
void SimpleSerialAnalyzerSettings::LoadSettings( const char* settings )
void LPCClocklessAnalyzerSettings::LoadSettings( const char* settings )
{
SimpleArchive text_archive;
text_archive.SetString( settings );
text_archive >> mInputChannel;
for(int i=0; i < 4; i++) {
text_archive >> mLaddChannel[i];
}
text_archive >> mFrameChannel;
text_archive >> mBitRate;
ClearChannels();
AddChannel( mInputChannel, "Simple Serial", true );
for(int i=0; i < 4; i++) {
AddChannel( mLaddChannel[i], std::string("Ladd" + std::to_string(i)).c_str(), true);
}
// AddChannel( mInputChannel, "LPC Clockless", true );
AddChannel( mFrameChannel, "Frame", true );
// AddChannel( mInputChannel, "LPC Clockless", true );
UpdateInterfacesFromSettings();
}
const char* SimpleSerialAnalyzerSettings::SaveSettings()
const char* LPCClocklessAnalyzerSettings::SaveSettings()
{
SimpleArchive text_archive;
text_archive << mInputChannel;
for(int i=0; i < 4; i++) {
text_archive << mLaddChannel[i];
}
text_archive << mFrameChannel;
// text_archive << mInputChannel;
text_archive << mBitRate;
return SetReturnString( text_archive.GetString() );