3131# include < type_traits>
3232# include < cstdarg>
3333
34+ # ifndef NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
35+ # define NIMBLE_CPP_ARDUINO_STRING_AVAILABLE (__has_include(<Arduino.h>))
36+ # endif
37+
3438# if NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
3539# include < Stream.h>
3640# else
@@ -100,7 +104,7 @@ class NimBLEStream : public Stream {
100104 */
101105 void setRxOverflowCallback (RxOverflowCallback cb, void * userArg = nullptr ) {
102106 m_rxOverflowCallback = cb;
103- m_rxOverflowUserArg = userArg;
107+ m_rxOverflowUserArg = userArg;
104108 }
105109
106110 operator bool () const { return ready (); }
@@ -118,17 +122,17 @@ class NimBLEStream : public Stream {
118122 static void txDrainEventCb (struct ble_npl_event * ev);
119123 static void txDrainCalloutCb (struct ble_npl_event * ev);
120124
121- ByteRingBuffer* m_txBuf{nullptr };
122- ByteRingBuffer* m_rxBuf{nullptr };
123- uint8_t m_txChunkBuf[MYNEWT_VAL (BLE_ATT_PREFERRED_MTU )];
124- uint32_t m_txBufSize{1024 };
125- uint32_t m_rxBufSize{1024 };
126- ble_npl_event m_txDrainEvent{};
127- ble_npl_callout m_txDrainCallout{};
125+ ByteRingBuffer* m_txBuf{nullptr };
126+ ByteRingBuffer* m_rxBuf{nullptr };
127+ uint8_t m_txChunkBuf[MYNEWT_VAL (BLE_ATT_PREFERRED_MTU )];
128+ uint32_t m_txBufSize{1024 };
129+ uint32_t m_rxBufSize{1024 };
130+ ble_npl_event m_txDrainEvent{};
131+ ble_npl_callout m_txDrainCallout{};
128132 RxOverflowCallback m_rxOverflowCallback{nullptr };
129- void * m_rxOverflowUserArg{nullptr };
130- bool m_coInitialized{false };
131- bool m_eventInitialized{false };
133+ void * m_rxOverflowUserArg{nullptr };
134+ bool m_coInitialized{false };
135+ bool m_eventInitialized{false };
132136};
133137
134138# if MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
@@ -203,13 +207,13 @@ class NimBLEStreamClient : public NimBLEStream {
203207
204208 // Attach a discovered remote characteristic; app owns discovery/connection.
205209 // Set subscribeNotify=true to receive notifications into RX buffer.
206- bool begin (NimBLERemoteCharacteristic* pChr,
207- bool subscribeNotify = false ,
208- uint32_t txBufSize = 1024 ,
209- uint32_t rxBufSize = 1024 );
210- void end () override ;
211- void setNotifyCallback (NimBLERemoteCharacteristic::notify_callback cb) { m_userNotifyCallback = cb; }
212- bool ready () const override ;
210+ bool begin (NimBLERemoteCharacteristic* pChr,
211+ bool subscribeNotify = false ,
212+ uint32_t txBufSize = 1024 ,
213+ uint32_t rxBufSize = 1024 );
214+ void end () override ;
215+ void setNotifyCallback (NimBLERemoteCharacteristic::notify_callback cb) { m_userNotifyCallback = cb; }
216+ bool ready () const override ;
213217 virtual void flush () override ;
214218
215219 using NimBLEStream::write; // Inherit template write overloads
0 commit comments