Programming Information for WiNRADiO 1000/1500/3000 Series Receivers

This document outlines API specification for the WR-1000, WR-1500 and WR-3000 series receivers, both internal and external. The API in implemented in both 16 and 32 bit drivers: WRAPI.DLL for 16 bit applications (Windows 3.1x and 95) and WRAPI32.DLL for 32 bit applications (Windows 95, 98, NT 3.5x & 4.0, 2000 and XP). A separate 16 bit DLL is provided for Windows NT that thunks to the 32 bit DLL.

Each function shows its declaration in C and in Delphi (Pascal) and can be used in both 16 and 32 bit environments without modification. The only difference is that 32 bit applications have to use WRAPI32 while 16 bit applications have to use WRAPI.

It is strongly recommended to use exception handling to close the radio device if an exception occurs while a radio device is open (the examples at the end do not use exception handling).

Please note that this API replaces the old API documented in the manual which uses RADIOAPI.DLL. A RADIOAPI.DLL is supplied with the current drivers for backward compatibility with software that used RADIOAPI.

OpenRadioDevice

Opens a radio device to allow you to control the device using the other API functions.

C/C++ declaration

int OpenRadioDevice(int iDeviceNum);

Delphi declaration

function OpenRadioDevice(iDeviceNum: Integer): Integer;

Parameters

iDeviceNum

Radio device number that you would like to open from 1 to 255. If zero is specified, it will open the next available device. Serial devices (WR-xx00e) cannot be explicitly specified, but can only be opened with zero.

Return Value

Returns a handle to a device that has to be used to call all the other API functions (hRadio). If zero is returned, no devices were available to open or the specified device doesn't exist.

Remarks

If you would like to have more than one application use the same device, you will have to close the device when you have finished using it to allow other applications to access the device. For Win32 applications, multiple threads can access the same device at any time.

CloseRadioDevice

Closes a radio device that was previously opened, and allows another program to access the radio device.

C/C++ declaration

BOOL CloseRadioDevice(int hRadio);

Delphi declaration

function CloseRadioDevice(hRadio: Integer): Bool;

Parameters

hRadio

Handle to the radio device to close, was returned from OpenRadioDevice.

Return Value

If the function succeeds, the return value is TRUE, otherwise the return value is FALSE (invalid handle, or has already been closed).

GetRadioDeviceInfo

The GetRadioDeviceInfo function retrieves hardware information about a radio device.

C/C++ declaration

int GetRadioDeviceInfo(int hRadio, LPRADIOINFO lpInfo);

Delphi declaration

function GetRadioDeviceInfo(hRadio: Integer;

  lpInfo: PRadioInfo): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

lpInfo

Address to a RADIOINFO structure that will be filled with the capabilities and other information about the radio device. This can be NULL.

Return Value

Bit field containing the current status of the controller on the radio device (unspecified bits are reserved):

Constant Value Description
RS_PLL $0004 High if PLL is locked
RS_CONNECTION $0008 High if receiver is not connected to interface (PCMCIA)
RS_VCC $0010 High if power is not connected to receiver

GetSignalStrength

The GetSignalStrength function returns the strength of the radio signal received by the radio device.

C/C++ declaration

DWORD GetSignalStrength(int hRadio);

Delphi declaration

function GetSignalStrength(hRadio: Integer): Longint;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

The low order word ranges from 0 (very weak signal) to 120 (very strong signal). This is the value used by WiNRADiO, and is approximately equal to the signal strength in dB relative to the noise floor of the receiver.

The high order word is reserved for future use and should be masked out.

GetRawSignalStrength

The GetRawSignalStrength function returns RAW signal strength value.

C/C++ declaration

DWORD GetRawSignalStrength(int hRadio);

Delphi declaration

function GetRawSignalStrength(hRadio: Integer): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

RAW signal strength <0, 255> taken directly from DAC.

SetFrequency

The SetFrequency function sets the frequency the device is to be tuned to.

C/C++ declaration

BOOL SetFrequency(int hRadio, DWORD dwFreq);

