#include <CERNASIMessage.h>
Public Member Functions | |
CERNASIMessage (acsalarm::ASIMessage &message) | |
std::string | toXML () |
std::string | timestampToXML (const acsalarm::Timestamp *timestamp, std::string elementName, int amountToIndent) const |
std::string | faultStateToXML (acsalarm::FaultState *state, int amountToIndent=3) |
std::string | propertiesToXML (acsalarm::Properties props, int amountToIndent=6) |
Private Attributes | |
acsalarm::ASIMessage & | m_message |
CERNASIMessage holds a reference to ASIMessage to build the XML of the source alarms that will be published into the NC.
The reason to have this method here is that in ACS/LGPL/CommonSoftware the ASI-Message name space is not yet known neither needed because the ACS implementation only logs a message for each alarm.
laserSource::CERNASIMessage::CERNASIMessage | ( | acsalarm::ASIMessage & | message | ) |
Constructor
message | The (not NULL) ASIMessage to produce the XML |
std::string laserSource::CERNASIMessage::faultStateToXML | ( | acsalarm::FaultState * | state, | |
int | amountToIndent = 3 | |||
) |
Returns an XML representation of the fault state. NOTE: this will not be a complete XML document, but just a fragment.
state | The FaultState to format | |
amountToIndent | the amount (in spaces) to indent for readability |
For example:
<fault-state family="AlarmSource" member="ALARM_SOURCE_ANTENNA" code="1"> <descriptor>TERMINATE</descriptor> <user-properties> <property name="ASI_PREFIX" value="prefix"> <property name="TEST_PROPERTY" value="TEST_VALUE"> <property name="ASI_SUFFIX" value="suffix"> </user-properties> <user-timestamp seconds="1129902763" microseconds="105000"/> </fault-state>
std::string laserSource::CERNASIMessage::propertiesToXML | ( | acsalarm::Properties | props, | |
int | amountToIndent = 6 | |||
) |
Returns an XML fragment (NOT a complete document) representing all of the properties contained in this table, for use in the message transported from an alarm source to the alarm server.
amountToIndent | - used to specify a level of indentation (in spaces) for readability |
std::string laserSource::CERNASIMessage::timestampToXML | ( | const acsalarm::Timestamp * | timestamp, | |
std::string | elementName, | |||
int | amountToIndent | |||
) | const |
Returns an XML fragment (NOT a complete document) representing the timestamp, for use in the message that is transported from alarm source to alarm server.
timestamp | The timestamp | |
elementName | the element name when generating the XML fragment, for instance in the example below the elementName is "source-timestamp" |
For example: <source-timestamp>2014-10-07T13:39:34.658</source-timestamp>
amountToIndent | - used to specify a level of indentation (in spaces) for readability |
std::string laserSource::CERNASIMessage::toXML | ( | ) |
builds the xml representation of the message which will be sent to the alarm server
The (not NULL) ASIMessage to produce the XML