Jump to main content

# 1.2.8.4.6 SRV_RSERIAL_ParseTxMessage Function

## C

    bool SRV_RSERIAL_ParseTxMessage (
        uint8_t* pDataSrc,
        DRV_RF215_TX_REQUEST_OBJ* pDataDst,
        DRV_RF215_TX_HANDLE* pTxHandleCancel
    );

## Summary

Extracts a RF frame to be transmitted from SRV_RSERIAL_CMD_PHY_SEND_MSG serial frame.

## Description

Takes a SRV_RSERIAL_CMD_PHY_SEND_MSG serial frame as parameter, extracts the RF frame and its related transmission information and fills a DRV_RF215_TX_REQUEST_OBJ object.

## Precondition

None.

## Parameters

Param | Description
--- | ---
pDataSrc | Pointer to buffer containing serial frame.
pDataDst | Pointer to a DRV_RF215_TX_REQUEST_OBJ object to fill (output).
pTxHandleCancel | Pointer to TX handle to cancel (output).

## Returns

Boolean indicating if it is a TX cancel request.

## Example

    SRV_RSERIAL_COMMAND command;
    DRV_RF215_TRX_ID trxId;
    DRV_HANDLE rf215HandleRF09, rf215HandleRF24; // returned from DRV_RF215_Open
    DRV_HANDLE rf215Handle;
    DRV_RF215_TX_REQUEST_OBJ txReq;
    DRV_RF215_TX_HANDLE txHandle;
    bool txCancel;

    // Process received message from USI
    command = SRV_RSERIAL_GetCommand(pData);

    if (command == SRV_RSERIAL_CMD_PHY_SEND_MSG)
    {
        // Parse TRX identifier from USI
        trxId = SRV_RSERIAL_ParseTxMessageTrxId(pData);

        if (trxId == RF215_TRX_ID_RF09)
        {
            rf215Handle = rf215HandleRF09;
        }
        else
        {
            rf215Handle = rf215HandleRF24;
        }

        // Parse TX request data from USI
        txCancel = SRV_RSERIAL_ParseTxMessage(pData, &txReq, &txHandle);

        if (txCancel == false)
        {
            DRV_RF215_TX_RESULT txResult;

            // Send Message through RF
            txHandle = DRV_RF215_TxRequest(rf215Handle, &txReq, &txResult);
            SRV_RSERIAL_SetTxHandle(txHandle);
        }
        else
        {
            // Cancel TX request
            DRV_RF215_TxCancel(rf215Handle, txHandle);
        }
    }

## Remarks

None.

Rev: G