FakeRtlSdrDriver class
In-memory RtlSdrDriver with no FFI/Android dependency — for unit tests
of core_rtlsdr controllers, and for consumers (e.g. a future
widget_rtlsdr) that want to test UI against a radio session without a
dongle or an emulator.
State is exposed as plain mutable fields so a test can poke "hardware"
behavior directly (e.g. fake.rfLevelDbfs = -10;) and then assert how a
controller reacted to it.
- Implemented types
Constructors
- FakeRtlSdrDriver({double signalLevelForFrequency(int frequencyHz)?})
Properties
- audioLevelDbfs ↔ double
-
getter/setter pair
- demodMode → DemodMode
-
no setteroverride
- failNextCall ↔ bool
-
Set to
trueto make the next mutating call fail (return a non-zero status), then automatically reset tofalse— for testing error handling paths (lastError, etc.) without needing real hardware to misbehave.getter/setter pair - frequencyHz → int
-
no setteroverride
- gainAuto → bool
-
no setter
-
gainList
↔ List<
int> -
Gains a real RTL2832U + R820T2 tuner reports, in tenths of a dB —
realistic defaults so
getGainList()behaves like real hardware without a test having to set it up.getter/setter pair - gainTenthDb → int
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- iqBytesReceived ↔ int
-
getter/setter pair
- iqRecordingBytesWritten ↔ int
-
getter/setter pair
- iqRecordingFd ↔ int?
-
getter/setter pair
- iqRecordingPath ↔ String?
-
getter/setter pair
- isIqRecording → bool
-
no setteroverride
- isOpen → bool
-
Whether the native driver has an open device (set by the Kotlin side
after the USB permission flow — see
UsbState/UsbChannel).no setteroverride - isRecording → bool
-
no setteroverride
- isStreaming → bool
-
no setteroverride
- open ↔ bool
-
getter/setter pair
- pilotLevel ↔ double
-
getter/setter pair
- rdsEnabled → bool
-
no setter
- rdsInfo ↔ RdsInfo
-
getter/setter pair
- recordingBytesWritten ↔ int
-
getter/setter pair
- recordingFd ↔ int?
-
getter/setter pair
- recordingPath ↔ String?
-
getter/setter pair
- rfLevelDbfs ↔ double
-
getter/setter pair
- ringOverflowCount ↔ int
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sampleRateHz → int
-
no setteroverride
- signalLevelForFrequency → double Function(int frequencyHz)?
-
Optional: makes getStats'
rfLevelDbfsa function of the currently tuned frequency instead of the static rfLevelDbfs field — handy for testingScanController, which tunes across a range and samples the level at each step.final -
spectrumDb
↔ List<
double> -
getter/setter pair
- squelchOpen ↔ bool
-
getter/setter pair
- squelchThresholdDb → double
-
no setter
- stereoEnabled → bool
-
no setter
- stereoLocked ↔ bool
-
getter/setter pair
Methods
-
close(
) → int -
Closes the native device. Does not release this driver object itself —
see dispose.
override
-
dispose(
) → void -
Releases native resources held by this driver instance (FFI struct
buffers). Does NOT close the device (see close) — call this once,
when you're done with the driver object itself (app shutdown, or
swapping implementations).
override
-
getGainList(
) → List< int> -
Gains supported by the tuner, in tenths of a dB. Needs the device
already open — call once after
deviceReady.override -
getRdsInfo(
) → RdsInfo -
override
-
getSpectrumDb(
int numBins) → List< double> -
override
-
getStats(
) → RadioStats -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setDemodMode(
DemodMode mode) → int -
override
-
setFrequencyHz(
int hz) → int -
override
-
setGainMode(
{required bool auto}) → int -
override
-
setGainTenthDb(
int tenthDb) → int -
override
-
setRdsEnabled(
bool enabled) → int -
override
-
setSampleRateHz(
int hz) → int -
override
-
setSquelchThresholdDb(
double thresholdDb) → int -
override
-
setStereoEnabled(
bool enabled) → int -
override
-
startIqRecording(
String filePath) → int -
override
-
startIqRecordingFd(
int fd) → int -
Same as startIqRecording, but writes through an already-open file
descriptor instead of a path — see startRecordingFd.
override
-
startRecording(
String filePath) → int -
override
-
startRecordingFd(
int fd) → int -
Same as startRecording, but writes through an already-open file
descriptor instead of a path — for destinations with no plain
filesystem path available, e.g. Android's public Downloads folder via
MediaStore (see
core_rtlsdr'sRecordingController.startRecordingToDownloads).override -
startStreaming(
) → int -
override
-
stopIqRecording(
) → int -
override
-
stopRecording(
) → int -
override
-
stopStreaming(
) → int -
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited