#include <Sensor.h>
Inherited by Accelerometer, Camera, Compass, Email, Geolocator, Gyrometer, LightSensor, Media, Microphone, Notification, Orientation, Recognition, Sms, Speech, Text, Vibrate, and Web.
|
| Sensor (const VirtualShield &shield, const char sensorType) |
| Initializes a new instance of the Sensor class. More...
|
|
int | start (double delta=0, long interval=0) |
| Starts the sensor, triggered when longer than the interval and larger than the delta. More...
|
|
virtual int | stop () |
| Stops this sensor. More...
|
|
int | get () |
| Gets a single, current sensor reading. More...
|
|
int | getOnChange (double delta=0) |
| Requests a single reading when more than the delta beyond the current reading. More...
|
|
bool | isUpdated () |
| Determines whether this sensor has an updated value. Resets to false after this call. More...
|
|
int | writeAll (const char *serviceName, EPtr values[], int count, Attr extraAttributes[]=0, int extraAttributeCount=0) |
| Writes all EPtr values to the communication channel. More...
|
|
int | sensorAction (SensorAction sensorAction, double delta=0, long interval=0) const |
| Sends the specific action to start/stop/get/onChange the sensor using a delta and interval. More...
|
|
virtual bool | isEvent (const char *tag, const char *action, ShieldEvent *shieldEvent) |
| Determines whether the specified shieldEvent matches the tag and action. More...
|
|
virtual bool | isEvent (int id, const char *action, ShieldEvent *shieldEvent) |
| Determines whether the specified shieldEvent matches the id and action. More...
|
|
void | setOnEvent (void(*onEvent)(ShieldEvent *shieldEvent)) |
|
int | sendStop (const char *serviceName) |
|
virtual void | onJsonReceived (JsonObject &root, ShieldEvent *shieldEvent) |
| Event called when a valid json message was received. Consumes the proper values for this sensor. More...
|
|
Sensor::Sensor |
( |
const VirtualShield & |
shield, |
|
|
const char |
sensorType |
|
) |
| |
Initializes a new instance of the Sensor class.
- Parameters
-
shield | The shield. |
sensorType | Filter for identifying a service. |
Gets a single, current sensor reading.
int Sensor::getOnChange |
( |
double |
delta = 0 | ) |
|
Requests a single reading when more than the delta beyond the current reading.
- Parameters
-
delta | The delta of expected change. Zero is all. |
bool Sensor::isEvent |
( |
const char * |
tag, |
|
|
const char * |
action, |
|
|
ShieldEvent * |
shieldEvent |
|
) |
| |
|
virtual |
Determines whether the specified shieldEvent matches the tag and action.
- Parameters
-
tag | The tag. |
action | The action. |
shieldEvent | The shield event. |
- Returns
- bool.
bool Sensor::isEvent |
( |
int |
id, |
|
|
const char * |
action, |
|
|
ShieldEvent * |
shieldEvent |
|
) |
| |
|
virtual |
Determines whether the specified shieldEvent matches the id and action.
- Parameters
-
id | The identifier. |
action | The action. |
shieldEvent | The shield event. |
- Returns
- bool.
bool Sensor::isUpdated |
( |
| ) |
|
Determines whether this sensor has an updated value. Resets to false after this call.
- Returns
- true if updated from last check.
void Sensor::onJsonReceived |
( |
JsonObject & |
root, |
|
|
ShieldEvent * |
shieldEvent |
|
) |
| |
|
virtual |
Event called when a valid json message was received. Consumes the proper values for this sensor.
- Parameters
-
root | The root json object. |
shieldEvent | The shield event. |
Reimplemented in Graphics, Recognition, Text, Media, Orientation, Speech, Accelerometer, Geolocator, Gyrometer, Compass, Email, LightSensor, Sms, Vibrate, Camera, Notification, and Microphone.
int Sensor::sendStop |
( |
const char * |
serviceName | ) |
|
int Sensor::sensorAction |
( |
SensorAction |
sensorAction, |
|
|
double |
delta = 0 , |
|
|
long |
interval = 0 |
|
) |
| const |
Sends the specific action to start/stop/get/onChange the sensor using a delta and interval.
- Parameters
-
sensorAction | The sensor action. |
delta | The delta. |
interval | The interval. |
- Returns
- int.
void Sensor::setOnEvent |
( |
void(*)(ShieldEvent *shieldEvent) |
onEvent | ) |
|
|
inline |
int Sensor::start |
( |
double |
delta = 0 , |
|
|
long |
interval = 0 |
|
) |
| |
Starts the sensor, triggered when longer than the interval and larger than the delta.
- Parameters
-
interval | The interval in milliseconds. Zero is all. |
delta | The delta of expected change. Zero is all. |
int Sensor::writeAll |
( |
const char * |
serviceName, |
|
|
EPtr |
values[], |
|
|
int |
count, |
|
|
Attr |
extraAttributes[] = 0 , |
|
|
int |
extraAttributeCount = 0 |
|
) |
| |
Writes all EPtr values to the communication channel.
- Parameters
-
serviceName | Name of the service. |
values | The values. |
count | The count of values. |
- Returns
- The new id of the message or a negative error.
bool Sensor::_isUpdated = false |
|
protected |
bool Sensor::isRunning = false |
const char Sensor::sensorType |
The documentation for this class was generated from the following files:
- C:/Users/jgord/Documents/ms-iot/virtual-shields-arduino/VirtualShield/Sensor.h
- C:/Users/jgord/Documents/ms-iot/virtual-shields-arduino/VirtualShield/Sensor.cpp