Elmo Terminal provides functionality to test Lora radio and access SX1272 chip registers delivered with Elmo board. Also contains example ping-pong application.

Dependencies:   SX1272lib mbed-src

Settings/Variable.h

Committer:
WGorniak
Date:
2015-10-01
Revision:
6:453b018a9ba0
Parent:
2:8d8295a51f68

File content as of revision 6:453b018a9ba0:

#ifndef LIBRARIES_TESTS_RADIO_SETTINGS_VARIABLE_H_
#define LIBRARIES_TESTS_RADIO_SETTINGS_VARIABLE_H_

#include "stdint.h"
#include <string>

class Variable
{
public:
    struct ValueDescription
    {
        const int32_t value;
        const char* description;

        bool isEndRange() const
        {
            return (description == 0) && !isEnd();
        }

        bool isEnd() const
        {
            return (description == 0) && (value == 0);
        }

        static ValueDescription end()
        {
            ValueDescription vd = {0,0};
            return vd;
        }
    };

    static ValueDescription none[];

    Variable();

    bool endGuard() const;

    static int32_t nonSetValue();

    Variable(const char* name, const char* description, int32_t value, const ValueDescription* const pValueDescriptions);

    std::string name() const;

    std::string help() const;

    std::string describe(int32_t value) const;

    bool set(int32_t value);

    int32_t get() const;

    std::string describe() const;

private:
    const char* name_;
    const char* description_;
    const ValueDescription* const pValueDescriptions_;
    int32_t value_;
};

#endif /* LIBRARIES_TESTS_RADIO_SETTINGS_VARIABLE_H_ */