Skip to content

Commit

Permalink
added ability to add data to JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
irekzielinski committed Jul 28, 2016
1 parent 6ce2463 commit 10016bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Libraries/PMax/pmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,8 @@ void PowerMaxAlarm::dumpToJson(IOutput* outputStream)
{
outputStream->write("{");
{
OnDumpToJsonStarted(outputStream);

outputStream->writeJsonTag("stat", stat);
outputStream->writeJsonTag("stat_str", GetStrPmaxSystemStatus(stat));
outputStream->writeJsonTag("lastCom", (int)getSecondsFromLastComm());
Expand Down
4 changes: 4 additions & 0 deletions Libraries/PMax/pmax.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ class PowerMaxAlarm
//parameters : see setDateTime function
virtual void OnPanelDateTime(unsigned char year, unsigned char month, unsigned char day, unsigned char hour, unsigned char minutes, unsigned char seconds){};

//Allows to add extra fields to json output
virtual void OnDumpToJsonStarted(IOutput* outputStream){};

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//those functions provide string representation of various types in alarm, you can override to provide your own text
virtual const char* GetStrPmaxSystemStatus(int index);
Expand All @@ -338,6 +341,7 @@ class PowerMaxAlarm
virtual const char* GetStrPmaxZoneTypes(int index);
virtual const char* GetStrPmaxEventSource(int index);

SystemStatus GetSystemStatus() const { return stat;}
protected:
void addPin(unsigned char* bufferToSend, int pos = 4, bool useMasterCode = false);

Expand Down

0 comments on commit 10016bf

Please sign in to comment.