当前位置: 首页>>代码示例>>Java>>正文


Java Sensor类代码示例

本文整理汇总了Java中com.sonyericsson.extras.liveware.aef.sensor.Sensor的典型用法代码示例。如果您正苦于以下问题:Java Sensor类的具体用法?Java Sensor怎么用?Java Sensor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Sensor类属于com.sonyericsson.extras.liveware.aef.sensor包,在下文中一共展示了Sensor类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: register

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Checks if the sensor currently being used supports interrupt mode and
 * registers an interrupt listener if it does. If not, a fixed rate listener
 * will be registered instead.
 */
private void register() {
    AccessorySensor sensor = getCurrentSensor();
    if (sensor != null) {
        try {
            AccelerometerEventListener listener = new AccelerometerEventListener();
            if (sensor.isInterruptModeSupported()) {
                sensor.registerInterruptListener(listener);
            } else {
                sensor.registerFixedRateListener(listener, Sensor.SensorRates.SENSOR_DELAY_UI);
            }
        } catch (AccessorySensorException e) {
            if (BuildConfig.DEBUG) {
                Log.e(SWConstants.LOG_TAG, "Failed to register listener", e);
            }
        }
    }
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:23,代码来源:SWControlExtension.java

示例2: registerInterruptListener

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Register a sensor event listener that gets new data when the sensor has
 * new data. It is only possible to have one listener per sensor.
 *
 * @param listener The event listener.
 */
public void registerInterruptListener(final AccessorySensorEventListener listener)
        throws AccessorySensorException {

    if (!mIsInterruptModeSupported) {
        throw new IllegalStateException("Interrupt mode not supported");
    }

    // Rate is ignored in interrupt mode.
    registerListener(listener, Sensor.SensorRates.SENSOR_DELAY_NORMAL,
            Sensor.SensorInterruptMode.SENSOR_INTERRUPT_ENABLED);
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:18,代码来源:AccessorySensor.java

示例3: sendSensorStartListeningIntent

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Send start listening intent to host application
 *
 * @see Sensor.Intents#SENSOR_REGISTER_LISTENER_INTENT
 */
private void sendSensorStartListeningIntent() {
    Intent i = new Intent(Sensor.Intents.SENSOR_REGISTER_LISTENER_INTENT);
    i.putExtra(Sensor.Intents.EXTRA_SENSOR_ID, mSensorId);
    i.putExtra(Sensor.Intents.EXTRA_SENSOR_LOCAL_SERVER_SOCKET_NAME, mSocketName);
    i.putExtra(Sensor.Intents.EXTRA_SENSOR_REQUESTED_RATE, mSensorRate);
    i.putExtra(Sensor.Intents.EXTRA_SENSOR_INTERRUPT_MODE, mInterruptMode);
    sendToHostApp(i);
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:14,代码来源:AccessorySensor.java

示例4: LoggerControl

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Create sample sensor control.
 *
 * @param hostAppPackageName Package name of host application.
 * @param context            The context.
 */
LoggerControl( final String hostAppPackageName, final Context context ) {
    super( context, hostAppPackageName );

    AccessorySensorManager manager = new AccessorySensorManager( context, hostAppPackageName );
    mSensor = manager.getSensor( Sensor.SENSOR_TYPE_ACCELEROMETER );

    mCsvLog = new CsvLog( context );
    mPrefs = new PreferencesUtils( context );
    mLoggerSingleton = LoggerSingleton.getInstance();
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:17,代码来源:LoggerControl.java

示例5: getSensorRateStr

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
public String getSensorRateStr() {
    String sensorRate = "unknown";
    switch( mSensorRate )
    {
        case Sensor.SensorRates.SENSOR_DELAY_FASTEST:
            sensorRate = "FASTEST";
            break;

        case Sensor.SensorRates.SENSOR_DELAY_GAME:
            sensorRate = "FAST";
            break;

        case Sensor.SensorRates.SENSOR_DELAY_NORMAL:
            sensorRate = "NORMAL";
            break;

        case Sensor.SensorRates.SENSOR_DELAY_UI:
            sensorRate = "SLOW";
            break;

        default:
            Log.w( LOG_TAG, CLASS + ": getSensorRateStr: unknown rate: " + mSensorRate );
            break;
    }

    return sensorRate;
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:28,代码来源:LoggerSingleton.java

示例6: registerInterruptListener

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Register a sensor event listener that gets new data when the sensor has
 * new data. This type of listener is available if sensor support interrupt
 * mode. It is only possible to have one listener per sensor.
 *
 * @see #isInterruptModeSupported()
 * @param listener The event listener.
 */
public void registerInterruptListener(final AccessorySensorEventListener listener)
        throws AccessorySensorException {

    if (!mIsInterruptModeSupported) {
        throw new IllegalStateException("Interrupt mode not supported");
    }

    // Rate is ignored in interrupt mode.
    registerListener(listener, Sensor.SensorRates.SENSOR_DELAY_NORMAL,
            Sensor.SensorInterruptMode.SENSOR_INTERRUPT_ENABLED);
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:20,代码来源:AccessorySensor.java

示例7: registerInterruptListener

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Register a sensor event listener that gets new data when the sensor has
 * new data. It is only possible to have one listener per sensor.
 *
 * @param listener The event listener.
 */
public void registerInterruptListener(final AccessorySensorEventListener listener)
  throws AccessorySensorException {

  if (!mIsInterruptModeSupported) {
    throw new IllegalStateException("Interrupt mode not supported");
  }

  // Rate is ignored in interrupt mode.
  registerListener(listener, Sensor.SensorRates.SENSOR_DELAY_NORMAL,
                   Sensor.SensorInterruptMode.SENSOR_INTERRUPT_ENABLED);
}
 
开发者ID:trashkalmar,项目名称:MrParkingNavigator,代码行数:18,代码来源:AccessorySensor.java

示例8: sendSensorStartListeningIntent

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Send start listening intent to host application
 *
 * @see Sensor.Intents#SENSOR_REGISTER_LISTENER_INTENT
 */
private void sendSensorStartListeningIntent() {
  Intent i = new Intent(Sensor.Intents.SENSOR_REGISTER_LISTENER_INTENT);
  i.putExtra(Sensor.Intents.EXTRA_SENSOR_ID, mSensorId);
  i.putExtra(Sensor.Intents.EXTRA_SENSOR_LOCAL_SERVER_SOCKET_NAME, mSocketName);
  i.putExtra(Sensor.Intents.EXTRA_SENSOR_REQUESTED_RATE, mSensorRate);
  i.putExtra(Sensor.Intents.EXTRA_SENSOR_INTERRUPT_MODE, mInterruptMode);
  sendToHostApp(i);
}
 
开发者ID:trashkalmar,项目名称:MrParkingNavigator,代码行数:14,代码来源:AccessorySensor.java

示例9: sendSensorStopListeningIntent

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Send stop listening intent to host application
 *
 * @see Sensor.Intents#SENSOR_UNREGISTER_LISTENER_INTENT
 */
private void sendSensorStopListeningIntent() {
    Intent i = new Intent(Sensor.Intents.SENSOR_UNREGISTER_LISTENER_INTENT);
    i.putExtra(Sensor.Intents.EXTRA_SENSOR_ID, mSensorId);
    sendToHostApp(i);
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:11,代码来源:AccessorySensor.java

示例10: isSensorSupported

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
@Override
public boolean isSensorSupported( AccessorySensor sensor ) {
    return Sensor.SENSOR_TYPE_ACCELEROMETER.equals( sensor.getType().getName() );
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:5,代码来源:RegistrationInformation.java

示例11: sendSensorStopListeningIntent

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Send stop listening intent to host application
 *
 * @see Sensor.Intents#SENSOR_UNREGISTER_LISTENER_INTENT
 */
private void sendSensorStopListeningIntent() {
  Intent i = new Intent(Sensor.Intents.SENSOR_UNREGISTER_LISTENER_INTENT);
  i.putExtra(Sensor.Intents.EXTRA_SENSOR_ID, mSensorId);
  sendToHostApp(i);
}
 
开发者ID:trashkalmar,项目名称:MrParkingNavigator,代码行数:11,代码来源:AccessorySensor.java

示例12: registerFixedRateListener

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Register a sensor event listener that gets new data at a fixed rate. It
 * is only possible to have one listener per sensor.
 *
 * @param listener The event listener.
 * @param sensorRate The rate.
 */
public void registerFixedRateListener(final AccessorySensorEventListener listener,
        int sensorRate) throws AccessorySensorException {
    registerListener(listener, sensorRate, Sensor.SensorInterruptMode.SENSOR_INTERRUPT_DISABLED);
}
 
开发者ID:fbarriga,项目名称:sony-smartband-logger,代码行数:12,代码来源:AccessorySensor.java

示例13: registerFixedRateListener

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Register a sensor event listener that gets new data at a fixed rate. It
 * is only possible to have one listener per sensor.
 *
 * @param listener The event listener.
 * @param sensorRate Any one of the constants defined in the
 *            {@link Sensor.SensorRates} interface.
 */
public void registerFixedRateListener(final AccessorySensorEventListener listener,
        int sensorRate) throws AccessorySensorException {
    registerListener(listener, sensorRate, Sensor.SensorInterruptMode.SENSOR_INTERRUPT_DISABLED);
}
 
开发者ID:asamm,项目名称:locus-addon-smartwatch2,代码行数:13,代码来源:AccessorySensor.java

示例14: registerFixedRateListener

import com.sonyericsson.extras.liveware.aef.sensor.Sensor; //导入依赖的package包/类
/**
 * Register a sensor event listener that gets new data at a fixed rate. It
 * is only possible to have one listener per sensor.
 *
 * @param listener The event listener.
 * @param sensorRate Any one of the constants defined in the
 *            Sensor.SensorRate interface.
 * @see Sensor.SensorRates
 */
public void registerFixedRateListener(final AccessorySensorEventListener listener,
        int sensorRate) throws AccessorySensorException {
    registerListener(listener, sensorRate, Sensor.SensorInterruptMode.SENSOR_INTERRUPT_DISABLED);
}
 
开发者ID:hecosire,项目名称:hecosire-androidapp,代码行数:14,代码来源:AccessorySensor.java


注:本文中的com.sonyericsson.extras.liveware.aef.sensor.Sensor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。