(Page 55 of 80 in this chapter)


adiStartReceivingFSK

Description

Receives Frequency Shift Key (FSK) data.

Prototype

DWORD adiStartReceivingFSK(CTAHD ctahd,
void *buffer,
unsigned bufsize,
ADI_FSKRECEIVE_PARMS *parms)

ctahd Context handle returned by adiOpenPort.

buffer Pointer to buffer to hold received data.

bufsize Size of buffer to receive.

parms Pointer to the FSK receive parameters, stored in the following structure (NULL designates default values):

typedef struct
{
DWORD size; /* Size of this structure */
INT32 minlevel; /* Required minimum receive level (dB) */
DWORD minmark; /* Minimum required initial mark and seizure*/
DWORD droptime;
/* Minimum dropout to silence before a packet */
/* is considered terminated (ms) */
DWORD baudrate; /* Baud rate (only 1200 supported) */
} ADI_FSKRECEIVE_PARMS;

Return Values

Events

DSP File Requirement

This function requires that adsir.dsp has been loaded by agmon.

Details

This function receives Frequency Shift Key (FSK) data. The function may be stopped using adiStopReceivingFSK. When the function completes, the ADIEVN_FSK_RECEIVE_DONE event is generated.

If the event value field contains CTA_REASON_FINISHED or CTA_REASON_STOPPED, the size field of the event structure contains the number of bytes received. The received buffer is in the buffer field. If errors occur, the receive operation is terminated and the event value field contains either ADI_REASON_DROP_IN_DATA or ADI_REASON_BAD_STOP_BIT.

See Also

adiStopReceivingFSK

Example


#define MYRECEIVE_FAILURE (-11)
#define MYRECEIVE_STOPPED (-12)

int myReceiveFSK( CTAHD ctahd )
{
    ADI_EVENT event;
    char buffer [512];

    if( adiStartReceivingFSK( ctahd, buffer, sizeof buffer, NULL) != SUCCESS )
        return MYFAILURE;

    do 
    {
        myGetEvent( &event );           /* see adiFetchAndProcess example */
    } while( event.id != ADIEVN_FSK_RECEIVE_DONE );

    switch( event.value )
    {
        case CTA_REASON_FINISHED:
            return SUCCESS;

        case CTA_REASON_RELEASED:
            return MYDISCONNECT;

        case CTA_REASON_STOPPED:
            /* Receive was stopped by another application thread */
            return MYRECEIVE_STOPPED;

        case ADI_REASON_DROP_IN_DATA:
        case ADI_REASON_BAD_STOP_BIT:
            return MYRECEIVE_FAILURE;

        default:
            if( IS_ADI_ERROR( event.value ) )
                return MYFAILURE;
    }
    return MYFAILURE;
}


(Page 55 of 80 in this chapter)


Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights reserved.