| LicenseSpring C++ SDK 7.32.0 Easily add Software Licensing to your application

Loading...
Searching...
No Matches
Public Member Functions | List of all members
LicenseSpring::DeviceVariable Class Reference

Class for storing key-value device variable. More...

`#include <LicenseSpring/DeviceVariable.h>`

## Public Member Functions
| DeviceVariable ()
| Default constructor, creates empty device variable.
| DeviceVariable (const std::string &name, const std::string &value)
| Constructs device variable with given name (key) and value.
| DeviceVariable (int64_t id, const std::string &name, const std::string &value, const std::string &dateTimeUpdated)
| Constructs device variable with given data.
bool | isEmpty () const
| Check if variable is considered empty.
int64_t | id () const
| Getter method for device variable id.
const std::string & | name () const
| Getter method for device variable name.
void | setName (const std::string &name)
| Setter method for device variable name.
const std::string & | value () const
| Getter method for device variable value.
void | setValue (const std::string &value)
| Setter method for device variable value.
tm | dateTimeUpdated () const
| Getter method for device variable date time when it was updated on the backend.
tm | dateTimeUpdatedUtc () const
| Getter method for device variable date time in UTC when it was updated on the backend.

## Detailed Description

Class for storing key-value device variable.

This class is in use for passing device variables to the backend (see License::sendDeviceVariables)

Definition at line 18 of file DeviceVariable.h.

## Constructor & Destructor Documentation

## ◆ DeviceVariable() [1/3]

LicenseSpring::DeviceVariable::DeviceVariable | ( |  | ) |

Default constructor, creates empty device variable.

## ◆ DeviceVariable() [2/3]

LicenseSpring::DeviceVariable::DeviceVariable | ( | const std::string & | name,
|  | const std::string & | value
| ) |  |

Constructs device variable with given name (key) and value.

To correctly send strings that contain Unicode characters, make sure the string is encoded in UTF-8,
for example: std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes( L"示例文本" )

Parameters

  name | Name (key) of key-value data field for device variable
  value | Value of key-value data field for device variable

## ◆ DeviceVariable() [3/3]

LicenseSpring::DeviceVariable::DeviceVariable | ( | int64_t | id,
|  | const std::string & | name,
|  | const std::string & | value,
|  | const std::string & | dateTimeUpdated
| ) |  |

Constructs device variable with given data.

To correctly send strings that contain Unicode characters, make sure the string is encoded in UTF-8,
for example: std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes( L"示例文本" )

Parameters

  id | Device variable identifier
  name | Name (key) of key-value data field for device variable
  value | Value of key-value data field for device variable
  dateTimeUpdated | Date of last update

## Member Function Documentation

## ◆ isEmpty()

bool LicenseSpring::DeviceVariable::isEmpty | ( |  | ) | const

Check if variable is considered empty.

Returns
  True if name or value is empty.

## ◆ id()

int64_t LicenseSpring::DeviceVariable::id | ( |  | ) | const
| inline

Getter method for device variable id.

This value is available after getting device variables data from the backend.

Returns
  DeviceVariable identifier.

Definition at line 48 of file DeviceVariable.h.

## ◆ name()

const std::string & LicenseSpring::DeviceVariable::name | ( |  | ) | const
| inline

Getter method for device variable name.

Returns
  DeviceVariable name in lowercase.

Definition at line 52 of file DeviceVariable.h.

## ◆ setName()

void LicenseSpring::DeviceVariable::setName | ( | const std::string & | name | ) |
| inline

Setter method for device variable name.

Parameters

  name | DeviceVariable name.

Definition at line 56 of file DeviceVariable.h.

## ◆ value()

const std::string & LicenseSpring::DeviceVariable::value | ( |  | ) | const
| inline

Getter method for device variable value.

Returns
  DeviceVariable value.

Definition at line 60 of file DeviceVariable.h.

## ◆ setValue()

void LicenseSpring::DeviceVariable::setValue | ( | const std::string & | value | ) |
| inline

Setter method for device variable value.

Parameters

  value | DeviceVariable value.

Definition at line 64 of file DeviceVariable.h.

## ◆ dateTimeUpdated()

tm LicenseSpring::DeviceVariable::dateTimeUpdated | ( |  | ) | const

Getter method for device variable date time when it was updated on the backend.

This value is available after getting device variables data from the backend.

Returns
  Last date time DeviceVariable was updated.

## ◆ dateTimeUpdatedUtc()

tm LicenseSpring::DeviceVariable::dateTimeUpdatedUtc | ( |  | ) | const

Getter method for device variable date time in UTC when it was updated on the backend.

This value is available after getting device variables data from the backend.

Returns
  Last date time in UTC DeviceVariable was updated.

The documentation for this class was generated from the following file:

- LicenseSpring/DeviceVariable.h