This commit is contained in:
jbnadal
2018-05-04 18:28:07 +02:00
parent f6e57c671e
commit bd48ef0866
5 changed files with 59 additions and 4 deletions

View File

@@ -51,13 +51,12 @@ LightDevice::~LightDevice(void)
{
}
/*! ----------------------------------------------------------------------------
* @fn operator[]
*
* @brief to access to a specific light opbject.
* @brief to access to a specific light object.
*/
Light& LightDevice::operator[] (int a_pos)
Light& LightDevice::operator[](int a_pos)
{
return m_lights[a_pos];
}

View File

@@ -41,7 +41,7 @@ class LightDevice : public Device
LightDevice(void);
~LightDevice(void);
Light& operator[] (int a_pos);
Light& operator[](int a_pos);
uint16_t size(void);

View File

@@ -51,6 +51,50 @@ ShutterDevice::~ShutterDevice(void)
{
}
/*! ----------------------------------------------------------------------------
* @fn operator[]
*
* @brief to access to a specific shutter object.
*/
Shutter& ShutterDevice::operator[] (int a_pos)
{
return m_shutters[a_pos];
}
/*! ----------------------------------------------------------------------------
* @fn size
*
* @brief return the size of the shutter devices.
*/
uint16_t ShutterDevice::size(void)
{
return m_shutters.size();
}
/*! ----------------------------------------------------------------------------
* @fn size
*
* @brief return the size of the light devices.
*/
int ShutterDevice::find(int a_pos)
{
std::vector<Shutter>::iterator the_shutter_it;
int the_status = -1;
int the_pos = 0;
for (the_shutter_it = m_shutters.begin(); the_shutter_it != m_shutters.end(); the_shutter_it++)
{
if ((*the_shutter_it).get_id() == a_pos)
{
return the_pos;
}
the_pos++;
}
return the_status;
}
/*! ----------------------------------------------------------------------------
* @fn from_json
*

View File

@@ -41,6 +41,12 @@ class ShutterDevice : public Device
ShutterDevice(void);
~ShutterDevice(void);
Shutter& operator[](int a_pos);
uint16_t size(void);
int find(int a_pos);
int from_json(struct json_object *a_node);
struct json_object *to_json(void);

View File

@@ -42,6 +42,12 @@ class SprinklerDevice : public Device
SprinklerDevice(void);
~SprinklerDevice(void);
Sprinkler& operator[](int a_pos);
uint16_t size(void);
int find(int a_pos);
int from_json(struct json_object *a_node);
struct json_object *to_json(void);