hyperion.ng
LedDeviceTinkerforge.h
1 #pragma once
2 
3 // STL includes
4 #include <cstdio>
5 
6 #include <QString>
7 
8 // Hyperion-Leddevice includes
9 #include <leddevice/LedDevice.h>
10 
11 
12 extern "C" {
13  #include <tinkerforge/ip_connection.h>
14  #include <tinkerforge/bricklet_led_strip.h>
15 }
16 
18 {
19 public:
25  LedDeviceTinkerforge(const QJsonObject &deviceConfig);
26 
27  virtual ~LedDeviceTinkerforge();
28 
34  bool init(const QJsonObject &deviceConfig);
35 
37  static LedDevice* construct(const QJsonObject &deviceConfig);
38 
44  int open();
45 
46 private:
54  virtual int write(const std::vector<ColorRgb> &ledValues);
55 
58  int transferLedData(LEDStrip *ledstrip, unsigned int index, unsigned int length, uint8_t *redChannel, uint8_t *greenChannel, uint8_t *blueChannel);
59 
61  QString _host;
62 
64  uint16_t _port;
65 
67  QString _uid;
68 
70  unsigned _interval;
71 
73  IPConnection *_ipConnection;
74 
76  LEDStrip *_ledStrip;
77 
79  std::vector<uint8_t> _redChannel;
80 
82  std::vector<uint8_t> _greenChannel;
83 
85  std::vector<uint8_t> _blueChannel;
86 
88  unsigned int _colorChannelSize;
89 
90 };
Definition: LedDeviceTinkerforge.h:17
Interface (pure virtual base class) for LedDevices.
Definition: LedDevice.h:32
int open()
Attempts to open a connection to the master bricklet and the led strip bricklet.
Definition: LedDeviceTinkerforge.cpp:65
Definition: ip_connection.h:343
Definition: ip_connection.h:196
bool init(const QJsonObject &deviceConfig)
Sets configuration.
Definition: LedDeviceTinkerforge.cpp:34
LedDeviceTinkerforge(const QJsonObject &deviceConfig)
Constructs specific LedDevice.
Definition: LedDeviceTinkerforge.cpp:12
static LedDevice * construct(const QJsonObject &deviceConfig)
constructs leddevice
Definition: LedDeviceTinkerforge.cpp:60