Returns true
if there's an active stream.
Version of the USB API implemented by the device's firmware
In 0xAABB
form (AA
= major, BB
= minor).
Query the firmware version
Put the radio in CPLD firmware upgrade mode and write the payload
This throws if there's another stream in progress.
The device will need to be reset after this.
TODO
Requires USB API 1.3.
TODO
Requires USB API 1.3.
Release resources and close the USB device
Unless the device is used until process exit, this must be called once when it's no longer needed.
There must be no pending promises or an active stream when calling this. After return, no more methods should be called on this object.
Put the radio in RX mode and stream I/Q samples
The supplied callback will be regularly called with an
Int8Array
buffer. Every two values of the buffer
form an I/Q sample. The buffer may be overwritten
later, so avoid storing any reference to it; instead
make a copy of the data if needed.
To request ending the stream, return false
from the
callback or use requestStop (the callback will no
longer be called). Any transfer / callback error rejects
the promise and cancels all transfers. The promise won't
settle until all transfers are finished, regardless of
whether the stream is ended or errored.
This throws if there's another stream in progress.
Requests stopping the active stream (if there is one)
Calling this has the same effect as returning false
the next time the callback gets called. Note that the
stream doesn't finish instantly, you still need to
wait for the promise to end. This is merely a convenience
function.
Reset the device
Requires USB API 1.2.
Put the radio in sweep RX mode and stream I/Q samples
Put the radio in TX mode and stream I/Q samples
The supplied callback will be regularly called with an
Int8Array
buffer to fill before return. Every two
values of the buffer form an I/Q sample. Different
buffers may be passed or reused, so avoid storing
references to them after return.
To request ending the stream, return false
from the
callback or use requestStop (the callback will no
longer be called and the current buffer will not be
transmitted). Any transfer / callback error rejects
the promise and cancels all transfers. The promise won't
settle until all transfers are finished, regardless of
whether the stream is ended or errored.
This throws if there's another stream in progress.
Open the passed USB device
This function does not validate the device,
it's recommended to use the open
module function
instead of this function directly.
USB device (must not be open)
Retrieve list of Opera Cake board addresses (uint8, terminated by 0)
Requires USB API 1.2.
Test GPIO functionality of an Opera Cake
Returns test result (uint16)
Requires USB API 1.3.
Set Opera Cake ports
Requires USB API 1.2.
Set Opera Cake frequency-antenna ranges
Requires USB API 1.3.
Initialize sweep mode
Requires USB API 1.2.
is a list of [start, stop]
pairs of frequencies in MHz,
no more than MAX_SWEEP_RANGES entries.
the number of sample bytes to capture after each tuning.
the width in Hz of the tuning step.
number of Hz added to every tuning frequency. Use to select center frequency based on the expected usable bandwidth.
Enable / disable RX/TX RF external amplifier
Antenna port power control
Set baseband filter bandwidth in Hz
Possible values: 1.75/2.5/3.5/5/5.5/6/7/8/9/10/12/14/15/20/24/28MHz
Enable / disable clock output through CLKOUT
Requires USB API 1.3.
Set the tuning frequency
Set the tuning frequency (raw version)
intermediate frequency
front-end local oscillator frequency
image rejection filter path
Enable / disable hardware sync
Multiple boards can be made to syncronize their USB transfers through a GPIO connection between them.
Requires USB API 1.2.
Set RX LNA (IF) gain, 0-40dB in 8dB steps
Set the sample rate
For anti-aliasing, the baseband filter bandwidth is automatically set to the widest available setting that is no more than 75% of the sample rate. This happens every time the sample rate is set. If you want to override the baseband filter selection, you must do so after setting the sample rate.
frequency in Hz, 2-20MHz (double)
Set the sample rate (raw version)
You should probably use setSampleRate instead of this function.
For anti-aliasing, the baseband filter bandwidth is automatically set to the widest available setting that is no more than 75% of the sample rate. This happens every time the sample rate is set. If you want to override the baseband filter selection, you must do so after setting the sample rate.
2-20Mhz - as a fraction, i.e. freq 20000000 divider 2 -> 10Mhz
Set TX VGA (IF) gain, 0-47dB in 1dB steps
Enable / disable PortaPack display
Requires USB API 1.4.
Set RX VGA (baseband) gain, 0-62dB in 2dB steps
Generated using TypeDoc
Reference to an open HackRF device
This is mostly a direct API to the USB interface. Call close when no longer needed.
Keep in mind some methods require a certain API version to be implemented by your device's firmware; this is noted in their documentation, and an
USB_API_VERSION
error will be thrown if you attempt to use them. usbApiVersion returns the version implemented by the firmware. It's strongly recommended to upgrade your device's firmware to the latest version to avoid problems and glitches.This API does strict validation of passed integers (they should be integers and be in-range). Gains, in particular, will be rejected instead of rounded down to the nearest step.