IAnalyzerErrors interface
This is a standard collection interface for collection of errors of a specified type (see ITrace::AnalyzerErrors). It has the following standard methods.
IAnalyzerErrors::get_Item
C++
HRESULT get_Item(
[in] long index,
[out, retval] long* packet_number );
|
Parameters |
|
|---|---|
|
index |
Index of error in the collection. |
|
packet_number |
Points to long value where error packet number is retrieved. |
IAnalyzerErrors::get_Count
C++
HRESULT get_Count(
[out, retval] long* number_of_errors );
|
Parameters |
|
|---|---|
|
number_of_errors |
Points to long value where number of elements in the collection is retrieved. |
Example: WSH
Visual Basic
' Makes recording, and
' saves the portions of the recorded trace where "Bad VCRCs" errors occurred.
CurrentDir = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))
Set Analyzer = WScript.CreateObject("CATC.USBTracer")
Set Trace = Analyzer.MakeRecording (CurrentDir & "Input\test_ro.rec")
Set Errors = Trace.AnalyzerErrors (16) ' Packet Length Error
For Each ErrorPacketNumber In Errors
ErrorFile = CurrentDir & "\Output\ PckLen_error_span_" & CStr(ErrorPacketNumber) & ".usb"
Trace.Save ErrorFile, CInt(ErrorPacketNumber)-5, CInt(ErrorPacketNumber)+5
Next
Example: C++
C++
IUsbTrace* usb_trace;
. . .
IAnalyzerErrors* analyser_errors;
try
{
analyser_errors = usb_trace->AnalyzerErrors(error_type).Detach();
}
catch ( _com_error& er)
{
if (er.Description().length() > 0)
::MessageBox( NULL, er.Description(), _T("UsbAnalyzer client"), MB_OK );
else
::MessageBox( NULL, er.ErrorMessage(),_T("UsbAnalyzer client"), MB_OK );
return 1;
}
TCHAR all_errors[2048];
_stprintf( all_errors, _T("Errors: ") );
try
{
long errors_count = analyser_errors->GetCount();
long analyzer_error;
if ( !errors_count )
{
_tcscat( all_errors, _T("none") );
}
for ( long i=0; i<errors_count && i<2048/32; i++ )
{
analyzer_error = analyser_errors->GetItem(i);
TCHAR cur_error[32];
_stprintf( cur_error, _T(" %ld"), analyzer_error );
_tcscat( all_errors, cur_error );
}
if ( i>2048/32 )
_tcscat( all_errors, _T(" ...") );
}
catch ( _com_error& er)
{
if (er.Description().length() > 0)
::MessageBox( NULL, er.Description(), _T("UsbAnalyzer client"), MB_OK );
else
::MessageBox( NULL, er.ErrorMessage(),_T("UsbAnalyzer client"), MB_OK );
return 1;
}
analyser_errors->Release();
::SetWindowText( m_hwndStatus, all_errors );