Sample API Programs

While installing the software, it places the following sample programs into two locations on your C: drive—both locations contain the same files:

Using Microsoft Visual C# .NET, or a similar IDE, you can use these sample projects as a starting point to develop your own API programs.

Sample Program Locations

Windows 7 Sample Program Paths

Windows XP Sample Program Paths

Basic Program Flow

You can create an API program by performing the following general steps. This sequence is demonstrated in the Main.cs file found in the SimpleControl sample program folder located in the above paths.

This sequence is demonstrated in the Main.cs file (C:\ProgramData\Keysight\Signal Studio\Bluetooth\Samples\SimpleControl\Main.cs).

  1. Create API object.

  2. Configure the instrument connection.

  3. Configure the waveform.

  4. Generate and download the waveform to the signal generator.

Before editing the sample programs, make backup copies of all files. To save the edited files, right-click each file, select Properties, and de-select the Read-only attribute.

Simple Control Project

The Simple Control project (...\Samples\SimpleControl\SimpleControl.sln) provides a basic program for generating and downloading waveforms using API commands.

To view the code, open the SimpleControl.sln file using the Microsoft Visual C# .NET IDE, or open the Main.cs file using a text editor, such as Notepad. Since the SimpleControl.sln program flow does not use the API GUI, you will see only the code contained in the Main.cs file in the Code Editor, as shown in Figure 1.

Figure 1. Main.cs displayed in the Microsoft Visual C# .NET IDE

Control By GUI Sample Project

Using Microsoft Visual C# .NET, or a similar IDE, open the API_TEST project (...\Samples\ControlByGUI\API_TEST.sln). This displays a .NET API graphical user interface with two API mode selections (see Figure 2):

With GUI – settings that you configure using the .NET API GUI are displayed in the N7606B Signal Studio user interface, and are subsequently sent to the signal generator via the Signal Studio application. The Signal Studio GUI is automatically displayed when you select Debug mode. Using this mode allows you to see how changes in your program modify the parameters in the Signal Studio software interface.

No GUI – settings that you configure using the .NET API are not displayed in the N7606B Signal Studio user interface, but are sent directly to the API instance of the Signal Studio application and subsequently to the signal generator. 

Ensure that the .dll file Keysight.SignalStudio.N7606B is correctly displayed under References in the Solution Explorer. If the file is not listed, add it as follows:

  1. Select Project > Add Reference. A window opens in which you can select the reference files.

  2. Locate the directory (the listed paths assume that you installed Signal Studio for Bluetooth in the default location):

    • Windows XP—C:\Program Files\Keysight\Signal Studio\Bluetooth

    • Windows 7—C:\Program Files (x86)\Keysight\Signal Studio\Bluetooth

  3. Highlight "Keysight.SignalStudio.N7606.dll". 

  4. Click Add to add the file in the project as a reference.

Figure 2. API graphical user interface

To view the C# code in the API_TEST project, select the TestApiForm.cs tab in the Code Editor window in the Microsoft Visual C# .NET IDE and. See Figure 3

Figure 3. TestApiForm.cs displayed in the Microsoft Visual C# .NET IDE