Skip to content

Commit 6d01e79

Browse files
fixup! added Mqtt client Interface definition
1 parent 33438fc commit 6d01e79

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/MqttInterface.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#pragma once
2-
#include <functional>
32
#include <Client.h>
43

54
// The Idea for this section of the library is to allow the usage of different implementation for Mqtt Clients
@@ -33,8 +32,17 @@ class MqttOStream { // if OStream becomes available in arduino core api, we stil
3332

3433
using Topic = const char* const;
3534

36-
// for incoming published messages
37-
using MqttReceiveCallback = std::function<void(Topic, IStream&)>;
35+
#if defined(__has_include)
36+
// Check if string_view is available and usable
37+
#if __has_include(<functional>)
38+
#include <functional>
39+
40+
// for incoming published messages
41+
using MqttReceiveCallback = std::function<void(Topic, IStream&)>;
42+
#endif
43+
#else
44+
typedef void(*MqttReceiveCallback)(Topic, IStream&)>;
45+
#endif
3846

3947
// TODO MQTT 5.0 stuff
4048

0 commit comments

Comments
 (0)