Delphi declaration

function SetFrequency(hRadio: Integer; dwFreq: Longint): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

dwFreq

Specifies the frequency to tune to receiver to. The first 31 bits is used to specify the frequency in Hz from 0 to 2.147 GHz. If bit 31 is set (MSB), the value in the first 31 bits is multiplied by ten, allowing the tuneable frequency range to be from 0 to 21.47 GHz with a minimum resolution of 10 Hz.

Return Value

If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.

Remarks

The lower and upper limits are specified in the dwMinFreq and dwMaxFreq fields respectively in the RADIOINFO structure that can be retrieved with the GetRadioDeviceInfo function.

See Also

GetFrequency

SetMode

The SetMode function sets the reception mode of the radio device.

C/C++ declaration

BOOL SetMode(int hRadio, int iMode);

Delphi declaration

function SetMode(hRadio, iMode: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

iMode

Specifies the reception mode to set the device to:
Constant Value
RMD_CW 0x0000
RMD_AM 0x0001
RMD_FMN 0x0002
RMD_FMW 0x0003
RMD_LSB 0x0004
RMD_USB 0x0005
RMD_FMM 0x0006
RBW_DEFAULT 0x0000
RBW_500 0x0100
RBW_2500 0x0200
RBW_6k 0x0300
RBW_12k 0x0400
RBW_17k 0x0500
RBW_50k 0x0600
RBW_280k 0x0700

Return Value

If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.

Remarks

To set a mode, a RMD_xxx mode must be specified and ORed with an optional RBW_xxx bandwidth value. If the bandwidth is not specified it will default to the bandwidth used for the mode. The constant is an approximate bandwidth indication, calling GetModeString will return the actual bandwidth.

The number of modes that the device supports is specified by the iNumModes field of the RADIOINFO structure that can be obtained from the GetRadioDeviceInfo function. The actual modes supported can be read from the lpSupportedModes array, the number of elements specified by iNumModes. The array specifies both the mode and bandwidths.

See Also

GetMode

SetVolume

The SetVolume function sets the audio output volume level.

C/C++ declaration

BOOL SetVolume(int hRadio, int iVolume);

Delphi declaration

function SetVolume(hRadio, iVolume: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

iVolume

Specifies the output audio volume from the receiver.

Return Value

If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.

Remarks

The highest volume level is specified in the iMaxVolume field of the RADIOINFO structure that can be retrieved with the GetRadioDeviceInfo function.

No audio will be heard while the mute is on.

See Also

GetVolume, SetMute

SetAtten

The SetAtten function activates or deactivates the RF input attenuator. It is used to prevent overloading of the receiver with strong signals.

C/C++ declaration

BOOL SetAtten(int hRadio, BOOL fAtten);

Delphi declaration

function SetAtten(hRadio: Integer; fAtten: Bool): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

fAtten

If TRUE, the RF attenuator is on, otherwise if FALSE, the RF attenuator is off (more sensitive).

Return Value

If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.

See Also

GetAtten

SetMute

The SetMute function controls whether the audio output is muted or not.

C/C++ declaration

BOOL SetMute(int hRadio, BOOL fMute);

Delphi declaration

function SetMute(hRadio: Integer; fMute: Bool): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

fMute

If TRUE, the audio mute is on, otherwise if FALSE, the audio mute is off.

Return Value

If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.

See Also

GetMute, SetVolume

SetPower

The SetPower function switches the device's power on or off. This function can be used to power down WiNRADiO in portable applications to conserve battery power.

C/C++ declaration

BOOL SetPower(int hRadio, BOOL fPower);

Delphi declaration

function SetPower(hRadio: Integer: fPower: Bool): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

fPower

If TRUE, the radio's power is on, otherwise if FALSE, the radio's power is off.

Return Value

If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.

Serial devices cannot be powered down from software

See Also

GetPower

SetScanMode

The SetScanMode function controls the signal strength response of the radio receiver to a change in frequency.

C/C++ declaration

BOOL SetScanMode(int hRadio, BOOL fScan);

Delphi declaration

function SetScanMode(hRadio: Integer; fScan: Bool): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

fScan

TRUE to enable scan mode, FALSE to disable it.

Return Value

If the function succeeds, the return value is TRUE, otherwise the return value is FALSE.

Remarks

If the scan mode is enabled, the value returned from GetSignalStrength may be less accurate but will respond to a change in frequency a lot quicker.

The iMaxAMScanRate and iMaxFMScanRate fields of the RADIOINFO structure specify how fast the radio can scan in either mode in the number of stations per second. So a delay of 1000/iMaxXXScanRate milliseconds should be inserted between a call to SetFrequency and GetSignalStrength while scanning.

See Also

GetScanMode

SetBFOOffset

The SetBFOOffset function sets the "Beat Frequency Oscillator" offset frequency in CW or SSB reception mode (WR-1000 and WR-3000 hardware).

C/C++ declaration

BOOL SetBFOOffset(int hRadio, int iBFO);

Delphi declaration

function SetBFOOffset(hRadio, iBFO: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

iBFO

Specifies the BFO frequency offset in Hz.

Return Value

If the function succeeds, the return value is TRUE, otherwise the return value is FALSE.

Remarks

The frequency range (above and below zero) of the oscillator is specified in the iMaxBFO field of the RADIOINFO structure that can be retrieved with the GetRadioDeviceInfo function.

The BFO is only active in CW/SSB mode.

On later models (WR-1500 and WR-3100), the BFO cannot be set and SetIFShift has to be used. Use the RIF_CWIFSHIFT flag in the dwFeatures field in RADIOINFO to determine whether the device uses SetBFOOffset or SetIFShift in CW mode.

See also

GetBFOOffset, SetMode

SetIFShift

The SetIFShift function sets the effective offset of the IF filter in LSB, USB and CW modes (depending on the hardware).

C/C++ declaration

BOOL SetIFShift(int hRadio, int iIFShift);

Delphi declaration

function SetIFShift(hRadio, iIFShift: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

iIFShift

Specifies effective offset of the IF filter in Hz.

Return Value

If the function succeeds, the return value is TRUE, otherwise the return value is FALSE.

Remarks

The shift range (above and below zero) is specified in the iMaxIFShift field of the RADIOINFO structure that can be retrieved with the GetRadioDeviceInfo function.

IF shift is only available in LSB and USB modes. These modes are only available on the receiver if the RIF_LSBUSB flag is set in the dwFeatures field in the RADIOINFO structure. If the RIF_CWIFSHIFT flag is set, the IF shift can also be applied to CW mode as well.

See also

GetIFShift, SetBFOOffset, SetMode

SetAudioSource

The SetAudioSource function switches the audio output between various internal sources including the receiver and the DSP.

C/C++ declaration

BOOL SetAudioSource(int hRadio, int iSource);

Delphi declaration

function SetAudioSource(hRadio, iSource: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

iSource

The audio source can be one of the following values:
Constant Value
RAS_RADIO 0
RAS_DSP 1

Return Value

If the function succeeds, the return value is TRUE, otherwise the return value is FALSE.

Remarks

The The number of audio sources that the device supports is specified by the iNumSources field of the RADIOINFO structure that can be retrieved with the GetRadioDeviceInfo function.

See also

GetAudioSource, SetDSPSource

SetDSPSource

The SetDSPSource function switches the DSP input between various internal sources including the receiver and the FM discriminator (for data decoding).

C/C++ declaration

BOOL SetDSPSource(int hRadio, int iSource);

Delphi declaration

function SetDSPSource(hRadio, iSource: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

iSource

The DSP source can be one of the following values:
Constant Value
RDS_RADIO 0
RDS_DATA 1

Return Value

If the function succeeds, the return value is TRUE, otherwise the return value is FALSE.

Remarks

The The number of DSP sources that the device supports is specified by the iDSPSources field of the RADIOINFO structure that can be retrieved with the GetRadioDeviceInfo function. If no DSP is fitted to the device, the function always returns FALSE.

See also

GetDSPSource, SetAudioSource

SetAGC

The SetAGC function sets the AGC value for given receiver.

C/C++ declaration

BOOL SetAGC(int hRadio, DWORD dwAGC)

Delphi declaration

function SetAGC(hRadio: Integer; dwAGC: Longint): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

dwAGC

1 = AGC On, 0 = AGC Off, other values are reserved.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

SetIFGain

Sets IFGain value for the specified receiver. IFGain setting is supported only by receiver that have RIF_IFGAIN flag set in the dwFeatures member of its RadioInfo structure. The maximum IFGain value is then stored in RadioInfo.iMaxIFGain.

C/C++ declaration

BOOL SetIFGain(int hRadio, int iIFGain)

Delphi declaration

function SetIFGain(hRadio, iIFGain: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

iIFGain

IFGain value to be set.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

GetFrequency

The GetFrequency function retrieves the frequency the receiver is tuned to.

C/C++ declaration

DWORD GetFrequency(int hRadio);

Delphi declaration

function GetFrequency(hRadio: Integer): Longint;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

The current receiver frequency in Hz. If the handle is invalid, -1 (0xFFFFFFFF) is returned instead.

See Also

SetFrequency

GetMode

The GetMode function retrieves the reception mode the receiver is in.

C/C++ declaration

int GetMode(int hRadio);

Delphi declaration

function GetMode(hRadio: Integer): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

The current receiver mode if successful, otherwise, -1 is returned. See SetMode for the possible mode return values.

GetVolume

The GetVolume function returns the audio output volume of the radio device.

C/C++ declaration

int GetVolume(int hRadio);

Delphi declaration

function GetVolume(hRadio: Integer): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

The current audio output volume if successful, otherwise, -1 is returned.

See Also

SetVolume

GetAtten

The GetAtten function returns the RF input attenuator setting.

C/C++ declaration

BOOL GetAtten(int hRadio);

Delphi declaration

function GetAtten(hRadio: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

GetAtten returns TRUE if the RF attenuator is on, otherwise it returns FALSE if it is off.

See Also

SetAtten

GetMute

The GetMute function returns the status of the mute control on the audio output.

C/C++ declaration

BOOL GetMute(int hRadio);

Delphi declaration

function GetMute(hRadio: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

GetMute returns TRUE if audio muting is on, otherwise it returns FALSE if it is off.

See Also

SetMute

GetPower

The GetPower function returns whether the receiver's power is on or off.

C/C++ declaration

BOOL GetPower(int hRadio);

Delphi declaration

function GetPower(hRadio: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

Returns TRUE if the receiver's power is on, otherwise it returns FALSE if it is off.

See Also

SetPower

GetScanMode

C/C++ declaration

BOOL GetScanMode(int hRadio);

Delphi declaration

function GetScanMode(hRadio: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

Returns TRUE if the receiver has been set to scan mode, otherwise returns FALSE if not.

See Also

SetScanMode

GetBFOOffset

C/C++ declaration

int GetBFOOffset(int hRadio);

Delphi declaration

function GetBFOOffset(hRadio: Integer): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

The most recently set BFO offset.

See Also

SetBFOOffset

GetIFShift

The GetIFShift function returns the effective offset of the IF filter in LSB and USB modes.

C/C++ declaration

int GetIFShift(int hRadio);

Delphi declaration

function GetIFShift(hRadio: Integer): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

The effective offset of the IF filter in Hz.

See Also

SetIFShift

GetAudioSource

The GetAudioSource function returns the source the audio output is switched to.

C/C++ declaration

int GetAudioSource(int hRadio);

Delphi declaration

function GetAudioSource(hRadio: Integer): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

The audio source if successful, otherwise -1 is returned.

See SetAudioSource for the possible return values.

GetDSPSource

The GetDSPSource function returns the source the DSP input is switched to.

C/C++ declaration

int GetDSPSource(int hRadio);

Delphi declaration

function GetDSPSource(hRadio: Integer): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

The DSP input source if successful, otherwise -1 is returned. If a DSP is not fitted to the receiver, the function returns -1.

See SetDSPSource for the possible return values.

GetAGC

The GetAGC function returns current AGC value of radio device.

C/C++ declaration

DWORD GetAGC(int hRadio);

Delphi declaration

function GetAGC(hRadio: Integer): Longint;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

The current AGC value if successful, otherwise -1 is returned.

GetIFGain

Retrieves the IFGain value of the receiver. This function is valid only for receiver which supports IFGain (i.e. it has RIF_IFGAIN flag set in its RadioInfo.dwFeatures).

C/C++ declaration

int GetIFGain(int hRadio);

Delphi declaration

function GetIFGain(hRadio: Integer): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

If the function succeeds, the return value is the IFGain value. Otherwise -1 is returned.

dspOpen

The dspOpen function opens the DSP, loads boot code into its memory and executes it.

C/C++ declaration

BOOL dspOpen(int hRadio, void *lpBootCode, HWND hWindow);

Delphi declaration

function dspOpen(hRadio: Integer; lpBootCode: Pointer; hWindow: HWND): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

lpBootCode

Pointer to DSP boot code.

hWindow

Handle to the windows that will receive DSP messages.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

Remarks

The maximum size of boot code is 8kB / 3.
Following four executables are required to create bin file that can be used with dspOpen function:

ASM21 - ADSP 210X Assembler (compiler)
LD21 - ADSP 210X Linker
SPL21 - ADSP210X Splitter
BNM2HST - WiNRADiO utility that generates HST files

Bat file example:
--------------------------------------------------
asm21 MyCode -c -l
ld21 MyCode -a winradio -g -e MyCode -x
spl21 MyCode MyCode -bm -i -bs 1024
bnm2hst MyCode.bnm DirFind.hst

del *.cde
del *.int
del *.obj
del *.sym
--------------------------------------------------

dspClose

This function terminates DSP program execution.

C/C++ declaration

BOOL dspClose(int hRadio);

Delphi declaration

function dspClose(hRadio: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

dspSendByte

The dspSendByte function sends one byte to the DSP. This can be used only with custom DSP programs.

C/C++ declaration

BOOL dspSendByte(int hRadio, unsigned char bData);

Delphi declaration

function dspSendByte(hRadio: Integer; bData: Byte): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

bData

Byte to be send.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

dspReadByte

The dspReadByte function reads one byte from the DSP. This can be used only with custom DSP programs.

C/C++ declaration

BOOL dspReadByte(int hRadio, unsigned char *bData);

Delphi declaration

function dspReadByte(hRadio: Integer; var bData: Byte): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

bData

Variable that will receive the byte.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

dspOutWrite

The dspOutWrite function sends buffer to DSP output. This buffer contains audio data which are played, its size must be equal to DSPOutBlockSize.

C/C++ declaration

BOOL dspOutWrite(int hRadio, PDSPHdr lpDSPHeader, int cbDSPHeader);

Delphi declaration

function dspOutWrite(hRadio: Integer; lpDSPHeader: PDSPHdr; cbDSPHeader: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

lpDSPHeader

Pointer to TDSPHdr structure.

cbDSPHeader

Size of TDSPHdr structure.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

dspInAddBuffer

The dspInAddBuffer sends buffer to DSP input. This buffer is filled with audio data and then the pointer to DSPHdr is returned with message RM_DSPACKREAD as lParam. Buffer size must be equal to DSPInBlockSize.

C/C++ declaration

BOOL dspInAddBuffer(int hRadio, PDSPHdr lpDSPHeader, int cbDSPHeader);

Delphi declaration

function dspInAddBuffer(hRadio: Integer; lpDSPHeader: PDSPHdr; cbDSPHeader: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

lpDSPHeader

Pointer to TDSPHdr structure.

cbDSPHeader

Size of TDSPHdr structure.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

dspBufferDone

The dspBufferDone function informs API that the buffer was received. This must be called after each RM_DSPACKREAD and RM_DSPACKWRITE message. Else the API will keep sending the same buffer.

C/C++ declaration

BOOL dspBufferDone(int hRadio, PDSPHdr lpDSPHeader, int cbDSPHeader);

Delphi declaration

function dspBufferDone(hRadio: Integer; lpDSPHeader: PDSPHdr; cbDSPHeader: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

lpDSPHeader

Pointer to TDSPHdr structure.

cbDSPHeader

Size of TDSPHdr structure.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

dspPause

The dspPause function pauses playback and recording on the given radio device.

C/C++ declaration

BOOL dspPause(int hRadio);

Delphi declaration

function dspPause(hRadio: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

dspResume

The dspResume function resumes playback and recording od the given radio device.

C/C++ declaration

BOOL dspResume(int hRadio);

Delphi declaration

function dspResume(hRadio: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

dspInReset

The dspInReset function resets the DSP audio input.

C/C++ declaration

BOOL dspInReset(int hRadio);

Delphi declaration

function dspInReset(hRadio: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

dspOutReset

The dspOutReset function resets the DSP audio output.

C/C++ declaration

BOOL dspOutReset(int hRadio);

Delphi declaration

function dspOutReset(hRadio: Integer): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

dspInOpen

The dspInOpen function opens the DSP for audio input (recording).

C/C++ declaration

int dspInOpen(int hRadio, DWORD dwWaveFormat, HWND hWindow);

Delphi declaration

function dspInOpen(hRadio: Integer; dwWaveFormat: Longint; hWindow: HWND): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

dwWaveFormat

DSP input wave format. See RWF_ constants. This constants can be combined by using or operator, i.e. (RWF_11kHz or RWF_8bit or RWF_Mono).

hWindow

Handle to the windows that will receive DSP messages.

Return Value

Returns DSPInBlockSize if successful or zero otherwise.

dspOutOpen

The dspOutOpen function opens the DSP for audio output (playback).

C/C++ declaration

int dspOutOpen(int hRadio, DWORD dwWaveFormat, HWND hWindow);

Delphi declaration

function dspOutOpen(hRadio: Integer; dwWaveFormat: Longint; hWindow: HWND): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

dwWaveFormat

DSP input wave format. See RWF_ constants. This constants can be combined by using or operator, i.e. (RWF_11kHz or RWF_8bit or RWF_Mono).

hWindow

Handle to the windows that will receive DSP messages.

Return Value

Returns DSPOutBlockSize if successful or zero otherwise.

DSP notifications

Constant Value
RM_DSPREQ 0x7F00
RM_DSPACKWRITE 0x7F01
RM_DSPACKREAD 0x7F02
RM_DSPREQWRITE 0x7F03
RM_DSPREQREAD 0x7F04
RM_DSPPAUSED 0x7F05
RM_DSPRESUMED 0x7F06

Notification message types:

type



  TRMDSPReq = record

    Msg        : Cardinal;

    hRadio     : Cardinal;

    dwReqCode  : Longint;

    Result     : Longint;

  end;



  TRMDMAAckRead = record

    Msg       : Cardinal;

    hRadio    : Cardinal;

    lpDSPHdr  : PDSPHdr;

    Result    : Longint;

  end;



  TRMDMAAckWrite = TRMDMAAckRead;



  TRMDMAReqRead = record

    Msg       : Cardinal;

    hRadio    : Cardinal;

    dwLength  : Longint;

    Result    : Longint;

  end;



  TRMDMAReqWrite = TRMDMAReqRead;

GetModeString

The GetModeString function retrieves a text string describing a mode (and optionally bandwidth).

C/C++ declaration

LPSTR GetModeString(int hRadio, int iMode,

  LPSTR lpBuffer, int cbMaxLen);

Delphi declaration

function GetModeString(hRadio, iMode: Integer;

  lpBuffer: PChar; cbMaxLen: Integer): PChar;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice. To get a mode string without using a device handle, pass zero.

iMode

The mode and optional bandwidth to get the string for. See SetMode for valid values.

lpBuffer

Points to a buffer that will receive the mode string.

cbMaxLen

Specifies the maximum number of characters to copy to the buffer. The mode string is truncated if it is longer than the number of characters specified in cbMaxLen.

Return Value

Returns a pointer to lpBuffer if the function is successful. Otherwise, it is NULL.

EnableRadioNotification

The EnableRadioNotification function installs the passed window handle into the driver to be notified when a device is added or removed from the system.

C/C++ declaration

BOOL EnableRadioNotification(HWND hWindow, BOOL fEnabled);

Delphi declaration

function EnableRadioNotification(hWindow: HWND;

  fEnabled: Bool): Bool;

Parameters

hWindow

Handle to a window that will receive the notification messages.

fEnabled

Specifies whether to add the window to the notification list or to remove it. Pass TRUE to add the window to the list, FALSE to remove it.

Return Value

TRUE if the function is successful. Otherwise, it is FALSE.

Remarks

Two messages can be sent to the window:

RM_RADIOADDED (= 0x7f10) occurs when a PCMCIA WiNRADiO is inserted into a vacant PCMCIA slot in the computer.

RM_RADIOREMOVED (= 0x7f11) occurs when a PCMCIA WiNRADiO is removed from the PC or a Serial WiNRADiO is switched off or disconnected.

EnableAsyncMode

If the hWindow is not zero, the asynchronous mode is turned on for the selected receiver. If hWindow is zero, the asynchronous mode is turned off. In asynchronous mode, all WRAPI calls are returned immediately reporting the success. However, the WRAPI call is inserted to the queue and is executed in parallel thread. After it is physically executed, the notification message is sent to the parent window handle specified in hWindow parameter.

C/C++ declaration

BOOL EnableAsyncMode(int hRadio, HWND hWindow);

Delphi declaration

function EnableAsyncMode(hRadio: Integer; hWindow: HWND): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

hWindow

Handle to the windows that will receive WRAPI calls notifications.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

Remarks

This messages can be sent to the window:

Constant Value Description
RM_SLEVELNOTIFY 0x7F20

Signal level notification.

wParam = radio handle

LOWORD(lParam) = signal strength

HIWORD(lParam) = RAW signal strength

RM_CALLFAILED 0x7F21

Failure notification if the call failed.

wParam = radio handle

lParam = call type

RM_STATUS 0x7F22

wParam = radio handle

lParam = status information

Call type constants:

ctSLevel      = 0;

ctStatus      = 1;

ctFrequency   = 2;

ctMode        = 3;

ctVolume      = 4;

ctAtten       = 5;

ctMute        = 6;

ctPower       = 7;

ctBFOOffset   = 8;

ctIFShift     = 9;

ctAudioSource = 10;

ctDspSource   = 11;

ctAgc         = 12;

ctIfGain      = 13;

Radio status flags:

Constant Value Description
RS_SQUELCH 0x0001 High if the squelch is active.
RS_PLL 0x0004 High if PLL is locked.
RS_CONNECTION 0x0008 High if receiver is not connected to interface.
RS_VCC 0x0010 High if power is not connected to receiver.

OpenRadioCount

This function retrieves the number of open radio devices.

C/C++ declaration

int OpenRadioCount;

Delphi declaration

function OpenRadioCount: Integer;

Return Value

Number of opened radio devices.

GetDACValue

The GetDACValue function reads the hardware version from MCU.

C/C++ declaration

DWORD GetDACValue(int hRadio);

Delphi declaration

function GetDACValue(hRadio: Integer): Longint;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

Hardware version ID:

0 - 9 power failure!! Cannot identify
10 - 52 either a 1550 or a 3500 or 3700 depending on existance of down-convertor
53 - 99 3100
100 - 121 3000
122 - 152 1500

GetInterruptCount

The GetInterruptCount function retrieves from driver the number of IRQs used by WiNRADiO receivers.

C/C++ declaration

int GetInterruptCount(int hRadio);

Delphi declaration

function GetInterruptCount(hRadio: Integer): Integer;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Return Value

The current count of used IRQs if successful, otherwise -1 is returned.

GetDmaStatus

The GetDmaStatus function reads the status of DMA channels 0 and 3 from driver. This function is supported only under Windows NT, 2000 and XP.

C/C++ declaration

BOOL GetDmaStatus(int hRadio, long *Dma0Status, long *Dma3Status, BOOL ResetTiming);

Delphi declaration

function GetDmaStatus(hRadio: Integer; var Dma0Status, Dma3Status: Longint; ResetTiming: Bool): Bool;

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Dma0Status
Dma3Status

Values that will receive the DMA0 and DMA3 status.

ResetTiming

If true, the DMA channels timing values are reset.

Return Value

If the function succeeds, the return value is TRUE, else the return value is FALSE.

GetRadioInfoModeList

The GetRadioInfoModeList procedure retrieves information about supported modes and their bandwiths.

C/C++ declaration

void GetRadioInfoModeList(int hRadio, void *List, int Length);

Delphi declaration

procedure GetRadioInfoModeList(hRadio: Integer; List: Pointer; Length: Integer);

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

List

Pointer to memory block which will be filled with modes info.

Length

Size of memory allocated for List.

Return Value

If successful the memmory pointed by List contains list of supported modes. Each integer in the list is one mode.

Remarks

Before calling this procedure it is recommended to fill the memory with 0 so you can determine the last mode. Unfortunately this procedure doesn't returns the exect number of supported modes, this can by retrieved by calling GetRadioDeviceInfo.

Is16bitRadio

This procedure sets the Is16bitOwner flag which informs the API that the application is 16bit. This is used for pointer based messages.

C/C++ declaration

void Is16bitRadio(int hRadio);

Delphi declaration

procedure Is16bitRadio(hRadio: Integer);

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

LoadCalibrationData

The LoadCalibrationData prcedure loads calibration data from "wrcalib.ini". This is used for recalibrating the receiver without restarting the application. The calibration data are loader at startup too.

C/C++ declaration

void LoadCalibrationData(int hRadio);

Delphi declaration

procedure LoadCalibrationData(hRadio: Integer);

Parameters

hRadio

Handle to a radio device that was returned from OpenRadioDevice.

Antenna Distribution Unit functions

function AduInfo(iAdu: Integer; var lpInfo: TAduInfo): Bool;
function GetAduCount: Integer;
function AduQueryStatus(iAdu: Integer): Integer;
function AduSelectAntenna(iAdu, iReceiver, iAntenna: Integer): Bool;
function AduSetAntennaAtten(iAdu, iAntenna: Integer; fAtten: Bool): Bool;
function AduSetAntennaFilter(iAdu, iAntenna: Integer; fFilter: Bool): Bool;
function AduSetAntennaPreamp(iAdu, iAntenna: Integer; fPreamp: Bool): Bool;
function AduGetReceiverAntenna(iAdu, iReceiver: Integer): Integer;
function AduGetAntennaAtten(iAdu, iAntenna: Integer): Bool;
function AduGetAntennaFilter(iAdu, iAntenna: Integer): Bool;
function AduGetAntennaPreamp(iAdu, iAntenna: Integer): Bool;
function AduRefreshStatus(iAdu: Integer): Bool;
function AduStatusNotification(hWindow: HWND; fEnable: Bool): Bool;

ADU notifications:

Constant Value Description
RM_ADURECEIVER 0x7F80 A receiver has changed antenna connection.
RM_ADUANTENNA 0x7F81 An antennas configuration has changed.
RM_ADUFOUND 0x7F82 An ADU has been started/connected, info can be obtained.
RM_ADUREMOTE 0x7F83 An ADU has changed remote mode status.
RM_ADUCONNECT 0x7F84 An ADU has changed connection status.

ADU status flags:

Constant Value Description
AS_REMOTEMODE 0x0001 The ADU is in remote mode.
AS_CONNECTED 0x0002 The ADU is connected and operational.

ADU antenna status flags:

Constant Value
AAS_FILTER 0x0001
AAS_ATTEN 0x0002
AAS_PREAMP 0x0004