Jump to main content

# 1.2.2.4.2 SRV_PSNIFFER_SerialRxMessage Function

## C

    size_t SRV_PSNIFFER_SerialRxMessage
    (
        uint8_t* pDataDst,
        DRV_PLC_PHY_RECEPTION_OBJ* pDataSrc
    );

## Summary

Serializes a received PLC frame along with its parameters.

## Description

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

## Precondition

SRV_PSNIFFER_SetRxPayloadSymbols has to be called before to set the correct number of received symbols in Sniffer library.

## Parameters

Param | Description
--- | ---
pDataDst | Pointer to buffer where frame is serialized.
pDataSrc | Pointer to PLC Reception object containing the frame and parameters (see G3 DRV_PLC_PHY_RECEPTION_OBJ Struct and PRIME DRV_PLC_PHY_RECEPTION_OBJ Struct).

## Returns

Number of bytes for serialized output.

## Example

    static void APP_PLCDataIndCb(DRV_PLC_PHY_RECEPTION_OBJ *indObj, uintptr_t context)
    {
        /* Report RX Symbols */
        appData.plcPIB.id = PLC_ID_RX_PAY_SYMBOLS;
        appData.plcPIB.length = 2;
        DRV_PLC_PHY_PIBGet(appData.drvPl360Handle, &appData.plcPIB);

        SRV_PSNIFFER_SetRxPayloadSymbols(*(uint16_t *)appData.plcPIB.pData);

        /* Serialize received message */
        length = SRV_PSNIFFER_SerialRxMessage(appData.pSerialData, indObj);
        /* Send through USI */
        SRV_USI_Send_Message(appData.srvUSIHandle, SRV_USI_PROT_ID_SNIFF_G3,
                appData.pSerialData, length);
    }

## Remarks

None.

Rev: G