HPSDREncode Class Reference


Overview


HPSDREncode is used by the Metis object to create the headers of the HPSDR Frame format. You will usually not need to interface directly with HPSDREncode. The HPSDREncode API is included here for reference only.

When called with -controlBytes, HPSDREncode returns the next sequence of five control bytes in a round robin fashion. To minimize receive/transmit turn around, HPSDREncode will return the set of control bytes that include the MOX bit when it receives a -controlBytesWithPTT message that has a different PTT state from the existing state, otherwise, it behaves as if -controlBytes was received.


Tasks


Creating an HPSDREncode object

- initWithMetis:type:


Obtaining HPSDR Frame Control Bytes

- controlBytes
-
controlBytesWithPTT:


Sampling Rates

- setkHzSamplingRate:
-
kHzSamplingRate


Radio Parameters

- setNumberOfReceivers:
-
numberOfReceiver:
-
radio:usePreamp:
-
radio:enableHermesAttenuator:
- radio:setHermesInputAttenuator:
-
radio:enableADCDither:
-
radio:useRandomDither:


Frequency Parameters

- receiver:setFrequency:
-
frequencyForReceiver:
-
useDuplex:
-
useCommonMercuryFrequency:


Exciter (Hermes)

- setMOX
-
setDriveLevel:


Transmit PA and Tuner (Apollo)

-
enableApolloFilter:
-
selectApolloFilter:
-
enableApolloTuner:
-
startApolloTuner
-
stopApolloTuner


Transmit Filters (Alex)

-
selectAlexAttenuator:
-
selectAlexRxAntenna:
-
enableAlexRxOutput:
-
selectAlexTxRelay:
-
disableAlexT_RRelay:
-
selectAlexFilterManually:
-
bypassAlexHPF:
-
alexHPF:enable:
-
alexLPF:enable:
-
useLNAOnAlex:


Analog I/O

- useLineIn:
-
setLineInGain:
-
enableMicBoost:


Digital I/O

- openCollectorBit:setState:
-
DB9OutputPin:setState:


Control Sequence

- numberOfActiveFrames


Others

- enableVNAMode:
-
useTimeStamp:
-
useClassEModulation:


Instance Methods


alexHPF:enable:

Switch in an Alex (RF Filter) HPF. Filter is one of kAlexHPF1500kHz (0x10), kAlexHPF6500kHz (0x8), kAlexHPF9500kHz (0x4), kAlexHPF13000kHz (0x1) or kAlexHPF20000kHz (0x2).

- (HPSDRFrameHeader*)alexHPF:(AlexHPF)filter enable:(Boolean)enable

Parameters

filter
0x1, 0x2, 0x4, 0x8 or 0x10,

enable
true to switch in HPF.

Return Value

The HPSDRFrameHeader that contains the Alex HPF.




alexLPF:enable:

Switch in an Alex (RF Filter) LPF. Filter is one of kAlexLPF6m (0x10), kAlexLPF10m (0x20), kAlexLPF15m (0x40), kAlexLPF20m (0x1), kAlexLPF40m (0x2), kAlexLPF80m (0x4) or kAlexLPF160m (0x8).

- (HPSDRFrameHeader*)alexLPF:(AlexLPF)filter enable:(Boolean)enable

Parameters

filter
0x1, 0x2, 0x4, 0x8 or 0x10, 0x20 or 0x40,

enable
true to switch in LPF.

Return Value

The HPSDRFrameHeader that contains the Alex LPF.




bypassAlexHPF:

Bypass all HPF in Alex (RF Filter).

- (HPSDRFrameHeader*)bypassAlexHPF:(Boolean)bypass

Parameters

bypass
true to bypass all HPF.

Return Value

The HPSDRFrameHeader that contains the Alex HPF bypass bit.




controlBytes

Returns the next sequence of header bytes for a HPSDR Frame that include the three (0xff) sync bytes and five control bytes.

- (const unsigned char*)controlBytes

Return Value

An array of 8 bytes for an HPSDR Frame header.




controlBytesWithPTT:

If the PTT state has changed from the existing PTT state, -controlBytesWithPTT returns the header bytes for a HPSDR Frame that include the three (0xff) sync bytes and five control bytes and the MOX bit. If PTT has not changed, the behavior is the same as that for -controlBytes (see above).

- (const unsigned char*)controlBytesWithPTT:(Boolean)ptt

Parameters

ptt
PTT state for this HPSDR Frame.

Return Value

An array of 8 bytes for an HPSDR Frame header.




DB9OutputPin:setState:

Set state of DB9 open drain output pins 1,2 (enable=ON) and 3.3v TTL output pins 3,4 (enable =ON).

- (HPSDRFrameHeader*)DB9OutputPin:(unsigned int)pin setState:(Boolean)enable

Parameters

pin
pin 1, 2, 3 or 4,

enable
state of open collector bit.

Return Value

The HPSDRFrameHeader that contains the DB9 pins.




disableAlexT_RRelay:

Disable Alex T/R relay.

