本文整理汇总了Java中com.google.android.things.userdriver.UserDriverManager类的典型用法代码示例。如果您正苦于以下问题:Java UserDriverManager类的具体用法?Java UserDriverManager怎么用?Java UserDriverManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserDriverManager类属于com.google.android.things.userdriver包,在下文中一共展示了UserDriverManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerDriver
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
public void registerDriver() {
if (mLm75 == null)
throw new IllegalStateException(TAG + ": LM75 sensor isn't available!");
if (mUserSensor == null) {
mUserSensor = UserSensor.builder()
.setType(Sensor.TYPE_AMBIENT_TEMPERATURE)
.setName(DRIVER_NAME)
.setVendor(DRIVER_VENDOR)
.setVersion(DRIVER_VERSION)
//.setMaxRange(DRIVER_MAX_RANGE)
//.setResolution(DRIVER_RESOLUTION)
//.setPower(DRIVER_POWER)
.setMinDelay(DRIVER_MIN_DELAY)
.setMaxDelay(DRIVER_MAX_DELAY)
.setRequiredPermission(DRIVER_REQUIRED_PERMISSION)
.setUuid(UUID.randomUUID())
.setDriver(this)
.build();
UserDriverManager.getManager().registerSensor(mUserSensor);
}
}
示例2: registerParticleSensor
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
/**
* Register a {@link UserSensor} that pipes particle count readings into the
* Android SensorManager.
* @see #unregisterParticleSensor()
*/
public void registerParticleSensor() {
if (mDevice == null) {
throw new IllegalStateException("cannot register closed driver");
}
if (mUserDriver == null) {
mUserDriver = new ParticleCountUserDriver();
UserDriverManager.getManager().registerSensor(mUserDriver.getUserSensor());
}
}
示例3: unregisterParticleSensor
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
/**
* Unregister the particle sensor {@link UserSensor}.
*/
public void unregisterParticleSensor() {
if (mUserDriver != null) {
UserDriverManager.getManager().unregisterSensor(mUserDriver.getUserSensor());
mUserDriver = null;
}
}
示例4: unregisterSensor
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
public void unregisterSensor() throws IOException {
if (mDistanceUserDriver != null) {
UserDriverManager.getManager().unregisterSensor(mDistanceUserDriver.getUserSensor());
mDistanceUserDriver.close();
mDistanceUserDriver = null;
}
}
示例5: register
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
/**
* Register this driver with the Android input framework.
*/
public void register() {
if (inputDriver == null) {
UserDriverManager manager = UserDriverManager.getManager();
inputDriver = new InputDriver.Builder(InputDevice.SOURCE_CLASS_BUTTON)
.setName(DRIVER_NAME)
.setVersion(DRIVER_VERSION)
.setKeys(keycodes)
.build();
manager.registerInputDriver(inputDriver);
}
}
示例6: unregister
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
/**
* Unregister this driver with the Android input framework.
*/
public void unregister() {
if (inputDriver != null) {
UserDriverManager manager = UserDriverManager.getManager();
manager.unregisterInputDriver(inputDriver);
inputDriver = null;
}
}
示例7: register
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
/**
* Register the driver in the framework.
* @see #unregister()
*/
public void register() {
if (lsm9DS0 == null) {
throw new IllegalStateException("cannot registered closed driver");
}
if (userSensor == null) {
userSensor = build(lsm9DS0);
UserDriverManager.getManager().registerSensor(userSensor);
}
}
示例8: unregister
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
/**
* Unregister the driver from the framework.
*/
public void unregister() {
if ( userSensor != null ) {
UserDriverManager.getManager().unregisterSensor(userSensor);
userSensor = null;
}
}
示例9: registerMagmetormeterSensor
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
void registerMagmetormeterSensor() {
if (hmcl5883l == null) {
throw new IllegalStateException("cannot register closed driver");
}
if (mUserDriver == null) {
mUserDriver = new MagnetometerUserDriver();
UserDriverManager.getManager().registerSensor(mUserDriver.getUserSensor());
}
}
示例10: registerTemperatureSensor
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
/**
* Register a {@link UserSensor} that pipes temperature readings into the Android SensorManager.
* @see #unregisterTemperatureSensor()
*/
public void registerTemperatureSensor() {
if (mDevice == null) {
throw new IllegalStateException("cannot register closed driver");
}
if (mTemperatureUserDriver == null) {
mTemperatureUserDriver = new TemperatureUserDriver();
UserDriverManager.getManager().registerSensor(mTemperatureUserDriver.getUserSensor());
}
}
示例11: registerHumiditySensor
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
/**
* Register a {@link UserSensor} that pipes humidity readings into the Android SensorManager.
* @see #unregisterHumiditySensor()
*/
public void registerHumiditySensor() {
if (mDevice == null) {
throw new IllegalStateException("cannot register closed driver");
}
if (mHumidityUserDriver == null) {
mHumidityUserDriver = new HumidityUserDriver();
UserDriverManager.getManager().registerSensor(mHumidityUserDriver.getUserSensor());
}
}
示例12: unregisterTemperatureSensor
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
/**
* Unregister the temperature {@link UserSensor}.
*/
public void unregisterTemperatureSensor() {
if (mTemperatureUserDriver != null) {
UserDriverManager.getManager().unregisterSensor(mTemperatureUserDriver.getUserSensor());
mTemperatureUserDriver = null;
}
}
示例13: unregisterHumiditySensor
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
/**
* Unregister the humidity {@link UserSensor}.
*/
public void unregisterHumiditySensor() {
if (mHumidityUserDriver != null) {
UserDriverManager.getManager().unregisterSensor(mHumidityUserDriver.getUserSensor());
mHumidityUserDriver = null;
}
}
示例14: register
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
public void register() {
if (device == null) {
throw new IllegalStateException("cannot registered closed driver");
}
if (userSensor == null) {
userSensor = build(device);
UserDriverManager.getManager().registerSensor(userSensor);
}
}
开发者ID:vishal-android-freak,项目名称:HC-SR04-AndroidThings-Library,代码行数:10,代码来源:Hcsr04UltrasonicDriver.java
示例15: registerAccelerometerSensor
import com.google.android.things.userdriver.UserDriverManager; //导入依赖的package包/类
public void registerAccelerometerSensor() {
if (adxl345 == null) {
throw new IllegalStateException("cannot register closed driver");
}
if (mUserDriver == null) {
mUserDriver = new AccelerometerUserDriver();
UserDriverManager.getManager().registerSensor(mUserDriver.getUserSensor());
}
}