From 4b7697dec9092f3a1671d1e809fd11b536b873a2 Mon Sep 17 00:00:00 2001 From: Lionel AINS Date: Thu, 21 Nov 2019 17:16:45 +0100 Subject: [PATCH] Adding class GpDevice --- src/domain/zbmessage/green-power-device.cpp | 25 +++++++++ src/domain/zbmessage/green-power-device.h | 58 +++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 src/domain/zbmessage/green-power-device.cpp create mode 100644 src/domain/zbmessage/green-power-device.h diff --git a/src/domain/zbmessage/green-power-device.cpp b/src/domain/zbmessage/green-power-device.cpp new file mode 100644 index 00000000..53bb099c --- /dev/null +++ b/src/domain/zbmessage/green-power-device.cpp @@ -0,0 +1,25 @@ +/** + * @file green-power-device.cpp + * + * @brief Represents data for a green power device + */ + +#include "green-power-device.h" + +CGpDevice::CGpDevice(uint32_t i_source_id, const EmberKeyData& i_key) : + source_id(i_source_id), + key(i_key) +{ +} + +uint32_t CGpDevice::getSourceId() const +{ + return this->source_id; +} + +EmberKeyData CGpDevice::getKey() const +{ + return this->key; +} + +const EmberKeyData CGpDevice::UNKNOWN_KEY({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}); diff --git a/src/domain/zbmessage/green-power-device.h b/src/domain/zbmessage/green-power-device.h new file mode 100644 index 00000000..692520d7 --- /dev/null +++ b/src/domain/zbmessage/green-power-device.h @@ -0,0 +1,58 @@ +/** + * @file green-power-device.h + * + * @brief Represents data for a green power device + */ + +#pragma once + +#include +#include "../ezsp-protocol/ezsp-enum.h" + +/** + * @brief Class to encapsulate data representing a green power device + */ +class CGpDevice +{ + public: + static const EmberKeyData UNKNOWN_KEY; + + /** + * @brief Default constructor + * + * Construction without arguments is not allowed + */ + CGpDevice() = delete; + + /** + * @brief Constructor with minimal parameter + * @param i_source_id : source id of gpd + * @param i_key : key used by the GP device + */ + CGpDevice(uint32_t i_source_id, const EmberKeyData& i_key); + + /** + * @brief Assignment operator + * + * Copy construction is forbidden on this class + */ + CGpDevice& operator=(const CGpDevice& other) = delete; + + /** + * @brief Retrieve the source id for this device + * + * @return The source ID + */ + uint32_t getSourceId() const; + + /** + * @brief Retrieve the key for this device + * + * @return The key + */ + EmberKeyData getKey() const; + + private: + uint32_t source_id; /*!< The source ID for this device */ + EmberKeyData key; /*!< The key for this device */ +};