JSIQA JavaScript IQ Analyzer v11738
JSIQA JavaScript IQ Analyzer v11738
(Jessica)
JavaScript
IQ Processing
AARONIA
General
This document matches the Aaronia RTSA Suite Pro Built number 11738 and above.
Additional Datatypes
JSIQA extends the common JavaScript numeric type into the complex realm. Numbers can be real,
imaginary or a combination. An imaginary number may be the result of a numeric operation, such as the
square root of minus one, or a literal with the ending character “I”, such as “123i” or “3.4e5i”.
System Objects
System objects are provided by the runtime system, and need not be imported before use.
1
IQ Array Processing – IQ
The IQ library/object provides optimized routines for manipulating typed and untyped arrays of real and
complex numbers in a vector style.
IQ.abs(data)
Returns an array with the absolute values of the source data array.
IQ.phi(data)
Returns an array with the angle to the real value axis for the complex values of the source data array.
IQ.exp(data)
IQ.log(data)
IQ.i(data)
2
IQ.q(data)
IQ.dphi(data)
Returns an array with the change of angle to the real value axis for the complex values of the source data
array.
IQ.fft(data)
IQ.ifft(data)
IQ.sum(data)
IQ.min(data1, data2)
Returns an array with the smaller elements of the two source arrays
3
IQ.max(data1, data2)
Returns an array with the larger elements of the two source arrays
IQ.conj(data)
IQ.add(data1, data2)
IQ.sub(data1, data2)
IQ.mul(data1, data2)
IQ.div(data1, data2)
4
Returns the element wise quotient of the two source arrays
IQ.and(data1, data2)
Returns the element wise binary and of the two source arrays
IQ.or(data1, data2)
IQ.xor(data1, data2)
Returns the element wise binary exclusive or of the two source arrays
IQ.andnot(data1, data2)
Returns the element wise binary and of the first and the inverted second array
IQ.eq(data1, data2)
Returns the element wise comparison for equal of the two source arrays
IQ.ne(data1, data2)
5
data1 Array, TypedArray, Number Source data
data2 Array, TypedArray, Number Source data
Returns the element wise comparison for not equal of the two source arrays
IQ.lt(data1, data2)
Returns the element wise comparison for less than of the two source arrays
IQ.gt(data1, data2)
Returns the element wise comparison for greater than of the two source arrays
IQ.le(data1, data2)
Returns the element wise comparison for less than or equal of the two source arrays
IQ.ge(data1, data2)
Returns the element wise comparison for greater than or equal of the two source arrays
6
Returns an array with the elements of either the “if” or the “else” source argument, based on the
contents of the “cond” argument.
IQ.gather(data, index)
Returns an array with the size of the “index” argument and the values of the “data” argument indexed by
the values of the “index” argument.
Returns an array with the source values multiplied by phi and the powers of dphi.
Returns an array with resampled values at the starting offset and offset plus integer multiples of the sept
value. Offset and step may be non integer values.
Returns an array with the indices of the sorted smallest (or highest) elements on a float array.
IQ.nth(data, n);
7
Returns the n-th element from the sorted source data array.
IQ.zcross(data, [thresh])
Returns an array of the indices of all elements in the source data array, that cross the threshold value.
IQ.zfcross(data, [thresh])
Returns an array of the of the linear interpolated positions where the values of the data array cross the
threshold value.
XML.parse(text)
XML.prototype.node(tag)
XML.prototype.nodes(tag)
8
XML.prototype.text()
XML.tag
XML.elements
Array of the XML child elements.
syslog.debug(value, …)
syslog.warning(value, …)
syslog.info(value, …)
syslog.critical(value, …)
9
value Value Values to log
UTF8.encode(string, [zero])
UTF8.decode(data)
Libraries
Promises and Callbacks – “promise.js”
Promises are structured way to avoid callbacks. A function that would normally accept a callback returns
a promise object if no callback is provided. The promise object can the be used to continue processing
when the asynchronous component of the function completes.
Most library function are asynchronous, they either accept a callback function that is called with the
result of the function or return a promise, if no callback function is provided.
Promise(resolver)
10
Creates a new Promise object with a given resolver function. The resolver function is called with two
functions, a resolve and a reject function. The resolver must call one of those two functions when the
asynchronous call completes.
Promise.callback(resolve, reject)
Creates a node.js style callback function from the given promise callbacks. This function can be used to
provide a promise compatible implementation for a function that normally uses node.js callback style
completion.
Promise.resolve(value)
value Result
Create an already resolved promised with the given value as return value.
Promise.reject(err)
Promise.all(coll)
Creates a promise for a collection of promises that is resolved when all promises of the collection are
resolved or rejected when at least one of the promises is rejected.
Promise.prototype.done(value)
value Result
Resolve the given promise, like calling the resolve function in the resolver.
11
Promise.prototype.fail(err)
Reject the given promise, like calling the reject function in the resolver.
Promise.prototype.then(cbdone, [cbfail])
This method is the final client part of a promise. The callback functions will be executed immediately if
the promise is already resolved or rejected. Otherwise they will be called when the promise is resolved
or rejected. The function returns a promise itself, which can be used to chain promises. The returned
promise is considered resolved, when the callback functions return with a normal value. The callback
functions may also provide a promise as a return value, which will then decide the fate of the initially
retuned promise.
Promise.prototype.catch(cbfail)
This method is like the “then” method but provides only a fail callback.
Promise.prototype.finally(cb)
This method is like the “then” method but uses the same callback for success and failure.
12
iteratee function(value, cb) Iterator function called for each element
cb function(err) Optional callback
Call the iterator function for each element of the collection. The iterator must call the provided callback
when finished. The optional callback will be called, when all iterations are completed. The callback will
receive the error message of the first iteration that returned an error in its callback.
Call the iterator function for each element of the collection. The iterator must call the provided callback
when finished. The optional callback will be called, when all iterations are completed. The callback will
receive the error message of the first iteration that returned an error in its callback.
Call the iterator function for each element of the collection. The iterator must call the provided callback
when finished, providing an additional Boolean value. The optional callback will be called, when all
iterations are completed. The callback will receive the error message of the first iteration that returned
an error in its callback. The final return value will be true, if all iterations returned true.
Call the iterator function for each element of the collection. The iterator must call the provided callback
when finished, providing an additional Boolean value. The optional callback will be called, when all
iterations are completed. The callback will receive the error message of the first iteration that returned
an error in its callback. The final return value will be true, if at least one iteration returned true.
13
coll Array Collection
iteratee function(value, cb) Iterator function called for each element
cb function(err, value) Optional callback
Call the iterator function for each element of the collection. The iterator must call the provided callback
when finished, providing an additional Boolean value. The optional callback will be called, when all
iterations are completed. The callback will receive the error message of the first iteration that returned
an error in its callback. The final return value will be an array with all elements of the original collection,
for which the iteratee return true.
Call the iterator function for each element of the collection. The iterator must call the provided callback
when finished, providing a mapped version of the input value. The optional callback will be called, when
all iterations are completed. The callback will receive the error message of the first iteration that
returned an error in its callback. The final return value will be an array with all elements returned by the
iterator functions.
Call the iterator function for each element of the collection. The iterator must call the provided callback
when finished, providing a mapped version of the input value. The optional callback will be called, when
all iterations are completed. The callback will receive the error message of the first iteration that
returned an error in its callback. The final return value will be an array with all elements returned by the
iterator functions.
Async.parallel(tasks, [cb])
Call all functions of the tasks collection in parallel. The final callback will be invoked, when all tasks have
completed or at least one failed. The result is an array of all the values generated and returned by the
tasks.
14
Async.whilst(test, iteratee, [cb])
Calls the test function and the iteratee function as long as test returns true. The callback will be made
with the final results of the iteratee callback.
Calls the iteratee function and the test function as long as test returns true. The callback will be made
with the final results of the iteratee callback.
Async.forever(iteratee, [cb])
Calls the iterate function with a callback as argument. The iterate calls the callback when finished to
start the next iteration. The iteration stops, if a non null argument is passed to the callback as an error.
File.read(fname, [cb])
Read the content of the file with the given name into an ArrayBuffer.
Example writing the content of a text file to the console using a promise as the result.
15
console.log(UTF8.decode(d));
});
Writes the content of the buffer into the file. Creates a new file or truncates an existing file before
writing.
Writes the content of the buffer into the file. Creates a new file or appends the data to an existing.
File.exists(fname, [cb])
File.mkdir(path, [cb])
16
File.delete(path, [cb])
Delete a file
Rename a file
File.open(fname, [cb])
17
File.create(fname, [cb])
Create a new file or truncate an existing file for writing and create a file object.
File.prototype.close([cb])
File.prototype.seek(offset, [cb])
File.prototype.read(size, [cb])
Read the number of bytes from the file into an ArrayBuffer. The resulting buffer may be smaller than the
given size. The result will be an empty ArrayBuffer when reaching then end of the file.
18
});
File.prototype.write(buffer, [cb])
TCP.adapters([cb])
Returns a list of all local host addresses for all network adapters.
TCP.prototype.shutdown([cb])
TCP.prototype.receive(timeout, [cb])
Receive data from a TCP socket. An empty buffer is returned if no data is received in the optional
timeout interval. The value null is returned if the other side closed the connection while waiting.
19
TCP.prototype.send(buffer, [cb])
Create a TCP server object that listens on the given port number for incoming connections. A non null
host argument will restrict the incoming connections to the given address.
TCPServer.prototype.close([cb])
TCPServer.prototype.accept( [cb])
Creating a TCP server, waiting for a connection and sending “Hello World”. Creating a TCP client and
reading from the connection.
20
});
return TCP.connect("localhost", Port);
}).then(client => {
return client.receive();
}).then(data => {
console.log(UTF8.decode(data));
});
UDP.prototype.shutdown([cb])
UDP.prototype.receive([timeout, [cb]])
Receive a datagram, from a UDP socket. The value null is returned if no data is received in the optional
timeout interval
21
UDP.prototype.send(buffer, [cb])
Issue an http get request. The optional arguments are provided as an object:
Issue an http head request. The optional arguments are provided as an object (see get)
22
cb function(err, head, body) Callback with the head and body of the
result
Issue an http post request. The optional arguments are provided as an object (see get)
Issue an http put request. The optional arguments are provided as an object (see get)
Issue an http patch request. The optional arguments are provided as an object (see get)
Issue an http delete request. The optional arguments are provided as an object (see get)
Provide a user and password for the given host, to be used on further requests.
23
HTTP Server “httpserver.js”
HTTPServer(cb)
Create a http server object. The callback will be invoked with an HTTPRequest and HTTPResponse
object and is expected to return a promise.
async HTTPServer.prototype.listen(port)
HTTPServer.prototype.close()
HTTPRequest
async HTTPRequest.prototype.read()
Read a chunk of date from the incoming request body. Returns null when all data has been read.
async HTTPRequest.prototype.body()
24
HTTPResponse.prototype.setHeader(name, value)
HTTPResponse.prototype.setHead(status, headers)
HTTPResponse.prototype.writeHead(status, headers)
HTTPResponse.prototype.sendHead()
HTTPResponse.prototype.write(chunk)
Write one chunk of response data. Sends the header if it was not sent before.
HTTPResponse.prototype.end(chunk)
Write the body or final chunk of response data. Sends the header if it was not sent before.
25
Example for an http server that returns the query arguments as a json document.
new HTTPServer(serve).listen(4080);
SerialPort.list([cb])
Opens a serial port connection. The protocol string consists of four characters. The first denotes the
handshake mechanism, X for software and H for hardware. The second character sets the byte length to
either 7 or 8 bits. The third character specifies the number of stop bits and the final character sets and
enables the parity check.
SerialPort.prototype.close([cb])
26
Shutdown a serial port connection
SerialPort.prototype.receive([cb])
SerialPort.prototype.send(buffer, [cb])
Create a process with the given path and command line arguments.
Process.prototype.terminate([cb])
Terminate a process
Process.prototype.read([cb])
27
Process.prototype.write(buffer, [cb])
Process.prototype.wait([cb])
Load a dynamic link library and call the exported open function with the additional parameters.
Plugin.prototype.close([cb])
Plugin.prototype.read(size, [cb])
28
Plugin.prototype.write(buffer, [cb])
Call the exported control function of the plugin library and return the result buffer.
Plugin.prototype.bind(name, [cb])
Bind to a function of the plugin. The bound functions are called directly on the thread of the JSIQA
execution block and may not wait or take a long time for processing. The signature of the exported
function is provided by the exported bind function of the plugin.
Add config items to the script config section. Each item may contain the following members:
29
short String Short title for e.g. Ribbon
icon String Icon for buttons
icon2 String Alternative icon for two state buttons
type String Type of config item (group, string, bool,
button, number, float, integer, enum,
colormap, frequencyProfile, color)
value Number / String / Object Start value of config item
min Number Minimum value of numeric config item
max Number Maximum value of numeric config item
step Number Step of numeric config item
page Number Page step
pattern String, Array of Strings Path / File pattern, names of enum
values
unit String Unit of numeric config item
titles Array of Strings Titles of enum values
mode String Type dependent mode (file, newfile,
path, button, slider, logslider)
ephemeral Bool The config item value is not retained
between mission loads
invisible Bool The config item is not visible
ribbonHeight Number Required ribbon height (1 or 2)
ribbonWidth Number Required ribbon width (1, 2 or 3)
ribbonPriority Number Ribbon retainment priority -2 to 2
ribbonTop Bool Force the element into the top slot in
the ribbon
ribbonReorder Bool Disable the ribbon reorder for layout if
set to false
ribbonPopUpSticky Bool Keep the popup in the ribbon open
when selected
items Array List of child items for a group
The following icons are available: play, pause, stop, left, right, up, down, radar, record, add, sub
Creating for configuration items and moving them into the “Main” configuration area of the block.
30
return Mission.mapConfig([
{path: Config.alpha, target: "main"},
{path: Config.beta, arget: "main"},
{path: Config.gamma, target: "main"},
{path: Config.delta, target: "main"},
]);
});
Configuration items are always created in the “Script Config” section of the block, but can be mapped
into other areas of the configuration section.
Get the config value and settings of one or more config items. Using an object to specify the paths will
return an object with the matching results.
return Mission.getConfig(null, {
a: Config.alpha,
b: Config.beta
});
The result in the debug view shows all members of the requested config items.
31
It is possible to query the configuration items of a different block in the mission. The “Block Graph
Explorer” block provides an easy way to inspect the other blocks of the mission, and find the appropriate
config items.
The explorer tables show the blocks and the available config items for each block:
32
return Mission.getConfig("Block_IQSignalGenerator_0", {
rate: "main/samplerate"
});
Mission.mapConfig(mappings, [cb])
Maps the config items with given the path to the new target location.
33
Mission.chainConfig(config, source, [cb])
Chains a source config item to a target config item. The source item will then mirror the target item
changes.
Mission.listenConfig(cb)
Display a modal dialog with the given list of config items, and return an object/array of the results if the
user accepts the dialog – null, if the dialog is canceled.
Mission.getFrequencyProfile(id, [cb])
Graph Messages
Graph messages are sent from one block to all blocks up and/or downstream. A specific receiver can be
selected using its name or UUID.
34
Mission.receiveGraphMessages(cb)
Graph message objects have the following fields (not all fields are present or valid for all messages):
35
The following message types are supported:
36
• HEALTH_STATUS Health status notification
• REQUEST_REMOTE_CONFIG Request remote config items
• REMOTE_CONFIG Remote config item notification
• SET_REMOTE_CONFIG Set remote config items
• REMOTE_SAVE_MISSION Save remote mission
• REMOTE_RELOAD_MISSION Reload remote mission
• ROUTE_STREAM Route stream though a multiplexer
• SET_HIGHLIGHT Set highlight sector
Send a graph message up- or downstream through the graph. Returns the response message with the
optional callback.
Mission.sendGraphMessage({
upstream: true,
type: "START_STREAMING"
});
Send a graph message up- or downstream through the graph. Returns the response message with the
optional callback.
Mission.realtimeGraphMessenger (cb)
Creates a realtime graph messenger function that can be used to sends graph message on the script
block thread. The function accepts a message and an optional timeout in milliseconds to wait for the
global graph mutex.
messenger ({
37
upstream: true,
type: "SET_FREQUENCY_RANGE"
startFrequency: 1000.0e6,
endFrequency: 1100.0e6,
}, 1000);
Blocks the up- and downstream graph messages with the given types from propagating through the
block to other blocks of the graph.
Logging
Mission.logInfoCenter(cb)
Mission.logInfoCenterWarning(cb)
Mission.logInfoCenterError(cb)
38
Mission.block([cb])
Returns the info of the current block, and additional global information:
Mission.blocks([cb])
The connection objects in the inputs and outputs array contain the following information:
Mission.listenGraph (cb)
39
Mission.setConnectors(cons, [cb])
Change the dynamic connectors of a block (“in4” .. “in19” and “out4” .. “out19”). Each element of the
cons parameter is one output, selected by its name.
Set the current script health state. The “Show Health Status” checkbox has to be checked for this to
show up in the block graph.
Mission.getMarkers(block, [cb] )
Get a list of the markers of the given block with x, y and z measurement.
Initialize the view grid of the script block to the number of columns and rows
Mission.onkey(cb)
40
cb function(event) Callback
Mission. onmouse(cb)
cb function(event) Callback
Create a chart element in the view grid. The following chart elements and matching parameters are
available.
41
click Object / String Click color
hoverchecked Object / String Hover and checked color
checked Object / String Checked color
align String Horizontal alignment (left, right, center)
valign String Vertical alignment (top, bottom, center)
rounded Number Radius of rounded corners
input String Config item that is triggered by this text
field
42
inputRowIndex String Config item that receives the currently
selected table row
inputColumnName String Config item that receives the name of
the currently selected table config
rows Array of Objects Background (background) and text color
(color) values for each row of the table
selected Number Index of the row to select/highlight or -1
for none
focus Object Clear (null) or set the focus with an
object with row and column fields.
cell Object Changing a single cell, providing the row,
column and value
Data elements:
Data elements:
43
scaleX Number Scale factor
unitY String Unit of measurement
minY Number Minimum value
maxY Number Maximum value
scaleY Number Scale factor
Data elements:
x Number X Value
y Number Y Value
Data elements:
44
colormap String Name of the colormap config item
compressor String Name of an optional time compressor
block
inverttime Bool Invert vertical orientation
Traces Objects
45
Markers Objects
Marker Configuration
46
harmonics Bool Place markers in harmonic series
modefreq String Frequency mode, “RTBW”, “Center”,
“Area”, “Custom”
basefreq Number Base frequency
stepfreq Number Step frequency in series
spanfreq Number Frequency width in band mode
deltafreq Number Frequency offset in depended markers
excursion Number Excursion in peak mode
threshold Number Threshold in peak mode
separation Number Separation in peak mode
Parameters
47
shape String Shape of the marker, any of “circle”,
“cross”, “arrow”, “beam”, “line”,
“arrowcircle”, “compassarrow”,
“triangle”, “quad”, “pentagon”,
“hexagon”, “octagon”, “star3”, “star4”,
“star5”, “star6”, “halfcircle”, “path”,
“tripath”
radius Number Radius of marker in meter
size Number Radius of marker in pixel
width Number Width of radius outline in pixel
color Object / String Outline color of marker
fill Object / String Fill color of marker
path Array Array of objects with latitude and
longitude for path markers
Items can be provided by the construction parameter, using setParams or with addData. Each item is
identified by its unique name.
49
vsplitter – vertical splitter
Chart.prototype.setParams(params, cb)
Chart.prototype.getParams(params, cb)
Chart.prototype.addData(data, cb)
Chart.prototype.remove(params, cb)
50
Chart.prototype.show(show, cb)
51
start Boolean Start of segment indicator
end Boolean End of segment indicator
antenna Antenna Object Antenna Information
categories Array List of category names
samples Array / TypedArray / Object Sample data
Spectrum samples should be provided as an array of typed arrays, IQ data as a typed array of complex
values.
The antenna object has the following members:
DSPStream.receivePackets(stream, cb)
Install a callback to be invoked when a stream packet is received by the dsp block input with index
“stream”. The callback function can receive the following arguments:
The meta data element receives an object similar to the object required for the sendPacket function.
The samples can be retrieved by calling the samples function with an integer index, or no index for the
complete data.
DSPStream.streamTimer(cb)
Create a stream timer. Returns a function that provides the high precision stream time of the DSP graph.
DSPStream.addBlocks(blocks, cb)
52
blocks Array / Object Block specifications
cb function(err, data) Optional callback
Install a series of dsp processing block into the dsp processing child graph of the script block.
The block specifications are provided as either an array or an object of the following objects.
DSPStream.connectBlocks(connections, cb)
Connect a series of blocks in the dsp child graph of the script block. Each connection specification is an
object with the following members:
The input DSP blocks for the inbound connections are named “in0”, “in1”, “in2” and “in3” the names of
the outbound connections are “out0”, “out1”, “out2” and “out3”. The script DSP block name is “script”
and it has the inputs “in0”, “in1”, “in2” and “in3” and the outputs “out0”, “out1”, “out2” and “out3”.
The inbound connectors are connected to the input connections of the DSP script block and the output
connectors of the DSP script block are connected to the outbound connections. You may freely reroute
this connections.
One type of callback function is used for all asynchronous library calls:
typedef void (* PluginCalllback)(
void * context,
int64_t data,
const void * buffer);
The callback function and the context parameter are provided by the caller of the library function, the
data value and the buffer are the function return. A negative value for data designates an error.
53
The library should export the following functions:
void RTSA_PluginOpen(
const char16_t * name,
int64_t index,
const char16_t * params,
PluginCalllback callback,
void * context);
Called initially after loading the library. The name, index and params value may be used by the library to
provide different resources. The returned value is used as a handle for all further calls.
void RTSA_PluginClose(
int64_t handle,
PluginCalllback callback,
void * context);
Called when the plugin is closed by the javascript code. There is no guarantee that this function will be
called (e.g. it will not be called if the object representing the handle is destroyed by the garbage
collector). Resource management must therefore also be handled by the terminate function.
void RTSA_PluginTerminate(
int64_t handle,
PluginCalllback callback,
void * context);
Called before the plugin is unloaded. The plugin may not call any other pending plugins or access buffers
after completing this call by calling the callback function. This function will be called regardless of the
way the javascript object is destroyed.
void RTSA_PluginRead(
int64_t handle,
int64_t size,
PluginCalllback callback,
void * context);
Reads an amount of binary data from the library into a javascript ArrayBuffer. The library may use the
provided size parameter as an indication for the requested amount. The buffer provided with the
callback remains in the possession of the library.
void RTSA_PluginWrite(
int64_t handle,
int64_t size,
const void * buffer,
PluginCalllback callback,
void * context);
Write an amount of binary data from the javacript code to the library. The buffer pointer remains valid
until the library is closed or the call is completed using the close function. The amount of data written
can be signaled using the data parameter of the callback.
54
void RTSA_PluginControl(
int64_t handle,
const char16_t * name,
int64_t size,
const void * buffer,
PluginCalllback callback,
void * context);
Invokes a control function in the library. The function is denoted by the name string. Input data is
provided using the binary buffer and returned using a buffer with the callback.
void RTSA_PluginBind(
int64_t handle,
const char16_t * name,
PluginCalllback callback,
void * context);
Bind a synchronous library function by name to a javascript function. The function pointer is provided
with the data portion of the callback, the signature with a unicode string in the buffer.
The general signature of the call is one of the following, based on the return type:
Synchronous calls may not delay the execution or wait for a longer period. The layout of the data buffer
is specified with one character per parameter. The first character denotes the return type.
Alignment of all elements is on their natural boundary. Return types may be either s, l or d.
Example:
sbb*i
int16_t w1;
int8_t b1, b2;
int64_t a1s;
int32_t * a1p;
55
The memory of a returned string must be valid and thus cannot be placed on the stack of the called
function. A guaranteed buffer of 500 bytes is provided at the end of the data object for this purpose.
Longer strings must be allocated on the heap and maintained by the plugin.
DSP Blocks
Storage and Capture
TimeShift
FileWriter
Filename filename(string)
Record filerecord(bool, FALSE)
Auto Start autostart(bool, FALSE)
Add Index addfileindex(bool, FALSE)
Add Date addfiledate(bool, FALSE)
Start Index fileindex(number, 0)
Compression compression(number, 1)
Previews previewdist(number, 5.0)
56
TimeResample
TimeErosion
TimeFIRFilter
TimeFFTFilter
Filter Mode filtermode(enum, Low Pass, [Low Pass;High Pass;Band Pass;Low Reject;High
Reject;Band Reject])
FFT Size fftsize(number, 1024)
Resample Frequency resamplefreq(number, 10000)
Lower Frequency lowerfreq(number, 1000)
Upper Frequency upperfreq(number, 1000)
Transition Frequency transitionfreq(number, 100)
Pass Response passresponse(number, 0)
Stop Response stopresponse(number, -70)
PulsedSegments
57
Arithmetic Processing
LinearTransform
UnaryArithmetic
CombiningArithmetic
CombiningCondition
TriggerAndHold
SpectrumErosion
58
Mode mode(enum, Erosion, [Erosion;Dilation;Opening;Closing])
Width width(number, 0)
FrequencyFIRFilter
SegmentSpectrum
SpectrumResample
SmoothNoiseFloor
PowerUnitConversion
FrequencyUnitConversion
MaxHold
59
Reset maxreset(trigger)
AntennaMaxHold
MaxFall
MinHold
Average
Utilization
SpectrumOutline
PulsedSpectrumShape
60
Frequency Span freqspan(number, 20000000)
Persistence persistence(number, 0.7)
ChannelPower
DirectionPower
Histogram
SpectralHistogram
Detection
PulseDetector
61
IQ Processing
IQNormalize
IQToSpectrumConverter
IQFrequencyFilter
62
IQDemodulation
IQToTimeSlice
IQHistogram
IQHistogram3D
63
Persistence Factor persistence(number, 0.75)
Mode mode(enum, dots, [dots;contiguous;lines;fill;temporal])
Demodulation demodmode(enum, none, [none;ofdm;ofdm_diff])
Phase Recovery modphaserec(enum, none, [none;fixed phase;modulus power])
Modulation Frequency modfreq(number, 0)
Modulation Phaseshift modshift(number, 0)
Guard Type guardtype(enum, blank, [blank;cyclic])
FFT Size fftsize(number, 32)
Guard Samples guardsamples(number, 16)
Band Limit Lower bandlower(number, -4096)
Band Limit Upper bandupper(number, 4095)
Band Equalization bandequalization(number, 0)
Symbol Rotation symbolrotation(number, 0)
Source X sourcex(enum, i, [i;q;r;rq;phi;dphi;phase;band])
Source Y sourcey(enum, q, [i;q;r;rq;phi;dphi;phase;band])
Source Z sourcez(enum, phase, [i;q;r;rq;phi;dphi;phase;band])
Value Bins valuesteps(number, 64)
IQCondition
IQSymbolDecoder
Symbol Coding symcoding(enum, [none; auto; GFSK; BPSK; DBPSK; QPSK; QPSK_C;
DQPSK; P4DQPSK; 8DPSK; QAM16; QAM64; QAM256; QAM1024;
Bluetooth LE; Bluetooth; Bluetooth EDR 2M; Bluetooth EDR 3M;
DECT; GSM; WiFi 802.11b; WiFi 802.11g 5MHz; WiFi 802.11g 10MHz;
WiFi 802.11g 20MHz; Enhanced Shockburst:SiKRadioMAVLink])
Symbol Frequency symfreq(number, 1000000)
Power Thresh Percentile powerpercentile(number, 0.95)
Power Thresh Ratio powerratio(number, 0.8)
IQSampleDelta
64
Sweeping, Stitching and Segmentation
SweepAggregate
SegmentPacker
SpectrumStitcher
MergeCategories
StreamSwitch
65
Select
SampleHold
Audio Processing
AudioMonitor
AudioMergeChannels
AudioAMFMDecoder
AudioMultiAMFMDecode
AudioVoiceFilter
66
Video Processing
ImageResize
ImageGreyscale
ImageContrast
ImageConvolution
ImageMorphologicalOperation
67
Size size(number, 1)
VideoGlobalMotionDetection
ImageFFTFilter
ImageFrameDelta
ImageRegionLabeling
ImageObjectTracking
ImageCombining
68
Samples
Peak Detector
Continuously write the frequency and value of the peak signal in a spectrum to the console.
DSPStream.addBlocks({
fft: {type: "IQToSpectrumConverter", config: {fftsize: 4096}}
}).then(() => {
return DSPStream.connectBlocks([
{source: "in0", drain: "fft"},
{source: "fft", drain: "script", input: "in0"},
]);
}).then(() => {
DSPStream.receivePackets(0, (flags, meta, samples) => {
if (meta.samples) {
let s = samples(0);
let r = IQ.rankIndex(s, 1, true)[0];
let f = meta.startFrequency + r * meta.stepFrequency;
console.log(f, s[r]);
}
});
});
The script uses an IQ to spectrum converter block that uses an FFT with 4096 bins as a preprocessor. The
output of the FFT block is forwarded to the script input connection 0.
The receive packet callback searches for the highest value in the first spectrum of each packet and
dumps the frequency and signal strength. Using only the first spectrum reduces the rate of processing.
69
FM Demodulator
The sample FM demodulator uses the phase change of the demodulated IQ samples as an measurement
of the FM modulation.
The data is streamed from a file into the first input, demodulated and converted to audio. The result is
displayed in a waterfall view and played as audio.
DSPStream.addBlocks({
demodulator: {type: "IQDemodulation", config: {
centerfreq: 100.395e6, samplerate: 192000, spanfreq: 48000}},
sampleDelta: {type: "IQSampleDelta", config: {sampledelta: "rotate"}}
}).then(() => {
return DSPStream.connectBlocks([
{source: "in0", drain: "demodulator"},
{source: "demodulator", drain: "sampleDelta"},
{source: "sampleDelta", drain: "script", input: "in0"},
{source: "demodulator", drain: "out1"},
]);
}).then(() => {
DSPStream.receivePackets(0, (flags, meta, samples) => {
let s = samples();
DSPStream.sendPacket(0, {
payload: "audio",
samples: IQ.mul(IQ.phi(s), 0.25),
startTime: meta.startTime,
endTime: meta.endTime
});
});
});
The script uses two preprocessing blocks, a demodulator to move the FM signal to the center and reduce
the sample rate to audio rate and a sample delta block to convert the IQ samples to relative rotations.
70
Each sample is rotated by the complex conjugate of the previous sample and thus represents the phase
change.
The blocks are connected in the second section and attached to the script input 0 and the block output 1
for inspection.
The receivePackets installs a callback, that is called with each incoming IQ packet. The IQ object uses the
“phi” to convert all samples to their phase from -pi to +pi and multiplies them by 0.25 to get them into
sample range. A new packet, now with audio data, is then sent to the block output 0 and played by the
attached Audio Monitor block.
71