@@ -73,8 +73,8 @@ class NimBLEStream : public Stream {
7373 virtual size_t write (uint8_t data) override { return write (&data, 1 ); }
7474
7575 // Template for other integral types (char, int, long, etc.)
76- template <typename T>
77- typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, uint8_t >::value, size_t >::type write (T data) {
76+ template <typename T, typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, uint8_t >::value, int >::type = 0 >
77+ size_t write (T data) {
7878 return write (static_cast <uint8_t >(data));
7979 }
8080
@@ -138,6 +138,8 @@ class NimBLEStreamServer : public NimBLEStream {
138138 size_t getMaxLength () const { return m_charCallbacks.m_maxLen ; }
139139 void setCallbacks (NimBLECharacteristicCallbacks* pCallbacks) { m_charCallbacks.m_userCallbacks = pCallbacks; }
140140
141+ using NimBLEStream::write; // Inherit template write overloads
142+
141143 private:
142144 bool send (const uint8_t * data, size_t len) override ;
143145 bool isReady () const override { return hasSubscriber (); }
@@ -179,11 +181,12 @@ class NimBLEStreamClient : public NimBLEStream {
179181
180182 // Attach a discovered remote characteristic; app owns discovery/connection.
181183 // Set subscribeNotify=true to receive notifications into RX buffer.
182- bool init (NimBLERemoteCharacteristic* pChr, bool subscribeNotify = false );
183- void deinit ();
184- size_t write (const uint8_t * data, size_t len) override ;
185- void setWriteWithResponse (bool useWithRsp) { m_writeWithRsp = useWithRsp; }
186- void setNotifyCallback (NimBLERemoteCharacteristic::notify_callback cb) { m_userNotifyCallback = cb; }
184+ bool init (NimBLERemoteCharacteristic* pChr, bool subscribeNotify = false );
185+ void deinit ();
186+ void setWriteWithResponse (bool useWithRsp) { m_writeWithRsp = useWithRsp; }
187+ void setNotifyCallback (NimBLERemoteCharacteristic::notify_callback cb) { m_userNotifyCallback = cb; }
188+
189+ using NimBLEStream::write; // Inherit template write overloads
187190
188191 private:
189192 bool send (const uint8_t * data, size_t len) override ;
0 commit comments