5.6.1 Debugging Techniques
When debugging an application that utilizes the R&S ViCom API to access one or more devices from an R&S TSM Instrument, some registry keys control the way the underlying framework behaves in terms of logging, error handling etc. These registry settings can be controlled by some registry files that are stored in the
ViCom\LogFiles folder of your R&S ViCom installation. This section describes those registry settings in detail.
The LogFiles directory is also used to store the output files of the sample applica- tions. In that directory, the following registry setting files are also available:
● PhylisKernelTraceSettings.reg: Used to enable the internal message trac- ing facility of the dispatching mechanism, the so-called Phylis Kernel. Normally you don’t want to use this, but when a technically complicated problem occurs, you might be requested by the Rohde & Schwarz support to enable the tracing and transfer the output to our technical experts.
● TsmuWorkerDebugSettings.reg: When the content of this file is inserted into the registry, the debugging capabilities of the R&S ViCom applications are
improved. Normally, the R&S TSM Instrument looses connection to the driver very quickly when no processing can be done on the PC side. That is the case when you try to debug your application that utilizes the R&S ViCom API and stop at a specific location with a breakpoint. To leverage the problems that occur in that sit- uation, load this file into the registry and you won’t get bothered with the “Connec- tion lost” message any longer.
● SetPhylisLogPath.reg: Used to adjust the location of the LogFiles folder of the R&S ViCom installation. Per default this registry file changes the location to C: \Temp\ViCom Phylis Logs. In order to manually specify another path one has to open the SetPhylisLogPath.reg file in a text editor (e.g. notepad) and change the RuSPhylModDir=C:\\Temp\\ViCom Phylis Logs\\ entry appropriately. ● RemoveAllViComRegistrySettings.reg: Used to clear the registry from all
previously made settings.
5.6.2 Message Handler
Underneath the surface, the R&S ViCom API utilizes a Rohde & Schwarz internal mechanism, the so-called PhylisKernel. This message dispatching mechanism is mostly used in graphical environments, which makes it use the possibility to get feed-
This may not be the desired behavior when the R&S ViCom API is used. Usage sce- narios may contain environments were no user feedback is possible or where software components have to run in an unattended way.
For such cases, the PhylisKernel supports a mechanism to overwrite the default behavior of asking the user for confirmation in several ways:
5.6.2.1 Error Handling Mechanism
The error handling mechanism in the Phylis Kernel is designed to be extensible by pro- viding a new DLL with a specific API. R&S ViCom itself ships with a default Error Han- dler that supports the configuration of the error handling as described below.
In case that a message box shall be shown, the kernel checks if it can load a user defined DLL (see below). If such a DLL is found and it exports a function named DumpLowLevelErrorMessage with the signature shown below, then it calls that function to take care about the error message. The DLL can handle the error message in any way it wants to.
extern "C" _declspec( dllexport ) int DumpLowLevelErrorMessage(LPCSTR lpszText, LPCSTR lpszCaption, UINT nType)
To extend the default behavior, you have to put a DLL named UserLowLevelErrorMessageHandler.dll (resp.
UserLowLevelErrorMessageHandlerd.dll in Debug Mode, if there is any differ- ent reaction required in these two modes; otherwise on of the two is enough) into the Application folder of the R&S ViCom installation directory.
R&S ViCom is shipped with a default handler DLL that supports disabling the message logging using the registry, see Registry.
You can use the SampleForErrorHandler sample project as a base for you own DLL. This project contains a configuration which shows the above mentioned message box in case of a Phylis Kernel error. The R&S ViCom setup package supplies this sample only as source code. Therefore have to build the project, if you want to use the UserLowLevelErrorMessageHandler.dll.
#include "stdafx.h" #include <afxwin.h>
extern "C" _declspec( dllexport ) int DumpLowLevelErrorMessage(LPCSTR lpszText, LPCSTR lpszCaption, UINT nType)
{ // // TODO:
// Integrate your personal error handling routines here. //
CString csMsg;
csMsg.Format(_T("Module: %s\nMessage: %s\n"), (CString)lpszCaption, (CString)lpszText); AfxMessageBox( csMsg, MB_OK | MB_ICONINFORMATION );
return 0; }
5.6.2.2 Registry
The default error handler DLL that is shipped with the R&S ViCom delivery is called PhylisLowLevelErrorMessageHandler.dll (or
PhylisLowLevelErrorMessageHandlerd.dll in debug mode) and can be used to control the behavior using the registry.
In the key “HKCU\SOFTWARE\Rohde&Schwarz\PhylisModules”, the two values DisableLowLevelMessages and DisableLowLevelMessageLogFile can be used to control if the message shall be written to a file and if the message boxes shall be displayed.
If the first value is set to a value not equal to 0, the message will not be written to a file named LowLevelPhylisMessage XXX.txt, where XXX is replaced by a time- stamp. If the second value is specified and set to a value not equal to 0, no message boxes are shown.
6 R&S ViCom WCDMA Technology
● Measuring of WCDMA Signals...61 ● Sample Application... 63 ● WCDMA BCH Demodulation... 69