Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,39 @@ RRDB_FLAGS = -D ENABLE_RRDB=0
endif


# WLED device class support
if ENABLE_WLED

WLED_SOURCES = \
src/p44vdc/deviceclasses/wled/wledcomm.cpp \
src/p44vdc/deviceclasses/wled/wledcomm.hpp \
src/p44vdc/deviceclasses/wled/wledvdc.cpp \
src/p44vdc/deviceclasses/wled/wledvdc.hpp \
src/p44vdc/deviceclasses/wled/wleddevice.cpp \
src/p44vdc/deviceclasses/wled/wleddevice.hpp

WLED_FLAGS = -D ENABLE_WLED=1

else

WLED_SOURCES =
WLED_FLAGS = -D ENABLE_WLED=0

endif


# JSON WebSocket support (Boost.Beast based)
if ENABLE_JSON_WEBSOCKET

JSON_WEBSOCKET_FLAGS = -D ENABLE_JSON_WEBSOCKET=1

else

JSON_WEBSOCKET_FLAGS = -D ENABLE_JSON_WEBSOCKET=0

endif


# p44features special purpose hardware support
if ENABLE_P44FEATURES

Expand Down Expand Up @@ -849,7 +882,9 @@ vdcd_CPPFLAGS = \
-I ${srcdir}/src/p44vdc/deviceclasses/dali \
-I ${srcdir}/src/p44vdc/deviceclasses/hue \
-I ${srcdir}/src/p44vdc/deviceclasses/ledchain \
-I ${srcdir}/src/p44vdc/deviceclasses/wled \
${RRDB_FLAGS} \
${WLED_FLAGS} \
${P44FEATURES_FLAGS} \
${RPIWS281X_FLAGS} \
${OLA_FLAGS} \
Expand All @@ -862,6 +897,7 @@ vdcd_CPPFLAGS = \
${EV_FLAGS} \
${UWSC_FLAGS} \
${GPIOD_FLAGS} \
${JSON_WEBSOCKET_FLAGS} \
${LVGL_FLAGS} \
${BOOST_CPPFLAGS} \
${PTHREAD_CFLAGS} \
Expand Down Expand Up @@ -934,6 +970,8 @@ vdcd_SOURCES = \
src/p44utils/jsonrpccomm.hpp \
src/p44utils/jsonwebclient.cpp\
src/p44utils/jsonwebclient.hpp\
src/p44utils/jsonwebsocketclient.cpp\
src/p44utils/jsonwebsocketclient.hpp\
src/p44utils/ledchaincomm.cpp \
src/p44utils/ledchaincomm.hpp \
src/p44utils/logger.cpp \
Expand Down Expand Up @@ -1195,6 +1233,7 @@ vdcd_SOURCES = \
src/p44vdc/deviceclasses/ledchain/ledchaindevice.cpp \
src/p44vdc/deviceclasses/ledchain/ledchainvdc.hpp \
src/p44vdc/deviceclasses/ledchain/ledchainvdc.cpp \
${WLED_SOURCES} \
src/p44utils_config.hpp \
src/p44vdc_config.hpp \
src/p44_vdcd_main.cpp
Expand Down
26 changes: 22 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@ AC_ARG_ENABLE(
)
AM_CONDITIONAL([ENABLE_LVGL_DRM], [test "x$enable_lvgldrm" = xyes])

AC_ARG_ENABLE(
[wled],
[AS_HELP_STRING([--enable-wled], [Enable WLED device support])]
)
AM_CONDITIONAL([ENABLE_WLED], [test "x$enable_wled" = xyes])

AC_ARG_ENABLE(
[wled-websocket],
[AS_HELP_STRING([--enable-wled-websocket], [Enable WLED WebSocket support (requires Boost.Beast)])]
)
AM_CONDITIONAL([ENABLE_JSON_WEBSOCKET], [test "x$enable_wled_websocket" = xyes])

