Jump to main content

# 1.2.7.4.2 SRV_RSNIFFER_SerialRxMessage Function

## C

    uint8_t* SRV_RSNIFFER_SerialRxMessage (
        DRV_RF215_RX_INDICATION_OBJ* pIndObj,
        DRV_RF215_PHY_CFG_OBJ* pPhyCfgObj,
        uint16_t paySymbols,
        uint16_t channel,
        size_t* pMsgLen
    );

## Summary

Serializes a received RF frame along with its parameters.

## Description

This function takes an object containing a RF frame and its related parameters and serializes it in a buffer for further transmission through serial interface.

## Precondition

None.

## Parameters

Param | Description
--- | ---
pIndObj | Pointer to RF reception object containing the frame and parameters.
pPhyCfgObj | Pointer to RF PHY configuration object.
paySymbols | Number of payload symbols in the received frame.
channel | RF channel used to receive the message. It is only available for PRIME protocol.
pMsgLen | Pointer to sniffer message length in bytes (output).

## Returns

Pointer to sniffer message to be sent through serial interface.

## Example

    DRV_HANDLE drvRf215Handle; // returned from DRV_RF215_Open
    SRV_USI_HANDLE srvUSIHandle; // returned from SRV_USI_Open

    static void _APP_RfRxIndCb(DRV_RF215_RX_INDICATION_OBJ* ind, uintptr_t ctxt)
    {
        DRV_RF215_PHY_CFG_OBJ rfPhyConfig;
        uint8_t* pRfSnifferData;
        size_t rfSnifferDataSize;
        uint16_t rfPayloadSymbols;
        uint16_t rfChannel;

        // Get payload symbols in the received message
        DRV_RF215_GetPib(drvRf215Handle, RF215_PIB_PHY_RX_PAY_SYMBOLS,
                &rfPayloadSymbols);

        // Get RF PHY configuration
        DRV_RF215_GetPib(drvRf215Handle, RF215_PIB_PHY_CONFIG, &rfPhyConfig);
        DRV_RF215_GetPib(drvRf215Handle, RF215_PIB_PHY_CHANNEL_NUM, &rfChannel);

        // Serialize received RF message
        pRfSnifferData = SRV_RSNIFFER_SerialRxMessage(ind, &rfPhyConfig,
                rfPayloadSymbols, rfChannel, &rfSnifferDataSize);

        // Send through USI
        SRV_USI_Send_Message(srvUSIHandle, SRV_USI_PROT_ID_SNIF_PRIME,
                pRfSnifferData, rfSnifferDataSize);
    }

## Remarks

None.

Rev: G