コード例 #1
0
ファイル: monAntennaTest.c プロジェクト: mbaglin/legato-af
/*
 * Antenna state handler: after NB_CHANGING_STATE_BEFORE_RELEASING changing state, the handler is
 * released
 *
 */
static void AntennaHandler
(
    le_antenna_ObjRef_t antennaRef,
    le_antenna_Status_t status,
    void* contextPtr
)
{
    le_antenna_Type_t antennaType;
    le_result_t result = le_antenna_GetType( antennaRef, &antennaType );
    LE_ASSERT(result == LE_OK);
    LE_ASSERT(antennaType < LE_ANTENNA_MAX);

    AntennaCtxtText[antennaType].count++;

    /*
     * If the changing state thresholds is reached, remove the handler, and release the antenna
     * diagnotics
     */
    if (AntennaCtxtText[antennaType].count == NB_CHANGING_STATE_BEFORE_RELEASING)
    {
        LE_INFO("Remove the handler");
        le_antenna_RemoveStatusEventHandler(AntennaCtxtText[antennaType].handlerRef);
    }
    else
    {
        LE_INFO("Antenna %d status %d", antennaType, status);
    }
}
コード例 #2
0
//--------------------------------------------------------------------------------------------------
static void AntennaHandler
(
    le_antenna_ObjRef_t antennaRef,
    le_antenna_Status_t status,
    void* contextPtr
)
{
    char statusStr[MAX_STRING_LEN],typeStr[MAX_STRING_LEN];
    le_antenna_Type_t antennaType;
    le_result_t result = le_antenna_GetType( antennaRef, &antennaType );

    LE_ASSERT(result == LE_OK);
    LE_ASSERT(antennaType < LE_ANTENNA_MAX);

    AntennaCtxtText[antennaType].count++;

    /*
     * If the changing state thresholds is reached, remove the handler, and release the antenna
     * diagnotics
     */

    ConvertAntennaType(typeStr, MAX_STRING_LEN, antennaType);
    ConvertAntennaStatus(statusStr, MAX_STRING_LEN, status);

    LE_INFO("Antenna %s status %s", typeStr, statusStr);

    if (AntennaCtxtText[antennaType].count == NB_CHANGING_STATE_BEFORE_RELEASING)
    {
        LE_INFO("Remove the handler");
        le_antenna_RemoveStatusEventHandler(AntennaCtxtText[antennaType].handlerRef);
        LE_INFO("======== Antenna diagnostic event handler Test finished for %s ========",
            typeStr);
     }
}