- (HPSDRFrameHeader*)disableAlexT_RRelay:(Boolean)disable

Parameters

disable
true to disable.

Return Value

The HPSDRFrameHeader that contains the Alex T/R relay.




enableAlexRxOutput:

Enable Alex Rx antenna out.

- (HPSDRFrameHeader*)enableAlexRxOutput:(Boolean)enable

Parameters

enable
true to enable.

Return Value

The HPSDRFrameHeader that contains the Alex Rx output enable.




enableApolloFilter:

Enable Apollo (15W Power Amplifier) filter.

- (HPSDRFrameHeader*)enableApolloFilter:(Boolean)filter

Parameters

filter
true, to turn on Apollo filters.

Return Value

The HPSDRFrameHeader that contains the Apollo filter enable bit.




enableApolloTuner:

Enable Tuner in Apollo (15W Power Amplifier).

- (HPSDRFrameHeader*)enableApolloTuner:(Boolean)tuner

Parameters

tuner
true, to turn on Apollo tuner.

Return Value

The HPSDRFrameHeader that contains the Apollo tuner enable.




enableMicBoost:

Enable 20 dB microphone preamp.

- (HPSDRFrameHeader*)enableMicBoost:(Boolean)boost

Parameters

boost
true, to turn on 20 dB microphone preamp.

Return Value

The HPSDRFrameHeader that contains the microphone boost bit.




enableVNAMode:

Enable VNA Mode.

- (HPSDRFrameHeader*)enableVNAMode:(Boolean)enable

Parameters

enable
true, to to enable VNA Mode.

Return Value

The HPSDRFrameHeader that contains the VNA mode bit.




frequencyForReceiver:

Returns the frequency in MHz for the specified receiver. Receiver 0 is used to indicate the transmit frequency.

- (double)frequencyForReceiver:(unsigned int)receiver

Parameters

receiver
index of the receiver.

Return Value

The frequency in MHz.




initWithMetis:type:

Initializes a HPSDR Format encoder. The input Metis object is only used to identify the Metis object that is issuing the delegate callbacks, it is not otherwise used by HPSDREncode.

- (id)initWithMetis:(Metis*)metis type:(MetisType)metisType

Parameters

metis
a Metis object,

Return Value

An initialized HPSDRDecode object.




kHzSamplingRate

Returns the sampling rate in kHz.

- (int)kHzSamplingRate

Return Value

Sampling Rate.




numberOfActiveFrames

Returns the number of different active header sequences.

- (int)numberOfActiveFrames

Return Value

Active header frames.




numberOfReceivers


Returns the number of active receivers. This determines the number of receiver streams that are interleaved into metisData.

- (int)numberOfReceivers

Return Value

The number of active receivers.




openCollectorBit:setState:

Set state of open collector output bits 0...6.

- (HPSDRFrameHeader*)openCollectorBit:(unsigned int)bit setState:(Boolean)enable

Parameters

bit
bit 0 through 6,

enable
state of open collector bit.

Return Value

The HPSDRFrameHeader that contains the open collector bits.




radio:enableHermesAttenuator:

Turns the attenuators on or off. This must be disabled for Hermes to use its preamp.

- (HPSDRFrameHeader)radio:(unsigned int)radio enableHermesAttenuator:(Boolean)attenuatorOn

Parameters

radio
the index of the radio (base 1),

attenuatorOn
true, to turn attenuators on.

Return Value

The HPSDRFrameHeader that contains the attenuator enable bits.




radio:setHermesAttenuator:

Sets the Hermes attenuator (0 to 31 dB).

- (void)radio:(unsigned int)radio setHermesAttenuator:(unsigned int)attenuation

Parameters

radio
the index of the radio (base 1),

attenuation
attenuation in 1 dB steps.




radio:usePreamp:

Turns the preamp of a radio on or off. (see radio:enableAttenuator:)

- (HPSDRFrameHeader*)radio:(unsigned int)radio usePreamp:(Boolean)preampOn

Parameters

radio
the index of the radio (base 1),

preampOn
true, to turn preamp on.

Return Value

The HPSDRFrameHeader that contains the preamp setting.




receiver:setFrequency:

Sets the frequency for the specified receiver. Receiver 0 is used to indicate the transmit frequency.

- (HPSDRFrameHeader*)receiver:(unsigned int)receiver setFrequency:(double)frequency

Parameters

receiver
the index of the receiver,

frequency
frequency in MHz.

Return Value

The HPSDRFrameHeader that contains the receiver frequency.




selectAlexAttenuator:

Select attenuator on Alex (RF filter). attenuation is kAlexAttenuation0dB (0), kAlexAttenuation10dB (1), kAlexAttenuation20dB (2) or kAlexAttenuation30dB (3).

- (HPSDRFrameHeader*)selectAlexAttenuator:(AlexAttenuator)attenuation

Parameters

attenuation
amount of attenuation (0, 10 dB, 20 dB or 30 dB).

Return Value

The HPSDRFrameHeader that contains the Alex attenuation selection bits.




selectAlexFilterManually:

Manually select HPF/LPF in Alex (RF Filter).

