• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UserSensor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getUserSensor

import com.google.android.things.userdriver.UserSensor; //导入依赖的package包/类
private UserSensor getUserSensor() {
    if (mUserSensor == null) {
        mUserSensor = new UserSensor.Builder()
                .setCustomType(Sensor.TYPE_DEVICE_PRIVATE_BASE,
                        SENSOR_STRING_TYPE,
                        Sensor.REPORTING_MODE_CONTINUOUS)
                .setName(DRIVER_NAME)
                .setVendor(DRIVER_VENDOR)
                .setVersion(DRIVER_VERSION)
                .setMaxRange(HpmSensor.HPM_PARTICLE_MAX)
                .setResolution(HpmSensor.HPM_PARTICLE_RESOLUTION)
                .setPower(HpmSensor.HPM_POWER_CONSUMPTION_UA)
                .setMinDelay(DRIVER_MIN_DELAY_US)
                .setRequiredPermission(DRIVER_REQUIRED_PERMISSION)
                .setMaxDelay(DRIVER_MAX_DELAY_US)
                .setUuid(UUID.randomUUID())
                .setDriver(this)
                .build();
    }
    return mUserSensor;
}
 
开发者ID:jpuderer,项目名称:Taxi-Datalogger,代码行数:22,代码来源:HpmSensorDriver.java


示例2: registerDriver

import com.google.android.things.userdriver.UserSensor; //导入依赖的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);
    }
}
 
开发者ID:m-thu,项目名称:android-things,代码行数:23,代码来源:Lm75Driver.java


示例3: getUserSensor

import com.google.android.things.userdriver.UserSensor; //导入依赖的package包/类
private UserSensor getUserSensor() {
    if (mUserSensor == null) {
        mUserSensor = UserSensor.builder()
                .setType(Sensor.TYPE_MAGNETIC_FIELD)
                .setName(DRIVER_NAME)
                .setVendor(DRIVER_VENDOR)
                .setVersion(DRIVER_VERSION)
                .setResolution(DRIVER_RESOLUTION)
                .setPower(DRIVER_POWER)
                .setMinDelay(DRIVER_MIN_DELAY_US)
                .setRequiredPermission(DRIVER_REQUIRED_PERMISSION)
                .setMaxDelay(DRIVER_MAX_DELAY_US)
                .setUuid(UUID.randomUUID())
                .setDriver(this)
                .build();
    }
    return mUserSensor;
}
 
开发者ID:kevalpatel2106,项目名称:robo-car,代码行数:19,代码来源:HMC5883LSensorDriver.java


示例4: getUserSensor

import com.google.android.things.userdriver.UserSensor; //导入依赖的package包/类
private UserSensor getUserSensor() {
    if (mUserSensor == null) {
        mUserSensor = new UserSensor.Builder()
                .setType(Sensor.TYPE_AMBIENT_TEMPERATURE)
                .setName(DRIVER_NAME)
                .setVendor(DRIVER_VENDOR)
                .setVersion(DRIVER_VERSION)
                .setMaxRange(Sht1xSensor.SHT1X_TEMPERATURE_MAX)
                .setResolution(Sht1xSensor.SHT1X_TEMPERATURE_RESOLUTION)
                .setPower(Sht1xSensor.SHT1X_POWER_CONSUMPTION_UA)
                .setMinDelay(DRIVER_MIN_DELAY_US)
                .setRequiredPermission(DRIVER_REQUIRED_PERMISSION)
                .setMaxDelay(DRIVER_MAX_DELAY_US)
                .setUuid(UUID.randomUUID())
                .setDriver(this)
                .build();
    }
    return mUserSensor;
}
 
开发者ID:jpuderer,项目名称:jpuderer-things-drivers,代码行数:20,代码来源:Sht1xSensorDriver.java


示例5: getUserSensor

