How do I prevent duplicate scans when using the WaveAnalyzer 1500S API?

Downloading measurement data is achieved via the  data API command:


If you have ever retrieved scans using this command, you may have noticed that  successive calls can return duplicates of the same scan. This is because calls to this command do not trigger a new WaveAnalyzer scan; the WaveAnalyzer scans continuously. Instead it simply retrieves the measurement data of the most recently completed scan.

In case this command is called too quickly, it is certainly possible to receive the same scan many times if the instrument has not had time to complete its next scan.

while not a problem for most use cases, duplicate scans can become troublesome when performing some operations where many consecutive unique scans are needed e.g. scan averaging.

Scan Management using Scan ID

Duplicate scans can be avoided by tracking the scan ID. Each scan has an associated Scan ID and since duplicate scans have the same ID, they can be discarded.

The scan id is best retrieved using the scan/info command:


This command returns a JSON string containing information about the current scan. Here is an example output:


The following flowchart is a useful guide to avoid duplicate scans:

Scan ID Algorithm
Scan ID Algorithm