33 #include <ArduinoJson.h>
39 const PROGMEM
char MS[] =
"Ms";
40 const PROGMEM
char TO[] =
"To";
42 const PROGMEM
char ENABLE[] =
"ENABLE";
44 const PROGMEM
char ACTION[] =
"Action";
45 const PROGMEM
char TAG[] =
"Tag";
46 const PROGMEM
char IMAGE[] =
"IMAGE";
47 const PROGMEM
char AUDIO[] =
"Audio";
48 const PROGMEM
char URL[] =
"Url";
49 const PROGMEM
char STOP[] =
"STOP";
63 int start(
double delta = 0,
long interval = 0);
70 int writeAll(
const char* serviceName,
EPtr values[],
int count,
Attr extraAttributes[] = 0,
int extraAttributeCount = 0);
81 int sendStop(
const char* serviceName);
const PROGMEM char ACTION[]
Definition: Sensor.h:44
void(* onEvent)(ShieldEvent *shieldEvent)
Definition: Sensor.h:53
virtual int stop()
Stops this sensor.
Definition: Sensor.cpp:61
int getOnChange(double delta=0)
Requests a single reading when more than the delta beyond the current reading.
Definition: Sensor.cpp:81
const PROGMEM char TO[]
Definition: Sensor.h:40
Definition: VirtualShield.h:50
const PROGMEM char IMAGE[]
Definition: Sensor.h:46
const char sensorType
Definition: Sensor.h:58
SensorAction
Definition: SensorModels.h:30
virtual bool isEvent(const char *tag, const char *action, ShieldEvent *shieldEvent)
Determines whether the specified shieldEvent matches the tag and action.
Definition: Sensor.cpp:128
const PROGMEM char ATTACHMENT[]
Definition: Sensor.h:41
VirtualShield & shield
Definition: Sensor.h:55
const PROGMEM char URL[]
Definition: Sensor.h:48
int start(double delta=0, long interval=0)
Starts the sensor, triggered when longer than the interval and larger than the delta.
Definition: Sensor.cpp:51
SensorEvent()
Initializes a new instance of the SensorEvent struct.
Definition: Sensor.cpp:204
const PROGMEM char ENABLE[]
Definition: Sensor.h:42
Sensor * sensor
Definition: Sensor.h:92
const PROGMEM char MS[]
Definition: Sensor.h:39
const PROGMEM char AUDIO[]
Definition: Sensor.h:47
ShieldEvent recentEvent
Definition: Sensor.h:56
bool isUpdated()
Determines whether this sensor has an updated value. Resets to false after this call.
Definition: Sensor.cpp:112
Sensor(const VirtualShield &shield, const char sensorType)
Initializes a new instance of the Sensor class.
Definition: Sensor.cpp:42
Definition: SensorModels.h:101
int sendStop(const char *serviceName)
Definition: Sensor.cpp:195
const PROGMEM char TAG[]
Definition: Sensor.h:45
const PROGMEM char STOP[]
Definition: Sensor.h:49
Definition: ShieldEvent.h:35
bool _isUpdated
Definition: Sensor.h:86
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...
Definition: Sensor.cpp:161
const PROGMEM char MESSAGE[]
Definition: Sensor.h:38
void setOnEvent(void(*onEvent)(ShieldEvent *shieldEvent))
Definition: Sensor.h:76
int writeAll(const char *serviceName, EPtr values[], int count, Attr extraAttributes[]=0, int extraAttributeCount=0)
Writes all EPtr values to the communication channel.
Definition: Sensor.cpp:150
bool isRunning
Definition: Sensor.h:59
virtual void onJsonReceived(JsonObject &root, ShieldEvent *shieldEvent)
Event called when a valid json message was received. Consumes the proper values for this sensor...
Definition: Sensor.cpp:92
const PROGMEM char DISABLE[]
Definition: Sensor.h:43