// Example taken from the async-rgb-led-analyzer
// https://github.com/saleae/async-rgb-led-analyzer/blob/alpha/src/AsyncRgbLedAnalyzer.cpp
// Step 1: add UseFrameV2 to your constructor.
AsyncRgbLedAnalyzer::AsyncRgbLedAnalyzer() : Analyzer2(), mSettings( new AsyncRgbLedAnalyzerSettings )
SetAnalyzerSettings( mSettings.get() );
// Add this line to your Analyzer constructor!
// Step 2: Create FrameV2 objects
// The following code goes wherever you already create and add Frame objects.
// Example existing Frame V1 code.
// Don't delete yours! It's still used to display the bubbles on the graph.
frame.mStartingSampleInclusive = result.mValueBeginSample;
frame.mEndingSampleInclusive = result.mValueEndSample;
frame.mData1 = result.mRGB.ConvertToU64();
frame.mData2 = frameInPacketIndex++;
mResults->AddFrame( frame );
// you can add any number of key value pairs. Each will get it's own column in the data table.
frame_v2.AddInteger( "index", frame.mData2 );
frame_v2.AddInteger( "red", result.mRGB.red );
frame_v2.AddInteger( "green", result.mRGB.green );
frame_v2.AddInteger( "blue", result.mRGB.blue );
// This actually saves your new FrameV2. In this example, we just copy the same start and end sample number from Frame V1 above.
// The second parameter is the frame "type". Any string is allowed.
mResults->AddFrameV2( frame_v2, "pixel", frame.mStartingSampleInclusive, frame.mEndingSampleInclusive );
// You should already be calling this to make submitted frames available to the rest of the system. It's still required.
mResults->CommitResults();