AC_ARG_ENABLE(
[platformshortbreak],
[AS_HELP_STRING([--enable-platformshortbreak], [Enable usage of platform's ability to produce short breaks on UART])]
Expand Down Expand Up @@ -176,6 +188,12 @@ AM_COND_IF([ENABLE_MODBUS], [
])
], [])

AM_COND_IF([ENABLE_JSON_WEBSOCKET], [
AC_CHECK_LIB(boost_system, main, [], [AC_MSG_ERROR([Could not find libboost_system (required for Boost.Beast WebSocket support)])])
AX_BOOST_ASIO
AX_BOOST_SYSTEM
], [])

AC_CHECK_LIB(json-c, json_tokener_get_error, [], [AC_MSG_ERROR([Could not find JSON-C / libjson0 with json_tokener_get_error supported (>=0.10)])])
AC_CHECK_LIB(ssl, TLSv1_client_method, [], [AC_MSG_ERROR([Could not find libssl with TLSv1_client_method])])
AC_CHECK_LIB(crypto, SHA1_Init, [], [AC_MSG_ERROR([Could not find libcrypto with SHA1_Init])])
Expand Down Expand Up @@ -243,12 +261,12 @@ AC_SUBST(PROTOC)
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h sys/resource.h], [], [AC_MSG_ERROR([required system header not found])])


ASSUMED_BOOST_VER=146
ASSUMED_BOOST_VER=183

BOOST_REQUIRE([1.46], [
BOOST_REQUIRE([1.83], [
unset boost_cv_version
unset boost_cv_inc_path
BOOST_REQUIRE([1.35], [
BOOST_REQUIRE([1.83], [
AC_MSG_ERROR([could not find boost on your system])
])
ASSUMED_BOOST_VER=135
Expand All @@ -257,7 +275,7 @@ BOOST_REQUIRE([1.46], [
if test $ASSUMED_BOOST_VER -eq 135; then
AC_DEFINE([BOOST_VERSION_135], [1], [boost 1.35 or higher])
else
AC_DEFINE([BOOST_VERSION_146], [1], [boost 1.46 or higher])
AC_DEFINE([BOOST_VERSION_146], [1], [boost 1.83 or higher])
fi

BOOST_BIND
Expand Down
16 changes: 16 additions & 0 deletions src/p44_vdcd_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
#if ENABLE_HUE
#include "huevdc.hpp"
#endif
#if ENABLE_WLED
#include "wledvdc.hpp"
#endif
#if ENABLE_WBF
#include "wbfvdc.hpp"
#endif
Expand Down Expand Up @@ -410,6 +413,10 @@ class P44Vdcd : public CmdLineApp
{ 0, "huelights", false, "enable support for hue LED lamps (via hue bridge)" },
{ 0, "hueapiurl", true, NULL, /* dummy, but kept to prevent breaking startup in installations that use this option */ },
#endif
#if ENABLE_WLED
{ 0, "wledlights", false, "enable support for WLED LED lamps (via WLED devices)" },
{ 0, "wledips", true, "ip[,...];list of WLED device IP addresses to connect to" },
#endif
#if ENABLE_WBF
{ 0, "wbf", false, "enable support for Wiser-by-Feller (via µGateway)" },
#endif
Expand Down Expand Up @@ -851,6 +858,15 @@ class P44Vdcd : public CmdLineApp
}
#endif // ENABLE_HUE

#if ENABLE_WLED
// - Add wled support
if (getOption("wledlights")) {
WledVdcPtr wledVdc = WledVdcPtr(new WledVdc(1, mP44VdcHost.get(), 4)); // Tag 4 = wled
wledVdc->addVdcToVdcHost();
LOG(LOG_NOTICE, "WLED VDC created successfully");
}
#endif // ENABLE_WLED

#if ENABLE_WBF
// - Add wiser-by-feller support
if (getOption("wbf")) {
Expand Down
4 changes: 4 additions & 0 deletions src/p44vdc_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@
#ifndef ENABLE_HUE
#define ENABLE_HUE 1
#endif
#ifndef ENABLE_WLED
#define ENABLE_WLED 1
#define ENABLE_JSON_WEBSOCKET 1
#endif
#ifndef ENABLE_STATIC
#define ENABLE_STATIC 1
#endif
Expand Down