public abstract class DemoFramework extends DemoBase implements ICallbacks, ICallbacks
Defines parameters and methods needed by extending classes i.e.:
Constructor and Description |
---|
DemoFramework() |
Modifier and Type | Method and Description |
---|---|
void |
initializeParameters(java.lang.String filename)
Initialize parameters.
|
void |
onReceivedStream(byte[] stream)
onReceivedStream callback method.
|
void |
onSentStream(byte[] stream)
OnSentStream callback method.
|
void |
onStateChange(HDLCProtocolState state)
onStateChange callback method.
|
boolean |
processXmlFile(java.lang.String filePath)
Processes an XML file.
|
public void initializeParameters(java.lang.String filename)
You should be
filename
- A parameter option filename.public boolean processXmlFile(java.lang.String filePath) throws icube.xmlpdu.infra.XmlPduException, WRAPPERException, EzHdlcException, java.io.IOException
Pseudo code:
...
_outXml = read file // into a string buffer
_outPdu = XmlPduInterface.XmlToPdu(_outXml); // convert to Pdu
_inPdu = this.hdlc.sendReceive(_outPdu); // send/receive to/from meter
_inXml = XmlPduInterface.PduToXml(_inPdu); // convert response to string
print _inXml // to console
...
filePath
- the file pathicube.xmlpdu.infra.XmlPduException
java.io.IOException
WRAPPERException
EzHdlcException
public void onReceivedStream(byte[] stream)
ICallbacks
Called when a byte stream is received from the meter.
onReceivedStream
in interface ICallbacks
stream
- Byte stream received.public void onSentStream(byte[] stream)
ICallbacks
Called when a byte stream is sent to the meter.
onSentStream
in interface ICallbacks
stream
- Byte stream sent.public void onStateChange(HDLCProtocolState state)
ICallbacks
Called when a Meter's state change occurs.
state
- The new state.HDLCProtocolState