本文整理汇总了Java中com.google.android.things.userdriver.UserSensorReading类的典型用法代码示例。如果您正苦于以下问题:Java UserSensorReading类的具体用法?Java UserSensorReading怎么用?Java UserSensorReading使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserSensorReading类属于com.google.android.things.userdriver包,在下文中一共展示了UserSensorReading类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的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.UserSensorReading; //导入依赖的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.UserSensorReading; //导入依赖的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();
}
示例4: build
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的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.UserSensorReading; //导入依赖的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();
}
示例6: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(new float[]{mDevice.readPm25(), mDevice.readPm10()});
}
示例7: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(new float[]{ mDistance });
}
示例8: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(new float[] {mLm75.getTemp()});
}
示例9: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(hmcl5883l.getMagnitudes());
}
示例10: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(new float[]{mDevice.readTemperature()});
}
示例11: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(adxl345.getAccelerations());
}
示例12: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(new float[]{mDevice.getPsData()});
}
示例13: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(new float[]{mDevice.readPressure()});
}