- (HPSDRFrameHeader*)selectAlexFilterManually:(Boolean)enable

Parameters

enable
true to select manually.

Return Value

The HPSDRFrameHeader that contains the Alex manual filter select enable.




selectAlexRxAntenna:

Select attenuator on Alex (RF filter). antenna is kAlexRxAntennaNone (0), kAlexRxAntenna1 (1), kAlexRxAntenna2 (2) or kAlexRxAntennaXVTR (3).

- (HPSDRFrameHeader*)selectAlexRxAntenna:(AlexRxAntenna)antenna

Parameters

antenna
antenna selection (0, 1, 2 or 3).

Return Value

The HPSDRFrameHeader that contains the Alex Rx selection.




selectAlexTxRelay:

Select Alex transmit relay. antenna is kAlexTxRelay1 (0), kAlexTxRelay2 (1), kAlexTxRelay3 (2).

- (HPSDRFrameHeader*)selectAlexTxRelay:(AlexTxRelay)relay

Parameters

relay
antenna selection (0, 1, 2).

Return Value

The HPSDRFrameHeader that contains the Alex Tx relays.




selectApolloFilter:

Select filter on Apollo (15W Power Amplifier) if true, filters on Alex (RF Filters) if false.

- (HPSDRFrameHeader*)selectApolloFilter:(Boolean)apollo

Parameters

apollo
use filters on Apollo if true, filters on Alex if false.

Return Value

The HPSDRFrameHeader that contains the Apollo filter enable bit.




setkHzSamplingRate:

Sets the sampling rate in kHz. samplingRate must be 48, 96, 192 or 384.

- (HPSDRFrameHeader*)setkHzSamplingRate:(unsigned int)samplingRate

Parameters

samplingRate
sampling rate in kHz.

Return Value

The HPSDRFrameHeader that contains the sampling rate field.




setDriveLevel:

Set the Hermes/Pennylane drive level (0-255).

- (HPSDRFrameHeader*)setDriveLevel:(unsigned int)drive

Parameters

driveLevel
drive level, between 0 and 255.

Return Value

The HPSDRFrameHeader that contains the Hermes drive level.




setLineInGain:

Set the line input gain (0-31).

- (HPSDRFrameHeader*)setLineInGain:(unsigned int)gain

Parameters

gain
gain between 0 and 31.

Return Value

The HPSDRFrameHeader that contains the line in gain.




setNumberOfReceivers:

Sets the number of active receivers. This determines the number of receiver streams that are interleaved into metisData.

- (HPSDRFrameHeader*)setNumberOfReceivers:(unsigned int)receivers

Parameters

receivers
the number of active receivers.

Return Value

The HPSDRFrameHeader that contains the number of receivers.




startApolloTuner

Start tuner on Apollo (15W PA).

- (HPSDRFrameHeader*)startApolloTuner

Return Value

The HPSDRFrameHeader that contains the Apollo tuner start/stop bit.




stopApolloTuner

Stop tuner on Apollo (15W PA).

- (HPSDRFrameHeader*)stopApolloTuner

Return Value

The HPSDRFrameHeader that contains the Apollo tuner start/stop bit.




useClassEModulation:

Enable for Class E modulation. Disable for all other modes.

- (HPSDRFrameHeader*)useClassEModulation:(Boolean)enable

Parameters

enable
true, to turn on Class E modulation

Return Value

The HPSDRFrameHeader that contains the Class E modulator enable.




useCommonMercuryFrequency:

Use the same frequency for all Mercury boards.

- (HPSDRFrameHeader*)useCommonMercuryFrequency:(Boolean)common

Parameters

common
true, if all Mercury boards shares the same frequency

Return Value

The HPSDRFrameHeader that contains the bit to use a common frequency for all Mercury boards.




useDuplex:

When duplex mode is not set, receiver 1 takes its NCO frequency from the transmit NCO. When duplex is set, receiver 1 and transmitter have independent frequencies.

- (HPSDRFrameHeader*)useDuplex:(Boolean)duplex

Parameters

duplex
set to true to use independent transmit and receiver 1 frequency.

Return Value

The HPSDRFrameHeader that contains the Duplex enable bit.




useLineIn:

Select between line input and microphone input.

- (HPSDRFrameHeader*)useLineIn:(Boolean)lineInput

Parameters

lineInput
true, to use line input, false to use microphone input.

Return Value

The HPSDRFrameHeader that contains the microphone/line-in selection.




useLNAOnAlex:

Use LNA on Alex (RF Filter).

- (HPSDRFrameHeader*)useLNAOnAlex:(Boolean)enable

Parameters

enable
true, to use LNA on Alex.

Return Value

The HPSDRFrameHeader that contains the Alex LNA enable.




useTimeStamp:

Turns on 1 pulse per second on least significant bit of microphone channel.

- (HPSDRFrameHeader*)useTimeStamp:(Boolean)enable

Parameters

enable
true, to turn on time stamp pulse.

Return Value

The HPSDRFrameHeader that contains the Time Stamp selector.