AI2 Component
(Version nb184)
Barometer.java
Go to the documentation of this file.
1
// -*- mode: java; c-basic-offset: 2; -*-
2
// Copyright 2019 MIT, All rights reserved
3
// Released under the Apache License, Version 2.0
4
// http://www.apache.org/licenses/LICENSE-2.0
5
6
7
package
com.google.appinventor.components.runtime;
8
9
import
com
.
google
.
appinventor
.
components
.
annotations
.
DesignerComponent
;
10
import
com
.
google
.
appinventor
.
components
.
annotations
.
SimpleEvent
;
11
import
com
.
google
.
appinventor
.
components
.
annotations
.
SimpleObject
;
12
import
com
.
google
.
appinventor
.
components
.
annotations
.
SimpleProperty
;
13
import
com
.
google
.
appinventor
.
components
.
common
.
ComponentCategory
;
14
import
com
.
google
.
appinventor
.
components
.
common
.
YaVersion
;
15
16
import
android.hardware.Sensor;
17
22
@DesignerComponent(version = YaVersion.BAROMETER_COMPONENT_VERSION,
23
description =
"A sensor component that can measure the ambient air pressure."
,
24
category = ComponentCategory.SENSORS,
25
nonVisible =
true
,
26
iconName =
"images/barometer.png"
)
27
@SimpleObject
28
public
class
Barometer
extends
SingleValueSensor
{
34
public
Barometer
(
ComponentContainer
container) {
35
super(container.
$form
(), Sensor.TYPE_PRESSURE);
36
}
37
38
@Override
39
protected
void
onValueChanged
(
float
value
) {
40
AirPressureChanged
(
value
);
41
}
42
48
@
SimpleEvent
49
public
void
AirPressureChanged
(
float
pressure) {
50
EventDispatcher
.
dispatchEvent
(
this
,
"AirPressureChanged"
, pressure);
51
}
52
59
@
SimpleProperty
(description =
"The air pressure in hPa (millibar), if the sensor is available "
+
60
"and enabled."
)
61
public
float
AirPressure
() {
62
return
getValue
();
63
}
64
}
com.google.appinventor.components.runtime.EventDispatcher
Definition:
EventDispatcher.java:22
com.google.appinventor.components.runtime.Barometer.AirPressure
float AirPressure()
Definition:
Barometer.java:61
com.google.appinventor.components.common.YaVersion
Definition:
YaVersion.java:14
com.google.appinventor.components
com.google.appinventor.components.annotations.DesignerComponent
Definition:
DesignerComponent.java:22
com.google.appinventor.components.annotations.SimpleEvent
Definition:
SimpleEvent.java:20
com.google.appinventor.components.runtime.SingleValueSensor.getValue
float getValue()
Definition:
SingleValueSensor.java:191
com.google.appinventor.components.runtime.SingleValueSensor
Definition:
SingleValueSensor.java:27
com.google.appinventor.components.runtime.EventDispatcher.dispatchEvent
static boolean dispatchEvent(Component component, String eventName, Object...args)
Definition:
EventDispatcher.java:188
com.google.appinventor.components.runtime.Barometer.AirPressureChanged
void AirPressureChanged(float pressure)
Definition:
Barometer.java:49
com.google.appinventor.components.runtime.Barometer.onValueChanged
void onValueChanged(float value)
Definition:
Barometer.java:39
com.google.appinventor.components.annotations.SimpleProperty
Definition:
SimpleProperty.java:23
com.google.appinventor.components.runtime.Barometer
Definition:
Barometer.java:28
com.google.appinventor.components.runtime.ComponentContainer
Definition:
ComponentContainer.java:16
com.google.appinventor.components.common
Definition:
ComponentCategory.java:7
com.google.appinventor.components.common.ComponentCategory
Definition:
ComponentCategory.java:48
com.google.appinventor.components.annotations.SimpleObject
Definition:
SimpleObject.java:23
com.google
com
com.google.appinventor.components.runtime.SingleValueSensor.value
float value
Definition:
SingleValueSensor.java:33
com.google.appinventor.components.runtime.Barometer.Barometer
Barometer(ComponentContainer container)
Definition:
Barometer.java:34
com.google.appinventor.components.runtime.ComponentContainer.$form
Form $form()
com.google.appinventor.components.annotations
com.google.appinventor
com
google
appinventor
components
runtime
Barometer.java
Generated by
1.8.16