SinricPro Library
MotionEventSource.h
1 #ifndef _MOTIONEVENTSOURCE_H_
2 #define _MOTIONEVENTSOURCE_H_
3 
8 template <typename T>
10  public:
11  bool sendMotionEvent(bool detected, String cause = "PHYSICAL_INTERACTION");
12 };
13 
23 template <typename T>
24 bool MotionEventSource<T>::sendMotionEvent(bool detected, String cause) {
25  T& device = static_cast<T&>(*this);
26 
27  DynamicJsonDocument eventMessage = device.prepareEvent("motion", cause.c_str());
28  JsonObject event_value = eventMessage["payload"]["value"];
29  event_value["state"] = detected ? "detected" : "notDetected";
30  return device.sendEvent(eventMessage);
31 }
32 
33 #endif
MotionEventSource.
Definition: MotionEventSource.h:9
bool sendMotionEvent(bool detected, String cause="PHYSICAL_INTERACTION")
Sending motion detection state to SinricPro server.
Definition: MotionEventSource.h:24