#ifndef PROVIDERUDP_H #define PROVIDERUDP_H // LedDevice includes #include // Hyperion includes #include // Qt includes #include #include /// /// The ProviderUdp implements an abstract base-class for LedDevices using UDP packets. /// class ProviderUdp : public LedDevice { public: /// /// @brief Constructs an UDP LED-device /// ProviderUdp(const QJsonObject &deviceConfig); /// /// @brief Destructor of the UDP LED-device /// ~ProviderUdp() override; QHostAddress getAddress() const { return _address; } protected: /// /// @brief Initialise the UDP device's configuration and network address details /// /// @param[in] deviceConfig the JSON device configuration /// @return True, if success /// bool init(const QJsonObject &deviceConfig) override; /// /// @brief Opens the output device. /// /// @return Zero on success (i.e. device is ready), else negative /// int open() override; /// /// @brief Closes the UDP device. /// /// @return Zero on success (i.e. device is closed), else negative /// int close() override; /// /// @brief Writes the given bytes to the UDP-device /// /// @param[in] size The length of the data /// @param[in] data The data /// /// @return Zero on success, else negative /// int writeBytes(const unsigned size, const uint8_t *data); /// /// @brief Writes the given bytes to the UDP-device /// /// @param[in] data The data /// /// @return Zero on success, else negative /// int writeBytes(const QByteArray &bytes); /// QUdpSocket * _udpSocket; QHostAddress _address; quint16 _port; QString _defaultHost; }; #endif // PROVIDERUDP_H