1.2.8.4.4 SRV_RSERIAL_SerialSetPIB Function

C

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

Summary

Serializes a response to a set PIB command.

Description

Takes the result of setting a PIB in RF215 driver as parameters and builds a serialized frame as response to the set PIB command.

Precondition

None.

Parameters

ParamDescription
trxIdTRX identifier (Sub-1GHz, 2.4GHz)
pibAttrPIB attribute
pibSizePIB size in bytes
pibResultPIB get result
pMsgLenPointer 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;

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

if (command == SRV_RSERIAL_CMD_PHY_SET_CFG)
{
    uint8_t *pPibValue;

    pPibValue = SRV_RSERIAL_ParsePIB(pData, &trxId, &pibAttr, &pibSize);

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

    // Set PIB to RF215 driver
    pibResult = DRV_RF215_SetPib(rf215Handle, pibAttr, pPibValue);
    pibSize = DRV_RF215_GetPibSize(pibAttr);

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

Remarks

None.