Skip to content

Commit 1e98078

Browse files
authored
feat(plugin): ✨ add mqtt plugin (#8)
Give the ability to lcd4linux listen to MQTT topics
1 parent 43ac5de commit 1e98078

8 files changed

Lines changed: 509 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
build-essential debhelper autoconf automake libtool libtool-bin pkg-config \
4242
libusb-1.0-0-dev libgd-dev libvncserver-dev \
4343
libx11-dev libxext-dev libxpm-dev \
44+
libmosquitto-dev \
4445
git
4546
dpkg-buildpackage -us -uc -b
4647
echo "=== .deb build successful ==="
@@ -77,6 +78,7 @@ jobs:
7778
dnf install -y gcc make autoconf automake libtool pkgconfig \
7879
libusbx-devel gd-devel libvncserver-devel \
7980
libX11-devel libXext-devel libXpm-devel \
81+
mosquitto-devel \
8082
rpm-build git systemd-rpm-macros gettext-devel
8183
mkdir -p /root/rpmbuild/{SOURCES,SPECS}
8284
tar czf /root/rpmbuild/SOURCES/lcd4linux-ax206-0.11.0.tar.gz \

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
build-essential debhelper autoconf automake libtool libtool-bin pkg-config \
4848
libusb-1.0-0-dev libgd-dev libvncserver-dev \
4949
libx11-dev libxext-dev libxpm-dev \
50+
libmosquitto-dev \
5051
git
5152
# Update changelog version from tag
5253
sed -i "1s/([^)]*)/('"${{ steps.version.outputs.version }}"'-1)/" debian/changelog
@@ -95,6 +96,7 @@ jobs:
9596
dnf install -y gcc make autoconf automake libtool pkgconfig \
9697
libusbx-devel gd-devel libvncserver-devel \
9798
libX11-devel libXext-devel libXpm-devel \
99+
mosquitto-devel \
98100
rpm-build git systemd-rpm-macros gettext-devel
99101
VERSION='"${{ steps.version.outputs.version }}"'
100102
# RPM Version field forbids "-"; replace with "." (sorts lower, correct for pre-releases)

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ plugin_loadavg.c \
162162
plugin_meminfo.c \
163163
plugin_mpd.c \
164164
plugin_mpris_dbus.c \
165+
plugin_mqtt.c \
165166
plugin_mysql.c \
166167
plugin_netdev.c \
167168
plugin_netinfo.c \

debian/control

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Build-Depends: debhelper-compat (= 13),
1313
libvncserver-dev,
1414
libx11-dev,
1515
libxext-dev,
16-
libxpm-dev
16+
libxpm-dev,
17+
libmosquitto-dev
1718
Standards-Version: 4.6.0
1819
Homepage: https://github.com/amd989/lcd4linux-ax206
1920

plugin.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ char *Plugins[] = {
120120
#ifdef PLUGIN_MPRIS_DBUS
121121
"mpris_dbus",
122122
#endif
123+
#ifdef PLUGIN_MQTT
124+
"mqtt",
125+
#endif
123126
#ifdef PLUGIN_MYSQL
124127
"mysql",
125128
#endif
@@ -230,6 +233,8 @@ int plugin_init_mpd(void);
230233
void plugin_exit_mpd(void);
231234
int plugin_init_mpris_dbus(void);
232235
void plugin_exit_mpris_dbus(void);
236+
int plugin_init_mqtt(void);
237+
void plugin_exit_mqtt(void);
233238
int plugin_init_mysql(void);
234239
void plugin_exit_mysql(void);
235240
int plugin_init_netdev(void);
@@ -357,6 +362,9 @@ int plugin_init(void)
357362
#ifdef PLUGIN_MPRIS_DBUS
358363
plugin_init_mpris_dbus();
359364
#endif
365+
#ifdef PLUGIN_MQTT
366+
plugin_init_mqtt();
367+
#endif
360368
#ifdef PLUGIN_MYSQL
361369
plugin_init_mysql();
362370
#endif
@@ -478,6 +486,9 @@ void plugin_exit(void)
478486
#ifdef PLUGIN_MPRIS_DBUS
479487
plugin_exit_mpris_dbus();
480488
#endif
489+
#ifdef PLUGIN_MQTT
490+
plugin_exit_mqtt();
491+
#endif
481492
#ifdef PLUGIN_MYSQL
482493
plugin_exit_mysql();
483494
#endif

0 commit comments

Comments
 (0)