Skip to content

Commit

Permalink
Adding class GpDevice
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel AINS committed Nov 21, 2019
1 parent 6f70238 commit 4b7697d
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/domain/zbmessage/green-power-device.cpp
Original file line number Diff line number Diff line change
@@ -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});
58 changes: 58 additions & 0 deletions src/domain/zbmessage/green-power-device.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* @file green-power-device.h
*
* @brief Represents data for a green power device
*/

#pragma once

#include <cstdint>
#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 */
};

0 comments on commit 4b7697d

Please sign in to comment.