Jump to main content

# 1.2.8.4.7 SRV_RSERIAL_SetTxHandle Function

## C

    void SRV_RSERIAL_SetTxHandle(DRV_RF215_TX_HANDLE txHandle);

## Summary

Sets the TX handle for the last TX request.

## Description

Sets the TX handle returned from DRV_RF215_TxRequest for the last TX request.

## Precondition

DRV_RF215_TxRequest must have been called to obtain a valid TX handle.

## Parameters

Param | Description
--- | ---
txHandle | TX handle returned from DRV_RF215_TxRequest.

## Returns

None.

## 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