mirror of
https://github.com/stacksmashing/LPCClocklessAnalyzer.git
synced 2026-01-31 19:38:38 +03:00
added Simple Serial Analyzer source and VS project.
This commit is contained in:
73
source/SimpleSerialAnalyzerSettings.cpp
Normal file
73
source/SimpleSerialAnalyzerSettings.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
#include "SimpleSerialAnalyzerSettings.h"
|
||||
#include <AnalyzerHelpers.h>
|
||||
|
||||
|
||||
SimpleSerialAnalyzerSettings::SimpleSerialAnalyzerSettings()
|
||||
: mInputChannel( UNDEFINED_CHANNEL ),
|
||||
mBitRate( 9600 )
|
||||
{
|
||||
mInputChannelInterface.reset( new AnalyzerSettingInterfaceChannel() );
|
||||
mInputChannelInterface->SetTitleAndTooltip( "Serial", "Standard Simple Serial" );
|
||||
mInputChannelInterface->SetChannel( mInputChannel );
|
||||
|
||||
mBitRateInterface.reset( new AnalyzerSettingInterfaceInteger() );
|
||||
mBitRateInterface->SetTitleAndTooltip( "Bit Rate (Bits/S)", "Specify the bit rate in bits per second." );
|
||||
mBitRateInterface->SetMax( 6000000 );
|
||||
mBitRateInterface->SetMin( 1 );
|
||||
mBitRateInterface->SetInteger( mBitRate );
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
SimpleSerialAnalyzerSettings::~SimpleSerialAnalyzerSettings()
|
||||
{
|
||||
}
|
||||
|
||||
bool SimpleSerialAnalyzerSettings::SetSettingsFromInterfaces()
|
||||
{
|
||||
mInputChannel = mInputChannelInterface->GetChannel();
|
||||
mBitRate = mBitRateInterface->GetInteger();
|
||||
|
||||
ClearChannels();
|
||||
AddChannel( mInputChannel, "Simple Serial", true );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SimpleSerialAnalyzerSettings::UpdateInterfacesFromSettings()
|
||||
{
|
||||
mInputChannelInterface->SetChannel( mInputChannel );
|
||||
mBitRateInterface->SetInteger( mBitRate );
|
||||
}
|
||||
|
||||
void SimpleSerialAnalyzerSettings::LoadSettings( const char* settings )
|
||||
{
|
||||
SimpleArchive text_archive;
|
||||
text_archive.SetString( settings );
|
||||
|
||||
text_archive >> mInputChannel;
|
||||
text_archive >> mBitRate;
|
||||
|
||||
ClearChannels();
|
||||
AddChannel( mInputChannel, "Simple Serial", true );
|
||||
|
||||
UpdateInterfacesFromSettings();
|
||||
}
|
||||
|
||||
const char* SimpleSerialAnalyzerSettings::SaveSettings()
|
||||
{
|
||||
SimpleArchive text_archive;
|
||||
|
||||
text_archive << mInputChannel;
|
||||
text_archive << mBitRate;
|
||||
|
||||
return SetReturnString( text_archive.GetString() );
|
||||
}
|
||||
Reference in New Issue
Block a user