Real Time

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:

The two of the sample programs ControlByGUI and SimpleControl are provided to illustrate the basic program flow for automating signal configuration and playback in a .NET programming environment.

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

  1. Create API object.

  2. Configure the instrument connection.

  3. Clear all carriers.

  4. Configure the waveform.

  5. Add Test Model 1 with 64 DPCH downlink carrier.

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

  7. Turn on the RF output.

  8. End program and turn off the RF output.

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

Migrating API Programs

When upgrading the software from Release 3.3 or earlier to the current release, or upgrading from Option EFP to Option FFP in the current release, there may be a need to add or replace a name space in the existing API programs for them to work (see the following table):

Current Software Release Options

Release 3.3 or Earlier—Migrate API Programs to Current Software Release  

Current Release

(Upgrade from EFP to FFP)

Not Recompiling

Recompiling

Not Recompiling

Recompiling

Option EFP

1

2

---

---

---

Option FFP

---

---

1

3

4

  1. No name space addition needed. 

  2. Add name space "using Agilent.SignalStudio.N7600B.API.WCDMABasic;".

  3. Add name space "using Agilent.SignalStudio.N7600B.API.WCDMA2Basic;".

  4. Replace name space "using Agilent.SignalStudio.N7600B.API.WCDMABasic;" with "using Keysight.SignalStudio.N7600B.API.WCDMA2Basic;".

As shown in the table, if you do not recompile an existing API program when upgrading to the latest software release or to another option, there is no need to add the name space. However when upgrading to Option FFP, if you do not modify and recompile the programs, you will not be able to use the additional functionality that comes with the option.

Adding the required name space means that the program will contain three name space statements as shown in the following examples:

Option EFP

using Agilent.SignalStudio.N7600;

using Agilent.SignalStudio.N7600.API;

using Agilent.SignalStudio.N7600B.API.WCDMABasic;

Option FFP

using Agilent.SignalStudio.N7600;

using Agilent.SignalStudio.N7600.API;

using Agilent.SignalStudio.N7600B.API.WCDMA2Basic;

Failure to add the proper name space results in an error during compiling:

Error 1 The type or namespace name '<class name> could not be found (are you missing a using directive or an assembly reference?) <path to the program that contains the class> <line #> <column #> <program name>                        

SimpleControl Sample Project

The SimpleControl sample project (...\Samples\SimpleControl\SimpleControl.sln), provides a simple, basic program to generate and download waveforms using API commands.

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

Figure 1. Source code of Main.cs in Microsoft Visual C# .NET 

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):

To view the C# code in the API_TEST project, select the TestApiForm.cs tab in the Code Editor window (see Figure 3).

Ensure that the .dll file Keysight.SignalStudio.N7600 is correctly displayed under References in the Solution Explorer.

Figure 2. API Graphical User Interface displayed in Microsoft Visual C# .NET 

Figure 3. Source code of TestApiForm.cs in Microsoft Visual C# .NET