【函数】 | boolean isReady() |
【说明】 | 判断温度传感器是否可用。 |
【返回】 | true或false。 |
【参数】 | 无 |
【示例】 |
alert(rexseeTemperature.isReady());
运行示例
|
【函数】 | void start() |
【说明】 | 启动温度传感器。 |
【返回】 | 无 |
【参数】 | 无 |
【示例】 |
rexseeTemperature.start();
事件代码
运行示例
启动后请将查看下面的方框。
rexseeDialog.toast('传感器已启动。'); No Data
|
【函数】 | void stop() |
【说明】 | 关闭温度传感器。 |
【返回】 | 无 |
【参数】 | 无 |
【示例】 |
rexseeTemperature.stop();
运行示例
rexseeDialog.toast('传感器已关闭。'); |
【函数】 | String getLastKnownValue() |
【说明】 | 读取环境温度的值,单位是摄氏度,应注意考虑手机本身发热的影响。 |
【返回】 | 环境温度的值,null表示没有值。 |
【参数】 | 无 |
【示例】 |
alert(rexseeTemperature.getLastKnownValue());
运行示例
|
【函数】 | void setRate(String rate) |
【说明】 | 设置传感器响应速度,默认为“normal”。 |
【返回】 | 无 |
【参数】 | rate:传感器响应速度,“fastest”,“game”,“ui”或“normal”。 |
【示例】 |
rexseeTemperature.setRate('fastest');
运行示例
rexseeDialog.toast('设置完毕。'); |
【函数】 | String getRate() |
【说明】 | 读取传感器响应速度。 |
【返回】 | 传感器响应速度,“fastest”,“game”,“ui”或“normal”。 |
【参数】 | 无 |
【示例】 |
alert(rexseeTemperature.getRate());
运行示例
|
【函数】 | void setCycle(int milliseconds) |
【说明】 | 设置传感器检测周期,毫秒数,默认为100毫秒。 |
【返回】 | 无 |
【参数】 | milliseconds:传感器检测周期。 |
【示例】 |
rexseeTemperature.setCycle(1000);
运行示例
rexseeDialog.toast('设置完毕。'); |
【函数】 | int getCycle() |
【说明】 | 读取传感器检测周期。 |
【返回】 | 传感器检测周期,毫秒数。 |
【参数】 | 无 |
【示例】 |
alert(rexseeTemperature.getCycle());
运行示例
|
【函数】 | void setEventCycle(int milliseconds) |
【说明】 | 设置传感器触发事件的最短间隔,在该间隔内不会重复触发事件,毫秒数,默认为100毫秒。 |
【返回】 | 无 |
【参数】 | milliseconds:传感器触发事件的最短间隔。 |
【示例】 |
rexseeTemperature.setEventCycle(1000);
运行示例
rexseeDialog.toast('设置完毕。'); |
【函数】 | int getEventCycle() |
【说明】 | 读取传感器触发事件的最短间隔。 |
【返回】 | 传感器触发事件的最短间隔,毫秒数。 |
【参数】 | 无 |
【示例】 |
alert(rexseeTemperature.getEventCycle());
运行示例
|
【函数】 | void setAccuracy(float accuracy) |
【说明】 | 设置敏感度,两次检测的差异大于该敏感度才会触发事件,单位是摄氏度。 |
【返回】 | 无 |
【参数】 | accuracy:敏感度。 |
【示例】 |
rexseeTemperature.setAccuracy(100);
运行示例
rexseeDialog.toast('设置完毕。'); |
【函数】 | float getAccuracy() |
【说明】 | 读取敏感度。 |
【返回】 | 敏感度,单位是摄氏度。 |
【参数】 | 无 |
【示例】 |
alert(rexseeTemperature.getAccuracy());
运行示例
|