send also label name in ADPS callback

This commit is contained in:
Charles 2021-04-20 19:15:02 +02:00
parent 2db93914c6
commit 747dc28642
2 changed files with 6 additions and 5 deletions

View File

@ -17,6 +17,7 @@
// V2.00 2020-06-11 - Integration into Tasmota // V2.00 2020-06-11 - Integration into Tasmota
// V2.01 2020-08-11 - Merged LibTeleinfo official and Tasmota version // V2.01 2020-08-11 - Merged LibTeleinfo official and Tasmota version
// Added support for new standard mode of linky smart meter // Added support for new standard mode of linky smart meter
// V2.02 2021-04-20 - Add label field to overload callback (ADPS)
// //
// All text above must be included in any redistribution. // All text above must be included in any redistribution.
// //
@ -84,7 +85,7 @@ Input : callback function
Output : - Output : -
Comments: - Comments: -
====================================================================== */ ====================================================================== */
void TInfo::attachADPS(void (*fn_ADPS)(uint8_t phase)) void TInfo::attachADPS(void (*fn_ADPS)(uint8_t phase, char * label))
{ {
// indicate the user callback // indicate the user callback
_fn_ADPS = fn_ADPS; _fn_ADPS = fn_ADPS;
@ -759,7 +760,7 @@ void TInfo::customLabel( char * plabel, char * pvalue, uint8_t * pflags)
// Traitement de l'ADPS demandé par le sketch // Traitement de l'ADPS demandé par le sketch
if (_fn_ADPS) if (_fn_ADPS)
_fn_ADPS(phase); _fn_ADPS(phase, plabel);
} }
} }

View File

@ -129,7 +129,7 @@ enum _State_e {
#define TINFO_SGR '\n' // start of group #define TINFO_SGR '\n' // start of group
#define TINFO_EGR '\r' // End of group #define TINFO_EGR '\r' // End of group
typedef void (*_fn_ADPS) (uint8_t); typedef void (*_fn_ADPS) (uint8_t, char *);
typedef void (*_fn_data) (ValueList *, uint8_t); typedef void (*_fn_data) (ValueList *, uint8_t);
typedef void (*_fn_new_frame) (ValueList *); typedef void (*_fn_new_frame) (ValueList *);
typedef void (*_fn_updated_frame) (ValueList *); typedef void (*_fn_updated_frame) (ValueList *);
@ -140,7 +140,7 @@ class TInfo
TInfo(); TInfo();
void init(_Mode_e mode); // mode MUST be specified void init(_Mode_e mode); // mode MUST be specified
_State_e process (char c); _State_e process (char c);
void attachADPS(void (*_fn_ADPS)(uint8_t phase)); void attachADPS(void (*_fn_ADPS)(uint8_t phase, char * label));
void attachData(void (*_fn_data)(ValueList * valueslist, uint8_t state)); void attachData(void (*_fn_data)(ValueList * valueslist, uint8_t state));
void attachNewFrame(void (*_fn_new_frame)(ValueList * valueslist)); void attachNewFrame(void (*_fn_new_frame)(ValueList * valueslist));
void attachUpdatedFrame(void (*_fn_updated_frame)(ValueList * valueslist)); void attachUpdatedFrame(void (*_fn_updated_frame)(ValueList * valueslist));
@ -169,7 +169,7 @@ class TInfo
char _separator; char _separator;
uint8_t _recv_idx; // index in receive buffer uint8_t _recv_idx; // index in receive buffer
boolean _frame_updated; // Data on the frame has been updated boolean _frame_updated; // Data on the frame has been updated
void (*_fn_ADPS)(uint8_t phase); void (*_fn_ADPS)(uint8_t phase, char * label);
void (*_fn_data)(ValueList * valueslist, uint8_t state); void (*_fn_data)(ValueList * valueslist, uint8_t state);
void (*_fn_new_frame)(ValueList * valueslist); void (*_fn_new_frame)(ValueList * valueslist);
void (*_fn_updated_frame)(ValueList * valueslist); void (*_fn_updated_frame)(ValueList * valueslist);