import com.google.android.things.userdriver.UserSensor; //导入依赖的package包/类
private UserSensor getUserSensor() {
    if (mUserSensor == null) {
        mUserSensor = UserSensor.builder()
                .setType(Sensor.TYPE_ACCELEROMETER)
                .setName(DRIVER_NAME)
                .setVendor(DRIVER_VENDOR)
                .setVersion(DRIVER_VERSION)
                .setResolution(DRIVER_RESOLUTION)
                .setPower(DRIVER_POWER)
                .setMinDelay(DRIVER_MIN_DELAY_US)
                .setRequiredPermission(DRIVER_REQUIRED_PERMISSION)
                .setMaxDelay(DRIVER_MAX_DELAY_US)
                .setUuid(UUID.randomUUID())
                .setDriver(this)
                .build();
    }
    return mUserSensor;
}
 
开发者ID:cagdasc,项目名称:AndroidThings-ADXL345,代码行数:19,代码来源:ADXL345SensorDriver.java


示例6: build

import com.google.android.things.userdriver.UserSensor; //导入依赖的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


示例7: build

import com.google.android.things.userdriver.UserSensor; //导入依赖的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


示例8: getUserSensor

import com.google.android.things.userdriver.UserSensor; //导入依赖的package包/类
private UserSensor getUserSensor() {
    if (mUserSensor == null) {
        mUserSensor = new UserSensor.Builder()
                .setType(Sensor.TYPE_PROXIMITY)
                .setName(DRIVER_NAME)
                .setVendor(DRIVER_VENDOR)
                .setVersion(DRIVER_VERSION)
                // Note that max reported value may actually be 0xFFF, as the driver can be
                // configured to report only 12-bit values.
                .setMaxRange(mDevice.getCurrentPsMaxRange())
                .setResolution(DRIVER_RESOLUTION)
                .setPower(DRIVER_POWER)
                .setMinDelay(DRIVER_MIN_DELAY_US)
                .setRequiredPermission(DRIVER_REQUIRED_PERMISSION)
                .setMaxDelay(DRIVER_MAX_DELAY_US)
                .setUuid(UUID.randomUUID())
                .setDriver(this)
                .build();
    }
    return mUserSensor;
}
 
开发者ID:androidthings,项目名称:contrib-drivers,代码行数:22,代码来源:Vcnl4200SensorDriver.java


示例9: getUserSensor

import com.google.android.things.userdriver.UserSensor; //导入依赖的package包/类
private UserSensor getUserSensor() {
    if (mUserSensor == null) {
        mUserSensor = new UserSensor.Builder()
                .setType(Sensor.TYPE_PRESSURE)
                .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(this)
                .build();
    }
    return mUserSensor;
}
 
开发者ID:androidthings,项目名称:contrib-drivers,代码行数:20,代码来源:Bmx280SensorDriver.java


示例10: getUserSensor

import com.google.android.things.userdriver.UserSensor; //导入依赖的package包/类
private UserSensor getUserSensor() {
    if (mUserSensor == null) {
        mUserSensor = UserSensor.builder()
                .setType(Sensor.TYPE_PROXIMITY)
                .setName(SENSOR_NAME)
                .setVendor(SENSOR_VENDOR)
                .setVersion(SENSOR_VERSION)
                .setMaxRange(SENSOR_MAX_RANGE)
                .setResolution(SENSOR_RESOLUTION)
                .setMinDelay(SENSOR_MIN_DELAY)
                .setDriver(this)
                .build();
    }
    return mUserSensor;
}
 
开发者ID:holgi-s,项目名称:RangeThings,代码行数:16,代码来源:HCSR04Driver.java


示例11: build

import com.google.android.things.userdriver.UserSensor; //导入依赖的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


示例12: build

import com.google.android.things.userdriver.UserSensor; //导入依赖的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


示例13: build

import com.google.android.things.userdriver.UserSensor; //导入依赖的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.UserSensor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClassUtil类代码示例发布时间:2022-05-22
下一篇:
Java EmbeddedDataSourceConfiguration类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap