本文整理汇总了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();
}
开发者ID:hongcheng79,项目名称:androidthings,代码行数:41,代码来源:LSM9DS0Driver.java
示例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();
}
开发者ID:androidthings,项目名称:contrib-drivers,代码行数:37,代码来源:Mma7660FcAccelerometerDriver.java
示例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()});
}
开发者ID:jpuderer,项目名称:Taxi-Datalogger,代码行数:5,代码来源:HpmSensorDriver.java
示例7: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(new float[]{ mDistance });
}
开发者ID:holgi-s,项目名称:RangeThings,代码行数:5,代码来源:HCSR04Driver.java
示例8: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(new float[] {mLm75.getTemp()});
}
开发者ID:m-thu,项目名称:android-things,代码行数:5,代码来源:Lm75Driver.java
示例9: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(hmcl5883l.getMagnitudes());
}
开发者ID:kevalpatel2106,项目名称:robo-car,代码行数:5,代码来源:HMC5883LSensorDriver.java
示例10: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(new float[]{mDevice.readTemperature()});
}
开发者ID:jpuderer,项目名称:jpuderer-things-drivers,代码行数:5,代码来源:Sht1xSensorDriver.java
示例11: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(adxl345.getAccelerations());
}
开发者ID:cagdasc,项目名称:AndroidThings-ADXL345,代码行数:5,代码来源:ADXL345SensorDriver.java
示例12: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(new float[]{mDevice.getPsData()});
}
开发者ID:androidthings,项目名称:contrib-drivers,代码行数:5,代码来源:Vcnl4200SensorDriver.java
示例13: read
import com.google.android.things.userdriver.UserSensorReading; //导入依赖的package包/类
@Override
public UserSensorReading read() throws IOException {
return new UserSensorReading(new float[]{mDevice.readPressure()});
}
开发者ID:androidthings,项目名称:contrib-drivers,代码行数:5,代码来源:Bmx280SensorDriver.java
注:本文中的com.google.android.things.userdriver.UserSensorReading类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论