Skip to content

Add alias names for various server side used "property types" #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extras/test/src/test_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "types/automation/CloudMotionSensor.h"
#include "types/automation/CloudSmartPlug.h"
#include "types/automation/CloudSwitch.h"
#include "types/automation/CloudTemperature.h"
#include "types/automation/CloudTemperatureSensor.h"
#include "types/automation/CloudTelevision.h"

/**************************************************************************************
Expand Down Expand Up @@ -368,7 +368,7 @@ SCENARIO("Arduino Cloud Properties are decoded", "[ArduinoCloudThing::decode]")
{
PropertyContainer property_container;

CloudTemperature test;
CloudTemperatureSensor test;
test = 0.0f;
addPropertyToContainer(property_container, test, "test", Permission::ReadWrite);

Expand Down
33 changes: 32 additions & 1 deletion src/property/PropertyContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "types/automation/CloudMotionSensor.h"
#include "types/automation/CloudSmartPlug.h"
#include "types/automation/CloudSwitch.h"
#include "types/automation/CloudTemperature.h"
#include "types/automation/CloudTemperatureSensor.h"
#include "types/automation/CloudTelevision.h"

/******************************************************************************
Expand All @@ -58,6 +58,37 @@ extern "C" unsigned long getTime();

typedef std::list<Property *> PropertyContainer;

typedef CloudFloat CloudEnergy;
typedef CloudFloat CloudForce;
typedef CloudFloat CloudTemperature;
typedef CloudFloat CloudPower;
typedef CloudFloat CloudElectricCurrent;
typedef CloudFloat CloudElectricPotention;
typedef CloudFloat CloudElectricResistance;
typedef CloudFloat CloudCapacitance;
typedef CloudFloat CloudTime;
typedef CloudFloat CloudFrequency;
typedef CloudFloat CloudDataRate;
typedef CloudFloat CloudHeartRate;
typedef CloudInt CloudCounter;
typedef CloudFloat CloudAcceleration;
typedef CloudFloat CloudArea;
typedef CloudFloat CloudLenght;
typedef CloudFloat CloudVelocity;
typedef CloudFloat CloudMass;
typedef CloudFloat CloudVolume;
typedef CloudFloat CloudFlowRate;
typedef CloudFloat CloudAngle;
typedef CloudFloat CloudIlluminance;
typedef CloudFloat CloudLuminousFlux;
typedef CloudFloat CloudLuminance;
typedef CloudFloat CloudLuminousIntensity;
typedef CloudFloat CloudLogarithmicQuantity;
typedef CloudFloat CloudPressure;
typedef CloudInt CloudInformationContent;
typedef CloudFloat CloudPercentage;
typedef CloudFloat CloudRelativeHumidity;

/******************************************************************************
FUNCTION DECLARATION
******************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,28 @@
// a commercial license, send an email to [email protected].
//

#ifndef CLOUDTEMPERATURE_H_
#define CLOUDTEMPERATURE_H_
#ifndef CLOUD_TEMPERATURE_SENSOR_H_
#define CLOUD_TEMPERATURE_SENSOR_H_

/******************************************************************************
INCLUDE
******************************************************************************/

#include <Arduino.h>
#include "../CloudFloat.h"

/******************************************************************************
CLASS DECLARATION
******************************************************************************/



class CloudTemperature : public CloudFloat {
private:
class CloudTemperatureSensor : public CloudFloat
{
public:
CloudTemperature& operator=(float v) {

CloudTemperatureSensor & operator = (float v)
{
CloudFloat::operator=(v);
return *this;
}
};


#endif /* CLOUDTEMPERATURE_H_ */
#endif /* CLOUD_TEMPERATURE_SENSOR_H_ */