Jump to main content

# 1.2.8.4.3 SRV_RSERIAL_SerialGetPIB Function

## C

    uint8_t* SRV_RSERIAL_SerialGetPIB (
        DRV_RF215_TRX_ID trxId,
        DRV_RF215_PIB_ATTRIBUTE pibAttr,
        uint8_t pibSize,
        DRV_RF215_PIB_RESULT pibResult,
        uint8_t* pPibData,
        size_t* pMsgLen
    );

## Summary

Serializes a response to a get PIB command.

## Description

Takes the result of getting a PIB from RF215 driver as parameters and builds a serialized frame as response to the get PIB command.

## Precondition

None.

## Parameters

Param | Description
--- | ---
trxId | TRX identifier (Sub-1GHz, 2.4GHz).
pibAttr | PIB attribute.
pibSize | PIB size in bytes.
pibResult | PIB get result.
pPibData | Pointer to PIB data get from RF215 driver.
pMsgLen | Pointer to sniffer message length in bytes (output).

## Returns

Pointer to sniffer message to be sent through serial interface.

## Example

    uint8_t* pSerialData;
    size_t length;
    SRV_USI_HANDLE srvUSIHandle; // returned from SRV_USI_Open
    DRV_HANDLE rf215HandleRF09, rf215HandleRF24; // returned from DRV_RF215_Open
    DRV_HANDLE rf215Handle;
    SRV_RSERIAL_COMMAND command;
    DRV_RF215_TRX_ID trxId;
    DRV_RF215_PIB_ATTRIBUTE pibAttr;
    DRV_RF215_PIB_RESULT pibResult;
    uint8_t pibSize;
    uint8_t rfDataPIBBuffer[sizeof(DRV_RF215_PHY_CFG_OBJ)];

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

    if (command == SRV_RSERIAL_CMD_PHY_GET_CFG)
    {
        SRV_RSERIAL_ParsePIB(pData, &trxId, &pibAttr, &pibSize);

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

        // Get PIB from RF215 Driver
        pibResult = DRV_RF215_GetPib(rf215Handle, pibAttr, rfDataPIBBuffer);
        pibSize = DRV_RF215_GetPibSize(pibAttr);

        // Serialize PIB get response and send through USI
        pSerialData = SRV_RSERIAL_SerialGetPIB(trxId, pibAttr, pibSize,
                pibResult, rfDataPIBBuffer, &length);
        SRV_USI_Send_Message(srvUSIHandle, SRV_USI_PROT_ID_PHY_RF215,
                pSerialData, length);
    }

## Remarks

None.

Rev: G