evothings.tisensortag. SensorTagInstanceBLE
Source: evothings-libraries/
Abstract SensorTag instance object. This object specifies the interface common to Bluetooth Smart SensorTags.
Methods
Methods
barometerCallback(fun, interval)
Both CC2541 and CC2650. Public. Set the barometer notification callback.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
fun |
|
|
success callback called repeatedly: fun(data) |
|
interval |
|
|
barometer rate in milliseconds. |
barometerOff()
Both CC2541 and CC2650. Public. Turn off barometer notification.
barometerOn()
Public. Turn on barometer notification.
connectToClosestDevice()
Public. Connect to the nearest physical SensorTag device.
- Deprecated
- Use evothings.tiseonsortag.ble.connectToNearestDevice
connectToDevice(device)
Connect to a SensorTag BLE device.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
device |
|
|
A Bluetooth Low Energy device object. |
connectToNearestDevice(scanTimeMilliseconds)
Public. Connect to the nearest physical SensorTag device. For this to work reliably SensorTags should be at least a couple of meters apart.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
scanTimeMilliseconds |
|
|
The time to scan for nearby SensorTags (optional, defaults to 3 seconds). |
deviceIsSensorTag()
Determine if a BLE device is a SensorTag. This version checks the general case using the advertised name. Specific versions for CC2541 and CC2650 uses advertisement data to determine tag type.
disconnectDevice()
Public. Disconnect from the physical device.
getHumidityValues(data)
Calculate humidity values from raw data.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
data |
|
|
an Uint8Array. |
- Returns
-
Object with fields: humidityTemperature, relativeHumidity.
humidityCallback(fun, interval)
Both CC2541 and CC2650. Public. Set the humidity notification callback.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
fun |
|
|
success callback called repeatedly: fun(data) |
|
interval |
|
|
humidity rate in milliseconds. |
humidityOff()
Both CC2541 and CC2650. Public. Turn off humidity notification.
humidityOn()
Both CC2541 and CC2650. Public. Turn on humidity notification.
keypressCallback(fun)
Both CC2541 and CC2650. Public. Set the keypress notification callback.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
fun |
|
|
success callback called when a key is pressed: fun(data) |
keypressOff()
Both CC2541 and CC2650. Public. Turn off keypress notification.
keypressOn()
Both CC2541 and CC2650. Public. Turn on keypress notification.
sensorOff()
Helper function for turning off sensor notification.
sensorOn()
Public. Used internally as a helper function for turning on sensor notification. You can call this function from the application to enable sensors using custom parameters. For advanced use.
startScanningForDevices(foundCallback)
Start scanning for physical devices.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
foundCallback |
|
|
Function called when a SensorTag is found. It has the form foundCallback(device) where is a an object representing a BLE device object. You can inspect the device fields to determine properties such as RSSI, name etc. You can call deviceIsSensorTag(device) to determine if this is a SensorTag of the same type as the instance object. To connect to a SensorTag call connectToDevice(device). |
stopScanningForDevices()
Stop scanning for physical devices.
temperatureCallback(fun, interval)
Both CC2541 and CC2650. Public. Set the humidity temperature callback.
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
fun |
|
|
success callback called repeatedly: fun(data) |
|
interval |
|
|
humidity rate in milliseconds. |
temperatureOff()
Both CC2541 and CC2650. Public. Turn off IR temperature notification.
temperatureOn()
Both CC2541 and CC2650. Public. Turn on IR temperature notification.