libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
BaseLib::LowLevel::Gpio Class Reference

#include <Gpio.h>

Classes

struct  GpioDirection
 
struct  GpioEdge
 
class  GpioInfo
 

Public Member Functions

 Gpio (BaseLib::SharedObjects *baseLib, std::string gpioPath)
 
virtual ~Gpio ()
 
virtual void openDevice (uint32_t index, bool readOnly)
 
virtual void getPath (uint32_t index)
 
virtual void closeDevice (uint32_t index)
 
virtual bool get (uint32_t index)
 
virtual int32_t poll (uint32_t index, int32_t timeout, bool debounce)
 Waits for a GPIO input to change and returns the input value. More...
 
virtual void set (uint32_t index, bool value)
 
virtual void setPermission (uint32_t index, int32_t userID, int32_t groupID, bool readOnly)
 
virtual void exportGpio (uint32_t index)
 
virtual void setDirection (uint32_t index, GpioDirection::Enum direction)
 
virtual void setEdge (uint32_t index, GpioEdge::Enum edge)
 
virtual bool isOpen (uint32_t index)
 
virtual void setup (int32_t userId, int32_t groupId, bool setPermissions, std::vector< uint32_t > &exportGpios)
 
virtual std::shared_ptr< FileDescriptorgetFileDescriptor (uint32_t index)
 

Protected Attributes

BaseLib::SharedObjects_bl = nullptr
 
std::string _gpioPath
 
std::mutex _gpioMutex
 
std::map< uint32_t, GpioInfo_gpioInfo
 

Constructor & Destructor Documentation

§ Gpio()

BaseLib::LowLevel::Gpio::Gpio ( BaseLib::SharedObjects baseLib,
std::string  gpioPath 
)

§ ~Gpio()

BaseLib::LowLevel::Gpio::~Gpio ( )
virtual

Member Function Documentation

§ closeDevice()

void BaseLib::LowLevel::Gpio::closeDevice ( uint32_t  index)
virtual

§ exportGpio()

void BaseLib::LowLevel::Gpio::exportGpio ( uint32_t  index)
virtual

§ get()

bool BaseLib::LowLevel::Gpio::get ( uint32_t  index)
virtual

§ getFileDescriptor()

PFileDescriptor BaseLib::LowLevel::Gpio::getFileDescriptor ( uint32_t  index)
virtual

§ getPath()

void BaseLib::LowLevel::Gpio::getPath ( uint32_t  index)
virtual

§ isOpen()

bool BaseLib::LowLevel::Gpio::isOpen ( uint32_t  index)
virtual

§ openDevice()

void BaseLib::LowLevel::Gpio::openDevice ( uint32_t  index,
bool  readOnly 
)
virtual

§ poll()

int32_t BaseLib::LowLevel::Gpio::poll ( uint32_t  index,
int32_t  timeout,
bool  debounce 
)
virtual

Waits for a GPIO input to change and returns the input value.

Parameters
indexThe index of the GPIO
timeoutThe timeout in milliseconds after which to return regardless if the input changed
debounceIf true the method waits 30 milliseconds after the input change and then returns the value (use this for e. g. switches)
Returns
Returns -1 on error, -2 on timeout, 0 for input low and 1 for input high

§ set()

void BaseLib::LowLevel::Gpio::set ( uint32_t  index,
bool  value 
)
virtual

§ setDirection()

void BaseLib::LowLevel::Gpio::setDirection ( uint32_t  index,
GpioDirection::Enum  direction 
)
virtual

§ setEdge()

void BaseLib::LowLevel::Gpio::setEdge ( uint32_t  index,
GpioEdge::Enum  edge 
)
virtual

§ setPermission()

void BaseLib::LowLevel::Gpio::setPermission ( uint32_t  index,
int32_t  userID,
int32_t  groupID,
bool  readOnly 
)
virtual

§ setup()

void BaseLib::LowLevel::Gpio::setup ( int32_t  userId,
int32_t  groupId,
bool  setPermissions,
std::vector< uint32_t > &  exportGpios 
)
virtual

Member Data Documentation

§ _bl

BaseLib::SharedObjects* BaseLib::LowLevel::Gpio::_bl = nullptr
protected

§ _gpioInfo

std::map<uint32_t, GpioInfo> BaseLib::LowLevel::Gpio::_gpioInfo
protected

§ _gpioMutex

std::mutex BaseLib::LowLevel::Gpio::_gpioMutex
protected

§ _gpioPath

std::string BaseLib::LowLevel::Gpio::_gpioPath
protected

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