本文整理汇总了Java中com.google.android.things.userdriver.UserSensorDriver类的典型用法代码示例。如果您正苦于以下问题:Java UserSensorDriver类的具体用法?Java UserSensorDriver怎么用?Java UserSensorDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserSensorDriver类属于com.google.android.things.userdriver包,在下文中一共展示了UserSensorDriver类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: build
import com.google.android.things.userdriver.UserSensorDriver; //导入依赖的package包/类
/**
* Build User sesnor to be registered with the Android Things framework
* @param adxl362 instance of core ADXL362.java
*/
private static UserSensor build(final Adxl362 adxl362) {
return UserSensor.builder()
.setName(DRIVER_NAME)
.setVendor(DRIVER_VENDOR)
.setVersion(DRIVER_VERSION)
.setCustomType(Sensor.TYPE_DEVICE_PRIVATE_BASE,
"vaf.vishal.adxl", Sensor.REPORTING_MODE_CONTINUOUS)
.setDriver(new UserSensorDriver() {
@Override
public UserSensorReading read() throws IOException {
float[] values = adxl362.readXYZTempData();
return new UserSensorReading(values);
}
})
.build();
}
开发者ID:vishal-android-freak,项目名称:ADXL362-Interfacing-Library,代码行数:21,代码来源:Adxl362AccelerometerDriver.java
示例2: build
import com.google.android.things.userdriver.UserSensorDriver; //导入依赖的package包/类
private static UserSensor build(final Adxl362 adxl362) {
return UserSensor.builder()
.setName(DRIVER_NAME)
.setVendor(DRIVER_VENDOR)
.setVersion(DRIVER_VERSION)
.setCustomType(Sensor.TYPE_DEVICE_PRIVATE_BASE,
"vaf.vishal.adxl", Sensor.REPORTING_MODE_CONTINUOUS)
.setDriver(new UserSensorDriver() {
@Override
public UserSensorReading read() throws IOException {
float[] values = adxl362.readXYZTempData();
return new UserSensorReading(values);
}
})
.build();
}
开发者ID:vishal-android-freak,项目名称:ADXL362-Interfacing-Library,代码行数:17,代码来源:Adxl362AccelerometerDriver.java
示例3: build
import com.google.android.things.userdriver.UserSensorDriver; //导入依赖的package包/类
static UserSensor build(final LSM9DS0 lsm9DS0) {
return UserSensor.builder()
.setType(Sensor.TYPE_ACCELEROMETER)
.setName(DRIVER_NAME)
.setVendor(DRIVER_VENDOR)
.setVersion(DRIVER_VERSION)
.setRequiredPermission(DRIVER_REQUIRED_PERMISSION)
.setMaxRange(DRIVER_MAX_RANGE)
.setMinDelay(DRIVER_MIN_DELAY_US)
.setMaxDelay(DRIVER_MAX_DELAY_US)
.setUuid(UUID.randomUUID())
.setDriver(new UserSensorDriver() {
@Override
public UserSensorReading read() throws IOException {
lsm9DS0.readAccel();
lsm9DS0.readMag();
lsm9DS0.readMag();
lsm9DS0.readTemp();
//Log.i(TAG,"Read sensor info");
float[] sample = new float[] { 0.0f, 0.0f, 0.0f };
return new UserSensorReading(
sample,
SensorManager.SENSOR_STATUS_ACCURACY_HIGH); // 120Hz
}
@Override
public void setEnabled(boolean enabled) throws IOException {
if (enabled) {
//mma7660fc.setMode(Mma7660Fc.MODE_ACTIVE);
} else {
//mma7660fc.setMode(Mma7660Fc.MODE_STANDBY);
}
}
})
.build();
}
开发者ID:hongcheng79,项目名称:androidthings,代码行数:41,代码来源:LSM9DS0Driver.java
示例4: build
import com.google.android.things.userdriver.UserSensorDriver; //导入依赖的package包/类
private static UserSensor build(final Hcsr04 hcsr04) {
return UserSensor.builder()
.setName(DRIVER_NAME)
.setVersion(DRIVER_VERSION)
.setType(Sensor.TYPE_PROXIMITY)
.setDriver(new UserSensorDriver() {
@Override
public UserSensorReading read() throws IOException {
float[] distance = hcsr04.getProximityDistance();
return new UserSensorReading(distance);
}
})
.build();
}
开发者ID:vishal-android-freak,项目名称:HC-SR04-AndroidThings-Library,代码行数:15,代码来源:Hcsr04UltrasonicDriver.java
示例5: build
import com.google.android.things.userdriver.UserSensorDriver; //导入依赖的package包/类
static UserSensor build(final Mma7660Fc mma7660fc) {
return new UserSensor.Builder()
.setType(Sensor.TYPE_ACCELEROMETER)
.setName(DRIVER_NAME)
.setVendor(DRIVER_VENDOR)
.setVersion(DRIVER_VERSION)
.setMaxRange(DRIVER_MAX_RANGE)
.setResolution(DRIVER_RESOLUTION)
.setPower(DRIVER_POWER)
.setMinDelay(DRIVER_MIN_DELAY_US)
.setRequiredPermission(DRIVER_REQUIRED_PERMISSION)
.setMaxDelay(DRIVER_MAX_DELAY_US)
.setUuid(UUID.randomUUID())
.setDriver(new UserSensorDriver() {
@Override
public UserSensorReading read() throws IOException {
float[] sample = mma7660fc.readSample();
for (int i=0; i<sample.length; i++) {
sample[i] = sample[i] * SensorManager.GRAVITY_EARTH;
}
return new UserSensorReading(
sample,
SensorManager.SENSOR_STATUS_ACCURACY_HIGH); // 120Hz
}
@Override
public void setEnabled(boolean enabled) throws IOException {
if (enabled) {
mma7660fc.setMode(Mma7660Fc.MODE_ACTIVE);
} else {
mma7660fc.setMode(Mma7660Fc.MODE_STANDBY);
}
}
})
.build();
}
开发者ID:androidthings,项目名称:contrib-drivers,代码行数:37,代码来源:Mma7660FcAccelerometerDriver.java
注:本文中的com.google.android.things.userdriver.UserSensorDriver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论