Platform/ECM3532/M3/framework/sensor_mgr/src/sensor.c
/**
 * Register sensor driver to SM
 *
 * @param Name Sensor driver name
 *
 * @return tSensorDevice valid sensor handle on success,
 *          negative error code on failure.
 */
Register sensor driver to SM
@param Name Sensor driver name

@return tSensorDevice valid sensor handle on success,
negative error code on failure.
Register sensor driver to SM @param Name Sensor driver name @return tSensorDevice valid sensor handle on success negative error code on failure .
tSDrvHandle SalSensorOpen(char* SensorName)
{
    tSensorDevice *sDev = NULL;
    uint8_t ui8Sidx, ui8Didx = 0;
    tSDrvHandle sHandle = INVALID_HANDLE;
    for(ui8Sidx = 0; ui8Sidx < SENSOR_MAX_CNT; ui8Sidx++)
    {
        if(!strcmp(sSensorDevList[ui8Sidx].name, SensorName))
        {
            sDev =  &sSensorDevList[ui8Sidx];
            break;
        }
    }
    if (sDev && (sDev->iProbeSt == ProbeSuccess))
    {
        xSemaphoreTake(SmLock, portMAX_DELAY);
        for(ui8Didx = 0; ui8Didx < DRIVER_MAX_CNT; ui8Didx++)
        {
            if (sHandleMapList[ui8Didx].vDrvHandle == INVALID_HANDLE)
                break;
        }
        if (ui8Didx < DRIVER_MAX_CNT)
        {
            sHandle = sDev->sDops->DrvOpen(SensorName);
            if (sHandle >= 0)
            {
                sHandleMapList[ui8Didx].vDrvHandle = sHandle;
                sHandleMapList[ui8Didx].ui8SensorDevIndex = ui8Sidx;
                sHandle = ui8Didx;
            }
            else
            {
                sHandle = INVALID_HANDLE;
            }
        }
        xSemaphoreGive(SmLock);
    }
    return sHandle;
}
tSDrvHandle SalSensorOpen ( char * SensorName ) { tSensorDevice * sDev = NULL ; uint8_t ui8Sidx , ui8Didx = 0 ; tSDrvHandle sHandle = INVALID_HANDLE ; for ( ui8Sidx = 0 ; ui8Sidx < SENSOR_MAX_CNT ; ui8Sidx ++ ) { if ( ! strcmp ( sSensorDevList [ ui8Sidx ] . name , SensorName ) ) { sDev = & sSensorDevList [ ui8Sidx ] ; break ; } } if ( sDev && ( sDev -> iProbeSt == ProbeSuccess ) ) { xSemaphoreTake ( SmLock , portMAX_DELAY ) ; for ( ui8Didx = 0 ; ui8Didx < DRIVER_MAX_CNT ; ui8Didx ++ ) { if ( sHandleMapList [ ui8Didx ] . vDrvHandle == INVALID_HANDLE ) break ; } if ( ui8Didx < DRIVER_MAX_CNT ) { sHandle = sDev -> sDops -> DrvOpen ( SensorName ) ; if ( sHandle >= 0 ) { sHandleMapList [ ui8Didx ] . vDrvHandle = sHandle ; sHandleMapList [ ui8Didx ] . ui8SensorDevIndex = ui8Sidx ; sHandle = ui8Didx ; } else { sHandle = INVALID_HANDLE ; } } xSemaphoreGive ( SmLock ) ; } return sHandle ; }
Register sensor driver to SM
 @param Name Sensor driver name
Register sensor driver to SM @param Name Sensor driver name