HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
inc/hanfun/common.h File Reference

This file contains the common defines for the HAN-FUN library. More...

#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <forward_list>
#include <functional>
#include <iterator>
#include <limits>
#include <list>
#include <memory>
#include <set>
#include <string>
#include <type_traits>
#include <vector>
#include <assert.h>
#include "hanfun/gcc.h"
#include "hanfun/version.h"
#include "hanfun/config.h"
+ Include dependency graph for inc/hanfun/common.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  HF::Common::ByteArray
 This class represents a byte array. More...
 
struct  HF::Common::Serializable
 This represents the common interface for message serialization. More...
 
struct  HF::Common::SerializableHelper< T, typename >
 Wrapper for classes that implement the Serializable concept. More...
 
struct  HF::Common::SerializableHelper< T, EnableIf(IsClassPointer(T))>
 Wrapper to pointers for classes that implement the Serializable concept. More...
 
struct  HF::Common::SerializableHelper< T, EnableIf(IsIntegral(T))>
 Wrapper for base integer types implementing the Serializable API. More...
 
struct  HF::Common::SerializableHelper< Common::ByteArray >
 Wrapper for Common::ByteArray implementing the Serializable API. More...
 
struct  HF::Common::SerializableHelper< std::string >
 Wrapper for std::string implementing the Serializable API. More...
 
struct  HF::Common::SerializableHelper< std::vector< uint8_t > >
 Wrapper for std::vector implementing the Serializable API. More...
 
struct  HF::Common::Cloneable< T >
 This class represents the interface that cloneable objects need to implement. More...
 
struct  HF::Common::Interface
 Interface UID. More...
 
class  HF::Common::Pointer< T >
 Simple raw pointer wrapper. More...
 
struct  HF::Common::IEntries< T >
 Basic API for persistent storage implementations. More...
 

Namespaces

 HF
 Top-level namespace for the HAN-FUN library.
 
 HF::Common
 This namespace contains helper classes to be used though out the HAN-FUN implementation.
 

Macros

#define UNUSED(x)   (void) x
 Helper macro to remove warning about unused function/method argument.
 
#define HF_SERIALIZABLE_CHECK(__array, __offset, __size)
 Helper macro to check if the given __array has enough size so __size bytes can be written/read from the given __offset. More...
 
#define HF_NOTIFY_HELPER(_Type, _old_value, _new_value)
 Helper macro to implement attribute notifications. More...
 
#define HF_SETTER_HELPER(_Type, _name, _value)
 Helper macro to implement attribute setters. More...
 
#define HF_ASSERT(_expr, _block)
 Helper macro to check for correct assumptions. More...
 

Enumerations

enum  HF::Common::Precision {
  HF::Common::BASE = 0x00, HF::Common::MILI = 0x10, HF::Common::MICRO = 0x11, HF::Common::NANO = 0x12,
  HF::Common::PICO = 0x13, HF::Common::KILO = 0x20, HF::Common::MEGA = 0x21, HF::Common::GIGA = 0x22,
  HF::Common::TERA = 0x23
}
 These constants represent precisions that a measurement can be in. More...
 
enum  HF::Common::Time { HF::Common::UPTIME = 0x00, HF::Common::UTC = 0x01 }
 This represents the type of time that is associated with a time measurement. More...
 
enum  HF::Common::Result {
  HF::Common::OK = 0x00, HF::Common::FAIL_AUTH = 0x01, HF::Common::FAIL_ARG = 0x02, HF::Common::FAIL_SUPPORT = 0x03,
  HF::Common::FAIL_RO_ATTR = 0x04, HF::Common::FAIL_READ_SESSION = 0x20, HF::Common::FAIL_MODIFIED = 0x21, HF::Common::FAIL_RESOURCES = 0xFE,
  HF::Common::FAIL_UNKNOWN = 0xFF
}
 Commands result codes. More...
 

Functions

template<typename T , typename P = float>
HF::Common::from_percent (P value)
 Convert a percentage value into the [0,std::numeric_limits<T>::max()] range. More...
 
template<typename T , typename P = float>
HF::Common::to_percent (T value)
 Convert a value in the [0,std::numeric_limits<T>::max()] range into a percentage. More...
 
std::ostream & operator<< (std::ostream &stream, const uint8_t byte)
 Convert the given byte into a string and write it to the given stream. More...
 
std::ostream & operator<< (std::ostream &stream, const HF::Common::ByteArray &array)
 Convert the given packet into a string and write it to the given stream if stream == std::cout || stream == std::cerr. More...
 
std::ostream & operator<< (std::ostream &stream, const HF::Common::Interface interface)
 Convert the given interface into a string and write it to the given stream. More...
 

Variables

constexpr uint8_t HF::CORE_VERSION = 2
 Core Service & Interfaces major version supported. More...
 
constexpr uint8_t HF::PROFILES_VERSION = 1
 Profiles major version supported. More...
 
constexpr uint8_t HF::INTERFACES_VERSION = 1
 Interfaces major version supported. More...
 

Detailed Description

This file contains the common defines for the HAN-FUN library.

Version
1.5.3

For licensing information, please see the file 'LICENSE' in the root folder.

Initial development by Bithium S.A. [http://www.bithium.com]

Definition in file inc/hanfun/common.h.