@@ -168,19 +168,21 @@ NOTE_C_STATIC i2cTransmitFn hookI2CTransmit = NULL;
168
168
*/
169
169
/**************************************************************************/
170
170
NOTE_C_STATIC i2cReceiveFn hookI2CReceive = NULL ;
171
+ #ifdef NOTE_C_HEARTBEAT_CALLBACK
171
172
//**************************************************************************/
172
173
/*!
173
174
@brief Hook for a heartbeat notification
174
175
*/
175
176
/**************************************************************************/
176
177
NOTE_C_STATIC heartbeatFn hookHeartbeat = NULL ;
177
178
NOTE_C_STATIC void * hookHeartbeatContext = NULL ;
179
+ #endif
180
+ #ifndef NOTE_NODEBUG
178
181
//**************************************************************************/
179
182
/*!
180
183
@brief Variable used to determine the runtime logging level
181
184
*/
182
185
/**************************************************************************/
183
- #ifndef NOTE_NODEBUG
184
186
NOTE_C_STATIC int noteLogLevel = NOTE_C_LOG_LEVEL ;
185
187
#endif
186
188
@@ -303,6 +305,7 @@ void NoteSetFn(mallocFn mallocHook, freeFn freeHook, delayMsFn delayMsHook,
303
305
_UnlockNote ();
304
306
}
305
307
308
+ #ifdef NOTE_C_HEARTBEAT_CALLBACK
306
309
//**************************************************************************/
307
310
/*!
308
311
@brief Set the heartbeat function
@@ -317,6 +320,7 @@ void NoteSetFnHeartbeat(heartbeatFn fn, void *context)
317
320
hookHeartbeatContext = context ;
318
321
_UnlockNote ();
319
322
}
323
+ #endif
320
324
321
325
//**************************************************************************/
322
326
/*!
@@ -785,18 +789,22 @@ void NoteUnlockI2C(void)
785
789
}
786
790
}
787
791
792
+ #ifdef NOTE_C_HEARTBEAT_CALLBACK
788
793
//**************************************************************************/
789
794
/*!
790
795
@brief Call a heartbeat function if registered
791
- @param heartbeatJson Pointer to null-terminated heartbeat Json string.
796
+ @param heartbeatJson Pointer to null-terminated heartbeat JSON string.
797
+ @returns `true` if the heartbeat callback wishes to abandon the transaction.
792
798
*/
793
799
/**************************************************************************/
794
- void _noteHeartbeat (const char * heartbeatJson )
800
+ bool _noteHeartbeat (const char * heartbeatJson )
795
801
{
796
802
if (hookHeartbeat != NULL ) {
797
- hookHeartbeat (heartbeatJson , hookHeartbeatContext );
803
+ return hookHeartbeat (heartbeatJson , hookHeartbeatContext );
798
804
}
805
+ return false;
799
806
}
807
+ #endif
800
808
801
809
//**************************************************************************/
802
810
/*!
@@ -858,6 +866,7 @@ void NoteGetFnDebugOutput(debugOutputFn *fn)
858
866
}
859
867
}
860
868
869
+ #ifdef NOTE_C_HEARTBEAT_CALLBACK
861
870
/*!
862
871
@brief Get the user-defined heartbeat function.
863
872
@param fn Pointer to store the heartbeat function pointer.
@@ -872,6 +881,7 @@ void NoteGetFnHeartbeat(heartbeatFn *fn, void **context)
872
881
* context = hookHeartbeatContext ;
873
882
}
874
883
}
884
+ #endif
875
885
876
886
/*!
877
887
@brief Get the platform-specific transaction functions.
0 commit comments