WIP.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
{
|
||||
"active": true,
|
||||
"id": "Sprinklers/7",
|
||||
"start_time": "22:38",
|
||||
"start_time": "15:50",
|
||||
"recurrence": 0,
|
||||
"duration": 1,
|
||||
"action": "stop"
|
||||
|
||||
@@ -30,6 +30,7 @@ file(
|
||||
../../src/ubus/capabilities_shutters.cpp
|
||||
../../src/ubus/capabilities_sprinklers.cpp
|
||||
../../src/ubus/speach_command.cpp
|
||||
../../src/ubus/timers.cpp
|
||||
../../src/helpers/Tokenizer.cpp
|
||||
../../src/helpers/Strings.cpp
|
||||
../../src/main.cpp
|
||||
|
||||
@@ -37,6 +37,7 @@ extern "C" {
|
||||
#include "ubus/capabilities_shutters.h"
|
||||
#include "ubus/capabilities_sprinklers.h"
|
||||
#include "ubus/speach_command.h"
|
||||
#include "ubus/timers.h"
|
||||
|
||||
#include "timers/Timers.h"
|
||||
#include "devices/Devices.h"
|
||||
@@ -114,19 +115,6 @@ int main (void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
Capabilities theCapabilities;
|
||||
CapabilitiesLights theCapLights (&theDevices);
|
||||
CapabilitiesShutters theCapShutters (&theDevices);
|
||||
CapabilitiesSprinklers theCapSprinklers (&theDevices);
|
||||
SpeachCommand theSpeachCommand (&theDevices);
|
||||
|
||||
/* Setup the Ubus context. */
|
||||
theCtx = setupUbus ();
|
||||
if (theCtx == NULL) {
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Setup the Timers. */
|
||||
Timers theTimers (theTimerPath, &theDevices);
|
||||
|
||||
@@ -135,12 +123,30 @@ int main (void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Setup the UBus Models. */
|
||||
CapabilitiesModel theCapabilities;
|
||||
CapabilitiesLightsModel theCapLights (&theDevices);
|
||||
CapabilitiesShuttersModel theCapShutters (&theDevices);
|
||||
CapabilitiesSprinklersModel theCapSprinklers (&theDevices);
|
||||
SpeachCommandModel theSpeachCommand (&theDevices);
|
||||
TimersModel theTimersModel;
|
||||
|
||||
/* Setup the Ubus context. */
|
||||
theCtx = setupUbus ();
|
||||
if (theCtx == NULL) {
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Add the UBus to the model exposed. */
|
||||
ubus_add_object (theCtx, &theCapabilities);
|
||||
ubus_add_object (theCtx, &theCapLights);
|
||||
ubus_add_object (theCtx, &theCapShutters);
|
||||
ubus_add_object (theCtx, &theCapSprinklers);
|
||||
ubus_add_object (theCtx, &theSpeachCommand);
|
||||
ubus_add_object (theCtx, &theTimersModel);
|
||||
|
||||
/* Main Event Loop. */
|
||||
uloop_run ();
|
||||
|
||||
@@ -40,30 +40,30 @@ namespace {
|
||||
|
||||
using namespace UBus;
|
||||
|
||||
static ObjectType gCapabilitiesUbus_types(
|
||||
static ObjectType gCapabilitiesModelUbus_types(
|
||||
"capabilities",
|
||||
Method("get", UBUS_CPP(Capabilities, Get))
|
||||
Method("get", UBUS_CPP(CapabilitiesModel, Get))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn Capabilities
|
||||
* @fn CapabilitiesModel
|
||||
*
|
||||
* @brief Constructor of the UBus Mixer Volume.
|
||||
*/
|
||||
Capabilities::Capabilities (void) :
|
||||
UBusObject (gCapabilitiesUbus_types, "domo.capabilities")
|
||||
CapabilitiesModel::CapabilitiesModel (void) :
|
||||
UBusObject (gCapabilitiesModelUbus_types, "domo.capabilities")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn ~Capabilities
|
||||
* @fn ~CapabilitiesModel
|
||||
*
|
||||
* @brief Destructor of the UBus Mixer Volume.
|
||||
*/
|
||||
Capabilities::~Capabilities (void)
|
||||
CapabilitiesModel::~CapabilitiesModel (void)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -74,7 +74,7 @@ Capabilities::~Capabilities (void)
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int Capabilities::Get (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
int CapabilitiesModel::Get (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
struct blob_attr *aMsg)
|
||||
{
|
||||
int theResult;
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _UBUS_CAPABILITIES_H
|
||||
#define _UBUS_CAPABILITIES_H
|
||||
#ifndef _UBUS_CAPABILITIES_MODEL_H
|
||||
#define _UBUS_CAPABILITIES_MODEL_H
|
||||
|
||||
/*------------------------------- INCLUDES ----------------------------------*/
|
||||
|
||||
@@ -36,15 +36,15 @@
|
||||
|
||||
/*--------------------------------- CLASS ----------------------------------*/
|
||||
|
||||
class Capabilities : public UBusObject {
|
||||
class CapabilitiesModel : public UBusObject {
|
||||
|
||||
public:
|
||||
Capabilities (void);
|
||||
~Capabilities (void);
|
||||
CapabilitiesModel (void);
|
||||
~CapabilitiesModel (void);
|
||||
|
||||
int Get (struct ubus_context*, struct ubus_request_data*, struct blob_attr*);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* _UBUS_CAPABILITIES_H */
|
||||
#endif /* _UBUS_CAPABILITIES_MODEL_H */
|
||||
|
||||
@@ -43,20 +43,20 @@ using namespace UBus;
|
||||
|
||||
static ObjectType gCapabilitiesLightsUbus_types(
|
||||
"lights",
|
||||
Method("get", UBUS_CPP(CapabilitiesLights, Get)),
|
||||
Method("delete", UBUS_CPP(CapabilitiesLights, Delete)),
|
||||
Method("put", UBUS_CPP(CapabilitiesLights, Put)),
|
||||
Method("post", UBUS_CPP(CapabilitiesLights, Post))
|
||||
Method("get", UBUS_CPP(CapabilitiesLightsModel, Get)),
|
||||
Method("delete", UBUS_CPP(CapabilitiesLightsModel, Delete)),
|
||||
Method("put", UBUS_CPP(CapabilitiesLightsModel, Put)),
|
||||
Method("post", UBUS_CPP(CapabilitiesLightsModel, Post))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn CapabilitiesLights
|
||||
* @fn CapabilitiesLightsModel
|
||||
*
|
||||
* @brief Constructor of the UBus Mixer Volume.
|
||||
*/
|
||||
CapabilitiesLights::CapabilitiesLights (Devices *aDevice) :
|
||||
CapabilitiesLightsModel::CapabilitiesLightsModel (Devices *aDevice) :
|
||||
UBusObject (gCapabilitiesLightsUbus_types, "domo.capabilities.lights"),
|
||||
mDevices (aDevice)
|
||||
{
|
||||
@@ -64,11 +64,11 @@ CapabilitiesLights::CapabilitiesLights (Devices *aDevice) :
|
||||
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn ~CapabilitiesLights
|
||||
* @fn ~CapabilitiesLightsModel
|
||||
*
|
||||
* @brief Destructor of the UBus Mixer Volume.
|
||||
*/
|
||||
CapabilitiesLights::~CapabilitiesLights (void)
|
||||
CapabilitiesLightsModel::~CapabilitiesLightsModel (void)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -79,7 +79,7 @@ CapabilitiesLights::~CapabilitiesLights (void)
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesLights::Get (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
int CapabilitiesLightsModel::Get (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
struct blob_attr *aMsg)
|
||||
{
|
||||
int theResult;
|
||||
@@ -102,7 +102,7 @@ int CapabilitiesLights::Get (struct ubus_context *aCtx, struct ubus_request_data
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesLights::Delete (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesLightsModel::Delete (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
|
||||
@@ -115,7 +115,7 @@ int CapabilitiesLights::Delete (struct ubus_context*, struct ubus_request_data*,
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesLights::Put (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesLightsModel::Put (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
|
||||
@@ -128,7 +128,7 @@ int CapabilitiesLights::Put (struct ubus_context*, struct ubus_request_data*, st
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesLights::Post (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
int CapabilitiesLightsModel::Post (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
struct blob_attr *aMsg)
|
||||
{
|
||||
int theResult = 0;
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _UBUS_CAPABILITIES_LIGHTS_H
|
||||
#define _UBUS_CAPABILITIES_LIGHTS_H
|
||||
#ifndef _UBUS_CAPABILITIES_LIGHTS_MODEL_H
|
||||
#define _UBUS_CAPABILITIES_LIGHTS_MODEL_H
|
||||
|
||||
/*------------------------------- INCLUDES ----------------------------------*/
|
||||
|
||||
@@ -41,11 +41,11 @@ class Devices;
|
||||
|
||||
/*--------------------------------- CLASS ----------------------------------*/
|
||||
|
||||
class CapabilitiesLights : public UBusObject {
|
||||
class CapabilitiesLightsModel : public UBusObject {
|
||||
|
||||
public:
|
||||
CapabilitiesLights (Devices *aDevice);
|
||||
~CapabilitiesLights (void);
|
||||
CapabilitiesLightsModel (Devices *aDevice);
|
||||
~CapabilitiesLightsModel (void);
|
||||
|
||||
int Get (struct ubus_context*, struct ubus_request_data*, struct blob_attr*);
|
||||
int Delete (struct ubus_context*, struct ubus_request_data*, struct blob_attr*);
|
||||
@@ -56,4 +56,4 @@ private:
|
||||
Devices *mDevices;
|
||||
};
|
||||
|
||||
#endif /* _UBUS_CAPABILITIES_LIGHTS_H */
|
||||
#endif /* _UBUS_CAPABILITIES_LIGHTS_MODEL_H */
|
||||
|
||||
@@ -39,42 +39,42 @@ namespace {
|
||||
|
||||
using namespace UBus;
|
||||
|
||||
static ObjectType gCapabilitiesShuttersUbus_types(
|
||||
static ObjectType gCapabilitiesShuttersModelUbus_types(
|
||||
"shutters",
|
||||
Method("get", UBUS_CPP(CapabilitiesShutters, Get)),
|
||||
Method("delete", UBUS_CPP(CapabilitiesShutters, Delete)),
|
||||
Method("put", UBUS_CPP(CapabilitiesShutters, Put)),
|
||||
Method("post", UBUS_CPP(CapabilitiesShutters, Post)),
|
||||
Method("get", UBUS_CPP(CapabilitiesShuttersModel, Get)),
|
||||
Method("delete", UBUS_CPP(CapabilitiesShuttersModel, Delete)),
|
||||
Method("put", UBUS_CPP(CapabilitiesShuttersModel, Put)),
|
||||
Method("post", UBUS_CPP(CapabilitiesShuttersModel, Post)),
|
||||
|
||||
Method("open", UBUS_CPP(CapabilitiesShutters, Open)),
|
||||
Method("close", UBUS_CPP(CapabilitiesShutters, Close)),
|
||||
Method("open", UBUS_CPP(CapabilitiesShuttersModel, Open)),
|
||||
Method("close", UBUS_CPP(CapabilitiesShuttersModel, Close)),
|
||||
|
||||
Method("up", UBUS_CPP(CapabilitiesShutters, Up)),
|
||||
Method("down", UBUS_CPP(CapabilitiesShutters, Down)),
|
||||
Method("up", UBUS_CPP(CapabilitiesShuttersModel, Up)),
|
||||
Method("down", UBUS_CPP(CapabilitiesShuttersModel, Down)),
|
||||
|
||||
Method("position", UBUS_CPP(CapabilitiesShutters, Position))
|
||||
Method("position", UBUS_CPP(CapabilitiesShuttersModel, Position))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn CapabilitiesShutters
|
||||
* @fn CapabilitiesShuttersModel
|
||||
*
|
||||
* @brief Constructor of the UBus Mixer Volume.
|
||||
*/
|
||||
CapabilitiesShutters::CapabilitiesShutters (Devices *aDevice) :
|
||||
UBusObject (gCapabilitiesShuttersUbus_types, "domo.capabilities.shutters"),
|
||||
CapabilitiesShuttersModel::CapabilitiesShuttersModel (Devices *aDevice) :
|
||||
UBusObject (gCapabilitiesShuttersModelUbus_types, "domo.capabilities.shutters"),
|
||||
mDevices (aDevice)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn ~CapabilitiesShutters
|
||||
* @fn ~CapabilitiesShuttersModel
|
||||
*
|
||||
* @brief Destructor of the UBus Mixer Volume.
|
||||
*/
|
||||
CapabilitiesShutters::~CapabilitiesShutters (void)
|
||||
CapabilitiesShuttersModel::~CapabilitiesShuttersModel (void)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -85,7 +85,7 @@ CapabilitiesShutters::~CapabilitiesShutters (void)
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesShutters::Get (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
int CapabilitiesShuttersModel::Get (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
struct blob_attr *aMsg)
|
||||
{
|
||||
int theResult;
|
||||
@@ -108,7 +108,7 @@ int CapabilitiesShutters::Get (struct ubus_context *aCtx, struct ubus_request_da
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesShutters::Delete (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesShuttersModel::Delete (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
|
||||
@@ -121,7 +121,7 @@ int CapabilitiesShutters::Delete (struct ubus_context*, struct ubus_request_data
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesShutters::Put (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesShuttersModel::Put (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
|
||||
@@ -134,7 +134,7 @@ int CapabilitiesShutters::Put (struct ubus_context*, struct ubus_request_data*,
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesShutters::Post (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesShuttersModel::Post (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
|
||||
@@ -147,7 +147,7 @@ int CapabilitiesShutters::Post (struct ubus_context*, struct ubus_request_data*,
|
||||
*
|
||||
* @brief Open the Shutter
|
||||
*/
|
||||
int CapabilitiesShutters::Open (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesShuttersModel::Open (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
printf ("Open the Shutter\n");
|
||||
@@ -160,7 +160,7 @@ int CapabilitiesShutters::Open (struct ubus_context*, struct ubus_request_data*,
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesShutters::Close (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesShuttersModel::Close (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
printf ("Close the Shutter\n");
|
||||
@@ -172,7 +172,7 @@ int CapabilitiesShutters::Close (struct ubus_context*, struct ubus_request_data*
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesShutters::Up (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesShuttersModel::Up (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
printf ("Up the Shutter\n");
|
||||
@@ -184,7 +184,7 @@ int CapabilitiesShutters::Up (struct ubus_context*, struct ubus_request_data*, s
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesShutters::Down (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesShuttersModel::Down (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
printf ("Down the Shutter\n");
|
||||
@@ -196,7 +196,7 @@ int CapabilitiesShutters::Down (struct ubus_context*, struct ubus_request_data*,
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesShutters::Position (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesShuttersModel::Position (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
printf ("Position the Shutter\n");
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _UBUS_CAPABILITIES_SHUTTERS_H
|
||||
#define _UBUS_CAPABILITIES_SHUTTERS_H
|
||||
#ifndef _UBUS_CAPABILITIES_SHUTTERS_MODEL_H
|
||||
#define _UBUS_CAPABILITIES_SHUTTERS_MODEL_H
|
||||
|
||||
/*------------------------------- INCLUDES ----------------------------------*/
|
||||
|
||||
@@ -38,11 +38,11 @@ class Devices;
|
||||
|
||||
/*--------------------------------- CLASS ----------------------------------*/
|
||||
|
||||
class CapabilitiesShutters : public UBusObject {
|
||||
class CapabilitiesShuttersModel : public UBusObject {
|
||||
|
||||
public:
|
||||
CapabilitiesShutters (Devices *aDevice);
|
||||
~CapabilitiesShutters (void);
|
||||
CapabilitiesShuttersModel (Devices *aDevice);
|
||||
~CapabilitiesShuttersModel (void);
|
||||
|
||||
int Get (struct ubus_context*, struct ubus_request_data*, struct blob_attr*);
|
||||
int Delete (struct ubus_context*, struct ubus_request_data*, struct blob_attr*);
|
||||
@@ -61,4 +61,4 @@ private:
|
||||
Devices *mDevices;
|
||||
};
|
||||
|
||||
#endif /* _UBUS_CAPABILITIES_SHUTTERS_H */
|
||||
#endif /* _UBUS_CAPABILITIES_SHUTTERS_MODEL_H */
|
||||
|
||||
@@ -41,12 +41,12 @@ namespace {
|
||||
|
||||
using namespace UBus;
|
||||
|
||||
static ObjectType gCapabilitiesSprinklersUbus_types(
|
||||
static ObjectType gCapabilitiesSprinklersModelUbus_types(
|
||||
"sprinklers",
|
||||
Method("get", UBUS_CPP(CapabilitiesSprinklers, Get)),
|
||||
Method("delete", UBUS_CPP(CapabilitiesSprinklers, Delete)),
|
||||
Method("put", UBUS_CPP(CapabilitiesSprinklers, Put)),
|
||||
Method("post", UBUS_CPP(CapabilitiesSprinklers, Post))
|
||||
Method("get", UBUS_CPP(CapabilitiesSprinklersModel, Get)),
|
||||
Method("delete", UBUS_CPP(CapabilitiesSprinklersModel, Delete)),
|
||||
Method("put", UBUS_CPP(CapabilitiesSprinklersModel, Put)),
|
||||
Method("post", UBUS_CPP(CapabilitiesSprinklersModel, Post))
|
||||
);
|
||||
|
||||
}
|
||||
@@ -56,19 +56,19 @@ static ObjectType gCapabilitiesSprinklersUbus_types(
|
||||
*
|
||||
* @brief Constructor of the UBus Mixer Volume.
|
||||
*/
|
||||
CapabilitiesSprinklers::CapabilitiesSprinklers (Devices *aDevice) :
|
||||
UBusObject (gCapabilitiesSprinklersUbus_types, "domo.capabilities.sprinklers"),
|
||||
CapabilitiesSprinklersModel::CapabilitiesSprinklersModel (Devices *aDevice) :
|
||||
UBusObject (gCapabilitiesSprinklersModelUbus_types, "domo.capabilities.sprinklers"),
|
||||
mDevices (aDevice)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn ~CapabilitiesSprinklers
|
||||
* @fn ~CapabilitiesSprinklersModel
|
||||
*
|
||||
* @brief Destructor of the UBus Mixer Volume.
|
||||
*/
|
||||
CapabilitiesSprinklers::~CapabilitiesSprinklers (void)
|
||||
CapabilitiesSprinklersModel::~CapabilitiesSprinklersModel (void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ CapabilitiesSprinklers::~CapabilitiesSprinklers (void)
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesSprinklers::Get (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
int CapabilitiesSprinklersModel::Get (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
struct blob_attr *aMsg)
|
||||
{
|
||||
int theResult;
|
||||
@@ -101,7 +101,7 @@ int CapabilitiesSprinklers::Get (struct ubus_context *aCtx, struct ubus_request_
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesSprinklers::Delete (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesSprinklersModel::Delete (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
|
||||
@@ -114,7 +114,7 @@ int CapabilitiesSprinklers::Delete (struct ubus_context*, struct ubus_request_da
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesSprinklers::Put (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
int CapabilitiesSprinklersModel::Put (struct ubus_context*, struct ubus_request_data*, struct blob_attr*)
|
||||
{
|
||||
int theResult = 0;
|
||||
|
||||
@@ -127,7 +127,7 @@ int CapabilitiesSprinklers::Put (struct ubus_context*, struct ubus_request_data*
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int CapabilitiesSprinklers::Post (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
int CapabilitiesSprinklersModel::Post (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
struct blob_attr *aMsg)
|
||||
{
|
||||
int theResult;
|
||||
@@ -140,7 +140,7 @@ int CapabilitiesSprinklers::Post (struct ubus_context *aCtx, struct ubus_request
|
||||
Json::Value theElement;
|
||||
int theID;
|
||||
bool theState;
|
||||
fprintf (stderr,"CapabilitiesSprinklers::Post \n");
|
||||
fprintf (stderr,"CapabilitiesSprinklersModel::Post \n");
|
||||
|
||||
if (!theReader.parse (theString, theRoot)) {
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _UBUS_CAPABILITIES_SPRINKLERS_H
|
||||
#define _UBUS_CAPABILITIES_SPRINKLERS_H
|
||||
#ifndef _UBUS_CAPABILITIES_SPRINKLERS_MODEL_H
|
||||
#define _UBUS_CAPABILITIES_SPRINKLERS_MODEL_H
|
||||
|
||||
/*------------------------------- INCLUDES ----------------------------------*/
|
||||
|
||||
@@ -38,11 +38,11 @@ class Devices;
|
||||
|
||||
/*--------------------------------- CLASS ----------------------------------*/
|
||||
|
||||
class CapabilitiesSprinklers : public UBusObject {
|
||||
class CapabilitiesSprinklersModel : public UBusObject {
|
||||
|
||||
public:
|
||||
CapabilitiesSprinklers (Devices *aDevice);
|
||||
~CapabilitiesSprinklers (void);
|
||||
CapabilitiesSprinklersModel (Devices *aDevice);
|
||||
~CapabilitiesSprinklersModel (void);
|
||||
|
||||
int Get (struct ubus_context*, struct ubus_request_data*, struct blob_attr*);
|
||||
int Delete (struct ubus_context*, struct ubus_request_data*, struct blob_attr*);
|
||||
@@ -53,4 +53,4 @@ private:
|
||||
Devices *mDevices;
|
||||
};
|
||||
|
||||
#endif /* _UBUS_CAPABILITIES_SPRINKLERS_H */
|
||||
#endif /* _UBUS_CAPABILITIES_SPRINKLERS_MODEL_H */
|
||||
|
||||
@@ -44,31 +44,31 @@ namespace {
|
||||
|
||||
using namespace UBus;
|
||||
|
||||
static ObjectType gSpeachCommandUbus_types(
|
||||
static ObjectType gSpeachCommandModelUbus_types(
|
||||
"speach",
|
||||
Method("post", UBUS_CPP(SpeachCommand, Post))
|
||||
Method("post", UBUS_CPP(SpeachCommandModel, Post))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn SpeachCommand
|
||||
* @fn SpeachCommandModel
|
||||
*
|
||||
* @brief Constructor of the UBus Speach Command execution.
|
||||
*/
|
||||
SpeachCommand::SpeachCommand (Devices *aDevice) :
|
||||
UBusObject (gSpeachCommandUbus_types, "domo.speach.command"),
|
||||
SpeachCommandModel::SpeachCommandModel (Devices *aDevice) :
|
||||
UBusObject (gSpeachCommandModelUbus_types, "domo.speach.command"),
|
||||
mDevices (aDevice)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn ~SpeachCommand
|
||||
* @fn ~SpeachCommandModel
|
||||
*
|
||||
* @brief Destructor of the UBus Speach Command execution.
|
||||
*/
|
||||
SpeachCommand::~SpeachCommand (void)
|
||||
SpeachCommandModel::~SpeachCommandModel (void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ SpeachCommand::~SpeachCommand (void)
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int SpeachCommand::Post (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
int SpeachCommandModel::Post (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
struct blob_attr *aMsg)
|
||||
{
|
||||
int theResult = 0;
|
||||
@@ -121,7 +121,7 @@ int SpeachCommand::Post (struct ubus_context *aCtx, struct ubus_request_data *aR
|
||||
*
|
||||
* @brief analyse and Execute the following commmand.
|
||||
*/
|
||||
int SpeachCommand::AnalyseAndExecute (std::string aCommand)
|
||||
int SpeachCommandModel::AnalyseAndExecute (std::string aCommand)
|
||||
{
|
||||
std::vector <std::string> theTokens;
|
||||
Tokenizer s(aCommand, " ");
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _UBUS_SPEACH_COMMANDS_H
|
||||
#define _UBUS_SPEACH_COMMANDS_H
|
||||
#ifndef _UBUS_SPEACH_COMMANDS_MODEL_H
|
||||
#define _UBUS_SPEACH_COMMANDS_MODEL_H
|
||||
|
||||
/*------------------------------- INCLUDES ----------------------------------*/
|
||||
|
||||
@@ -41,11 +41,11 @@ class Devices;
|
||||
|
||||
/*--------------------------------- CLASS ----------------------------------*/
|
||||
|
||||
class SpeachCommand : public UBusObject {
|
||||
class SpeachCommandModel : public UBusObject {
|
||||
|
||||
public:
|
||||
SpeachCommand (Devices *aDevice);
|
||||
~SpeachCommand (void);
|
||||
SpeachCommandModel (Devices *aDevice);
|
||||
~SpeachCommandModel (void);
|
||||
|
||||
int Post (struct ubus_context*, struct ubus_request_data*, struct blob_attr*);
|
||||
|
||||
@@ -54,4 +54,4 @@ private:
|
||||
Devices *mDevices;
|
||||
};
|
||||
|
||||
#endif /* _UBUS_SPEACH_COMMANDS_H */
|
||||
#endif /* _UBUS_SPEACH_COMMANDS_MODEL_H */
|
||||
|
||||
93
src/domod/src/ubus/timers.cpp
Normal file
93
src/domod/src/ubus/timers.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
/*!
|
||||
* TimersModel.cpp
|
||||
*
|
||||
* Copyright (c) 2016, NADAL Jean-Baptiste. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*
|
||||
* @Author: NADAL Jean-Baptiste
|
||||
* @Date: 02/07/2016
|
||||
*
|
||||
*/
|
||||
|
||||
/*-------------------------------- INCLUDES ---------------------------------*/
|
||||
|
||||
extern "C" {
|
||||
#include <libubox/blobmsg_json.h>
|
||||
}
|
||||
|
||||
#include "timers.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace UBus;
|
||||
|
||||
static ObjectType gTimersModelUbus_types(
|
||||
"TimersModel",
|
||||
Method("get", UBUS_CPP(TimersModel, Get))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn TimersModel
|
||||
*
|
||||
* @brief Constructor of the UBus Mixer Volume.
|
||||
*/
|
||||
TimersModel::TimersModel (void) :
|
||||
UBusObject (gTimersModelUbus_types, "domo.timers")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn ~TimersModel
|
||||
*
|
||||
* @brief Destructor of the UBus Mixer Volume.
|
||||
*/
|
||||
TimersModel::~TimersModel (void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*! ----------------------------------------------------------------------------
|
||||
* @fn Get
|
||||
*
|
||||
* @brief Get the List of the Capabilities.
|
||||
*/
|
||||
int TimersModel::Get (struct ubus_context *aCtx, struct ubus_request_data *aReq,
|
||||
struct blob_attr *aMsg)
|
||||
{
|
||||
int theResult = 0;
|
||||
printf ("Get the TimersModel\n");
|
||||
#if 0
|
||||
struct blob_buf theBuf = {0};
|
||||
|
||||
std::ifstream theCapFile ("./rsc/capabilities.json");
|
||||
std::stringstream theBuffer;
|
||||
theBuffer << theCapFile.rdbuf();
|
||||
|
||||
blob_buf_init (&theBuf, 0);
|
||||
|
||||
blobmsg_add_json_from_string (&theBuf, theBuffer.str().c_str());
|
||||
|
||||
theResult = ubus_send_reply (aCtx, aReq, theBuf.head);
|
||||
|
||||
blob_buf_free (&theBuf);
|
||||
#endif
|
||||
return theResult;
|
||||
}
|
||||
50
src/domod/src/ubus/timers.h
Normal file
50
src/domod/src/ubus/timers.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*!
|
||||
* timers.h
|
||||
*
|
||||
* Copyright (c) 2016, NADAL Jean-Baptiste. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*
|
||||
* @Author: NADAL Jean-Baptiste
|
||||
* @Date: 02/07/2016
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _UBUS_TIMERS_H
|
||||
#define _UBUS_TIMERS_H
|
||||
|
||||
/*------------------------------- INCLUDES ----------------------------------*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <ubuscpp/UBusObject.h>
|
||||
|
||||
/*--------------------------------- Define ----------------------------------*/
|
||||
|
||||
/*--------------------------------- CLASS ----------------------------------*/
|
||||
|
||||
class TimersModel : public UBusObject {
|
||||
|
||||
public:
|
||||
TimersModel (void);
|
||||
~TimersModel (void);
|
||||
|
||||
int Get (struct ubus_context*, struct ubus_request_data*, struct blob_attr*);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* _UBUS_TIMERS_H */
|
||||
Reference in New Issue
Block a user