C12Adapter Opensource C++ Interface
|
ANSI C12.21 protocol implementation. More...
Public Member Functions | |
MProtocolC1221 (MChannel *channel, bool channelIsOwned=true) | |
Create the protocol object. | |
virtual | ~MProtocolC1221 () |
Destroy the protocol object. | |
virtual void | ApplyChannelParameters () |
Setup the configuration of the channel according to the C12.21 protocol handshake settings. | |
virtual void | DoStartSession () |
Synchronously start the session, don't do service count. More... | |
virtual void | Identify () |
Perform ANSI C12 Identify request. More... | |
void | TimingSetup () |
Perform ANSI C12 TimingSetup request. More... | |
void | TimingSetupWithWorkaround () |
Perform ANSI C12 TimingSetup request, and assume a potentially buggy device that does tries instead of retries. More... | |
virtual void | Negotiate () |
Perform ANSI C12 Negotiate request. More... | |
void | Authenticate () |
Perform ANSI C12 Authenticate request. More... | |
virtual void | FullLogin () |
Perform services required by C12.21 protocol to clear security with the meter. More... | |
void | ClearAuthenticationKeyList () |
Clear the authentication key list. | |
void | AddToAuthenticationKeyList (const MByteString &key) |
Add key and key id to the authentication key list. | |
int | GetAuthenticationKeyListSuccessfulEntry () const |
Return the entry which was successfully tried with the meter. | |
unsigned | GetIncomingIdentity () const |
Get the end device incoming identity. More... | |
DataFormatEnum | GetIncomingDataFormat () const |
Get the end device data format. More... | |
int | GetIdentifiedAuthenticationAlgorithm () const |
Get the authentication algorithm, as received by C12.21 Identify service. More... | |
unsigned | GetIdentity () const |
void | SetIdentity (unsigned) |
void | SetDataFormat (DataFormatEnum dataFormat) |
DataFormatEnum | GetDataFormat () const |
bool | GetEnableAuthentication () const |
void | SetEnableAuthentication (bool enableAuthentication) |
const MByteString & | GetAuthenticationKey () const |
void | SetAuthenticationKey (const MByteString &key) |
unsigned | GetAuthenticationKeyId () const |
void | SetAuthenticationKeyId (unsigned) |
const MByteStringVector & | GetAuthenticationKeyList () const |
void | SetAuthenticationKeyList (const MByteStringVector &) |
bool | GetIssueNegotiateOnStartSession () const |
void | SetIssueNegotiateOnStartSession (bool yes) |
bool | GetIssueTimingSetupOnStartSession () const |
void | SetIssueTimingSetupOnStartSession (bool yes) |
![]() | |
MProtocolC1218 (MChannel *channel, bool channelIsOwned=true) | |
Create a new C12.18 protocol with the channel given. More... | |
virtual | ~MProtocolC1218 () |
Destroy the C12.18 protocol object. | |
int | GetIdentifiedReferenceStandard () const |
Get the reference standard, as identified by the C12.18 Identify command. More... | |
int | GetIdentifiedStandardVersion () const |
Get the standard version, as identified by the C12.18 Identify command. More... | |
int | GetIdentifiedStandardRevision () const |
Get the standard revision, as identified by the C12.18 Identify command. More... | |
bool | GetIdentifiedPropertiesPresent () const |
Tells if Identify command was successful, and IDENTIFIED properties are available. More... | |
unsigned | GetNegotiatedPacketSize () const |
Return the packet size which was negotiated with the meter in the Negotiate command. More... | |
unsigned | GetNegotiatedMaximumNumberOfPackets () const |
Return the maximum number of packets, which was negotiated with the meter in the Negotiate command. More... | |
unsigned | GetNegotiatedSessionBaud () const |
Return the negotiated session baud, which was returned by the meter in the Negotiate command. More... | |
bool | GetNegotiatedPropertiesPresent () const |
Tells if Negotiate command was successful, and negotiated properties are available. More... | |
unsigned | GetIntercharacterTimeout () const |
void | SetIntercharacterTimeout (unsigned timeout) |
unsigned | GetAcknowledgementTimeout () const |
void | SetAcknowledgementTimeout (unsigned timeout) |
unsigned | GetChannelTrafficTimeout () const |
void | SetChannelTrafficTimeout (unsigned timeout) |
unsigned | GetPacketSize () const |
void | SetPacketSize (unsigned packetSize) |
unsigned | GetMaximumNumberOfPackets () const |
void | SetMaximumNumberOfPackets (unsigned num) |
unsigned | GetSessionBaud () const |
void | SetSessionBaud (unsigned sessionBaud) |
bool | GetIssueNegotiateOnStartSession () const |
void | SetIssueNegotiateOnStartSession (bool yes) |
bool | GetIssueLogoffOnEndSession () const |
void | SetIssueLogoffOnEndSession (bool yes) |
unsigned | GetProcedureInitiateTimeout () const |
void | SetProcedureInitiateTimeout (unsigned procedureInitiateTimeout) |
bool | GetNextOutgoingToggleBit () const |
void | SetNextOutgoingToggleBit (bool yes) |
void | SetWakeUpSharedOpticalPort (bool wakeUp) |
bool | GetWakeUpSharedOpticalPort () const |
bool | GetCheckIncomingToggleBit () const |
void | SetCheckIncomingToggleBit (bool doCheck) |
![]() | |
virtual | ~MProtocolC12 () |
Destroy the C12 protocol object. More... | |
virtual void | Logon () |
Perform ANSI C12 Logon service. More... | |
virtual void | Security () |
Perform ANSI C12 Security service. More... | |
virtual void | Logoff () |
Perform ANSI C12 Logoff service. More... | |
virtual void | Wait (unsigned seconds) |
Perform ANSI C12 Wait service. More... | |
virtual void | Terminate () |
Perform ANSI C12 Terminate service. More... | |
virtual Muint16 | CalculateCRC16FromBuffer (const char *buffer, unsigned length) const |
Two-byte CRC calculation procedure specific to C12 protocol. More... | |
unsigned | GetMaximumReadTableSize () const |
Return the maximum possible size of a table to read partially or fully in a single application layer packet. More... | |
virtual unsigned | CalculateChecksumFromBuffer (const char *buffer, unsigned length) const |
Protocol dependent one-byte checksum calculation procedure that uses buffer and its size. More... | |
MByteString | ApplicationLayerRequestResponse (char command, const MByteString &request) |
Perform the full application layer request and return a response. More... | |
char | ReceiveServiceCode () |
Read a code of the incoming application layer data packet. More... | |
Muint8 | ReceiveServiceByte () |
Read one byte from the incoming application layer data packet. More... | |
unsigned | ReceiveServiceUInt (unsigned size) |
Read several bytes from the incoming application layer data packet. More... | |
MByteString | ReceiveServiceBytes (unsigned length) |
Read several bytes of the incoming application layer data packet. More... | |
MByteString | ReceiveServiceRemainingBytes () |
Read bytes of the incoming application layer data packet. More... | |
unsigned | GetLinkLayerRetries () const |
void | SetLinkLayerRetries (unsigned retries) |
bool | GetIssueSecurityOnStartSession () const |
virtual void | SetIssueSecurityOnStartSession (bool) |
ReadFunctionResponseEnum | GetAlwaysReadFunctionResponse () const |
void | SetAlwaysReadFunctionResponse (ReadFunctionResponseEnum value) |
bool | GetAlwaysUsePartial () const |
void | SetAlwaysUsePartial (bool yes) |
bool | GetUseReadInKeepSessionAlive () const |
void | SetUseReadInKeepSessionAlive (bool yes) |
unsigned | GetUserId () const |
void | SetUserId (unsigned userId) |
const MByteString & | GetUser () const |
void | SetUser (const MByteString &userName) |
unsigned | GetTurnAroundDelay () const |
void | SetTurnAroundDelay (unsigned delay) |
unsigned | GetApplicationLayerRetries () const |
void | SetApplicationLayerRetries (unsigned retries) |
unsigned | GetApplicationLayerRetryDelay () const |
void | SetApplicationLayerRetryDelay (unsigned milliseconds) |
unsigned | GetApplicationLayerProcedureRetries () const |
void | SetApplicationLayerProcedureRetries (unsigned retries) |
unsigned | GetApplicationLayerProcedureRetryDelay () const |
void | SetApplicationLayerProcedureRetryDelay (unsigned milliseconds) |
unsigned | GetProcedureSequenceNumber () const |
void | SetProcedureSequenceNumber (unsigned number) |
void | SetEndSessionOnApplicationLayerError (bool endSessionOnApplicationLayerError) |
bool | GetEndSessionOnApplicationLayerError () const |
![]() | |
virtual MProtocol * | CreateClone () const |
Virtual copy constructor, creates the protocol which is a clone of current. More... | |
virtual | ~MProtocol ()=0 |
Destroy the protocol object. More... | |
void | Finalize () |
Execute this method as first action in the destructor of any child protocol. More... | |
unsigned | GetCountApplicationLayerServicesSuccessful () const |
The number of Application Layer services that have been successfully processed. More... | |
void | IncrementCountApplicationLayerServicesSuccessful () |
Increment the number of application layer services successfully processed. More... | |
unsigned | GetCountApplicationLayerServicesRetried () const |
The number of Application Layer services that have been retried. More... | |
void | IncrementCountApplicationLayerServicesRetried () |
Increment the number of application layer services retried. More... | |
unsigned | GetCountApplicationLayerServicesFailed () const |
The number of Application Layer services that have failed. More... | |
void | IncrementCountApplicationLayerServicesFailed () |
Increment the number of application layer services failed. More... | |
unsigned | GetCountLinkLayerPacketsSuccessful () const |
The number of Link Layer packets that have been successfully processed. More... | |
void | IncrementCountLinkLayerPacketsSuccessful () |
Increment the number of data link layer packets successfully processed. More... | |
unsigned | GetCountLinkLayerPacketsRetried () const |
The number of Link Layer packets that have been retried. More... | |
void | IncrementCountLinkLayerPacketsRetried () |
Increment the number of data link layer packets retried. More... | |
unsigned | GetCountLinkLayerPacketsFailed () const |
Get number of data link layer packets failed. More... | |
void | IncrementCountLinkLayerPacketsFailed () |
Increment the number of data link layer packets failed. More... | |
unsigned | GetMaximumRoundTripTime () const |
Gets the maximum measured approximate packet round trip time over the link layer. More... | |
unsigned | GetMinimumRoundTripTime () const |
Gets the minimum measured approximate packet round trip time over the link layer. More... | |
unsigned | GetAverageRoundTripTime () const |
Gets the average measured approximate packet round trip time over the link layer. More... | |
void | ClearPasswordList () |
Set the password list for the protocol to none, so the SetPassword property is used. More... | |
void | AddToPasswordList (const MByteString &password) |
Add a password to the password list. More... | |
int | GetPasswordListSuccessfulEntry () const |
Return the entry, which was successfully tried with the meter. More... | |
void | ResetCounts () |
Clear the statistical data for the channel. More... | |
void | Connect () |
Initializes the channel and establishes the connection with the peer. More... | |
void | Disconnect () |
Severs the connection between the computer and the end device. More... | |
bool | IsConnected () const |
Tells whether the protocol is currently connected. More... | |
bool | IsInSession () const |
Whether the protocol is in session. More... | |
MProgressAction * | CreateRootProgressAction () |
Create root of the progress actions hierarchy. More... | |
MProgressAction * | GetLocalProgressAction () |
Read-only access to the currently preset local action in progress monitor. More... | |
bool | QNeedToCommit () const |
Whether or not it is time to call QCommit(true) in order to sync with the background thread. More... | |
bool | QIsBackgroundCommunicationProgressing () const |
True if the background communication is still progressing. More... | |
bool | QIsDone () |
Combines QNeedToCommit with the following QCommit in case all commands in the queue have been sent. More... | |
void | QAbort () |
Clears the commands in the queue, or cancel the ongoing background communication. More... | |
void | QWriteToMonitor (const MStdString &message) |
Add the message to write to the Monitor log file to MProtocol's command queue. More... | |
void | QConnect () |
Places a Connect command in the queue. More... | |
void | QDisconnect () |
Places a Disconnect command in the queue. More... | |
void | QIdentifyMeter () |
Places an IdentifyMeter task in the queue. More... | |
void | QStartSession () |
Adds a start session command to MProtocol's command queue. More... | |
void | QEndSession () |
Adds an end session command to MProtocol's command queue. More... | |
void | QEndSessionNoThrow () |
EndSessionNoThrow request is queued. More... | |
void | QTableRead (MCOMNumberConstRef number, unsigned expectedSize, int id) |
Adds a ReadTable command to MProtocol's command queue. More... | |
void | QTableWrite (MCOMNumberConstRef number, const MByteString &data) |
Adds a table write command to MProtocol's command queue. More... | |
void | QTableReadPartial (MCOMNumberConstRef number, int offset, int size, int id) |
Adds a partial table read command to MProtocol's command queue. More... | |
void | QTableWritePartial (MCOMNumberConstRef number, const MByteString &data, int offset) |
Adds a partial table write command to MProtocol's command queue. More... | |
void | QFunctionExecute (MCOMNumberConstRef number) |
Place a function without data request in MProtocol command queue. More... | |
void | QFunctionExecuteRequest (MCOMNumberConstRef number, const MByteString &request) |
Place a function with request data in MProtocol's command queue. More... | |
void | QFunctionExecuteResponse (MCOMNumberConstRef number, int id, unsigned estimatedResponseSize=DEFAULT_ESTIMATED_RESPONSE_SIZE) |
Place a function with response data in MProtocol's command queue. More... | |
void | QFunctionExecuteRequestResponse (MCOMNumberConstRef number, const MByteString &request, int id, unsigned estimatedResponseSize=DEFAULT_ESTIMATED_RESPONSE_SIZE) |
Place a function with request and response data in MProtocol's command queue. More... | |
virtual void | QCommit (bool asynchronously=false) |
Executes all operations in MProtocol's command queue. More... | |
MByteString | QGetTableData (MCOMNumberConstRef number, int id=-1) |
Fetch the table data after the table read has been successfully performed by QCommit. More... | |
MByteString | QGetFunctionData (MCOMNumberConstRef number, int id=-1) |
Fetch the function response data after the function has been successfully executed in QCommit. More... | |
MStdString | QGetIdentifyMeterData () |
Fetch the identify meter string after the QIdentifyMeter has been successfully performed in QCommit. More... | |
virtual void | WriteToMonitor (const MStdString &message) |
Synchronously write a message to the monitor, if it is connected. More... | |
void | WriteCountsToMonitor () |
Write running values of communication quality counters to monitor. More... | |
void | StartSession () |
Synchronously start the session. More... | |
void | EndSession () |
Synchronously end the session. More... | |
void | EndSessionNoThrow () |
End the session, but do not throw errors. More... | |
Muint8 | ReadStartByte (const MByteString &setOfValidStartBytes, unsigned trafficTimeout) |
Read the start byte of the packet in a proper way, taking into consideration timeouts and ignoring garbage. More... | |
MByteString | TableRead (MCOMNumberConstRef number, unsigned expectedSize=0) |
Synchronously read the whole table with number given as parameter. More... | |
void | TableReadBuffer (MCOMNumberConstRef number, void *buff, unsigned size) |
Same as ReadTable, but instead of returning a byte string, read table into a given buffer. More... | |
template<class T > | |
void | TableReadBuffer (MCOMNumberConstRef number, T &table) |
Same as ReadTable, but instead of returning a byte string, read table into a given template variable. More... | |
MByteString | TableReadNoThrow (MCOMNumberConstRef number, MException **exception, unsigned expectedSize=0) |
Synchronously read the whole table with number given as parameter, do not throw an exception, but rather return it. More... | |
void | TableWrite (MCOMNumberConstRef number, const MByteString &data) |
Synchronously write the whole table with number given as parameter. More... | |
void | TableWriteBuffer (MCOMNumberConstRef number, const void *data, unsigned size) |
Same as TableWrite, but uses buffer, given as data and size parameters. More... | |
template<class T > | |
void | TableWriteBuffer (MCOMNumberConstRef number, const T &table) |
Same as WriteTable, but uses variable of some specific template class or structure. More... | |
MByteString | TableReadPartial (MCOMNumberConstRef number, int offset, int size) |
Synchronously read part of the table with number given as parameter. More... | |
void | TableReadPartialBuffer (MCOMNumberConstRef number, int offset, void *buff, unsigned size) |
Same as TableReadPartial, but instead of returning a byte string, read table into a given buffer. More... | |
template<class T > | |
void | TableReadPartialBuffer (MCOMNumberConstRef number, T &table, int offset) |
Same as TableReadPartial, but instead of returning a byte string, partially read table into a given template variable. More... | |
void | TableWritePartial (MCOMNumberConstRef number, const MByteString &data, int offset) |
Synchronously write part of the table with number given as parameter. More... | |
void | TableWritePartialBuffer (MCOMNumberConstRef number, int offset, const void *buff, unsigned size) |
Same as TableWritePartial, but instead of using a byte string, write table using a given buffer. More... | |
template<class T > | |
void | TableWritePartialBuffer (MCOMNumberConstRef number, const T &table, int offset) |
Same as TableWritePartial, but instead of using a byte string, write table using a given template class contents. More... | |
void | FunctionExecute (MCOMNumberConstRef number) |
Synchronously execute the function with no parameters, the number of the function is given as parameter. More... | |
void | FunctionExecuteRequest (MCOMNumberConstRef number, const MByteString &request) |
Synchronously execute the function with request data, the number of the function is given as parameter. More... | |
MByteString | FunctionExecuteResponse (MCOMNumberConstRef number) |
Synchronously execute the function with response data, the number of the function is given as parameter. More... | |
MByteString | FunctionExecuteRequestResponse (MCOMNumberConstRef number, const MByteString &request) |
Synchronously execute the function with request and response data, the number of the function is given as parameter. More... | |
virtual unsigned | GetNumberOfDataLinkPackets (MCommunicationCommand::CommandType typeOfRequest, unsigned applicationLayerDataSize=0) |
Return the number of data link packets that are required for a given request, provided an optional size of the application data. More... | |
MStdString | IdentifyMeterWithContext (bool sessionIsStarted=false, TableRawDataVector *tablesRead=NULL) |
Identify the meter if the protocol is known (note this is not an ANSI Identify protocol command). More... | |
unsigned | CalculateChecksum (const MByteString &buffer) const |
Protocol dependent one-byte checksum calculation procedure that uses byte string. More... | |
unsigned | CalculateCRC16 (const MByteString &buffer) const |
Protocol dependent two-byte CRC calculation procedure that accepts the byte string. More... | |
void | Sleep (unsigned milliseconds) |
Calls channel's Sleep method if the channel is present. More... | |
bool | GetMeterIsLittleEndian () const |
void | SetMeterIsLittleEndian (bool isLittleEndian) |
MChannel * | GetChannel () const |
void | SetChannel (MChannel *channel) |
bool | IsChannelOwned () const |
void | SetIsChannelOwned (bool yes) |
bool | GetKeepSessionAlive () const |
void | SetKeepSessionAlive (bool alive) |
MByteString | GetPassword () const |
void | SetPassword (const MByteString &password) |
const MByteStringVector & | GetPasswordList () const |
void | SetPasswordList (const MByteStringVector &passwordList) |
MProgressMonitor * | GetProgressMonitor () const |
void | SetProgressMonitor (MProgressMonitor *p) |
MCommunicationQueue & | GetCommandQueue () |
M_NO_PROGRESS_MONITOR. More... | |
const MCommunicationQueue & | GetCommandQueue () const |
M_NO_PROGRESS_MONITOR. More... | |
MStdString | IdentifyMeter (bool sessionIsStarted=false) |
MStdString | DoIdentifyMeter0 () |
![]() | |
virtual | ~MCOMObject () |
Object destructor. | |
virtual MStdStringVector | GetAllPropertyNames () const |
Return the list of publicly available properties in MCOM syntax. More... | |
virtual MStdStringVector | GetAllPersistentPropertyNames () const |
Return the list of publicly available persistent properties in MCOM syntax. More... | |
MStdString | GetPersistentPropertyValues (bool onlyNondefaults=false, bool excludeSecurityRelated=false) const |
Get the string with the list of persistent property names and their values. More... | |
void | SetPersistentPropertyValues (const MStdString &values) |
Set the persistent properties for the object using the string with the following format: More... | |
void | SetPropertyValues (const MDictionary &values) |
Set the properties for the object using the property list object. More... | |
void | WritePropertiesToMonitor () |
Write all non-default values of protocol properties into monitor. More... | |
MStdString | DoGetPersistentPropertyValues0 () const |
Get the string with the whole list of persistent property names and their values. More... | |
MStdString | DoGetPersistentPropertyValues1 (bool onlyNondefaults) const |
Get the string with the list of persistent property names and their values. More... | |
![]() | |
virtual | ~MObject () |
Object destructor. | |
virtual const MClass * | GetClass () const =0 |
Get the final class of the object. More... | |
virtual unsigned | GetEmbeddedSizeof () const |
For embedded object types, return the size of the class. More... | |
bool | IsEmbeddedObject () const |
Tell if the object is of embedded kind. More... | |
SHOW_INTERNAL MVariant | Call (const MStdString &name, const MVariant ¶ms) |
Call the object service with parameters, given as variant. More... | |
MVariant | Call0 (const MStdString &name) |
Call the object service with no parameters. More... | |
MVariant | Call1 (const MStdString &name, const MVariant &p1) |
Call the object service with one parameter. More... | |
MVariant | Call2 (const MStdString &name, const MVariant &p1, const MVariant &p2) |
Call the object service with two parameter. More... | |
MVariant | Call3 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3) |
Call the object service with three parameter. More... | |
MVariant | Call4 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4) |
Call the object service with four parameter. More... | |
MVariant | Call5 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5) |
Call the object service with five parameter. More... | |
MVariant | Call6 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5, const MVariant &p6) |
Call the object service with six parameter. More... | |
virtual MVariant | CallV (const MStdString &name, const MVariant::VariantVector ¶ms) |
Call the object service with parameters, given as variant vector. More... | |
virtual bool | IsPropertyPresent (const MStdString &name) const |
Tell if the property with the given name exists. | |
virtual bool | IsServicePresent (const MStdString &name) const |
Tell if the service with the given name exists. | |
virtual MVariant | GetProperty (const MStdString &name) const |
Get the property value using name of the property. More... | |
virtual void | SetProperty (const MStdString &name, const MVariant &value) |
Set the property using name of the property, and value. More... | |
virtual void | SetPersistentPropertiesToDefault () |
Set the persistent properties of the object to their default values. More... | |
virtual MVariant | GetPersistentPropertyDefaultValue (const MStdString &name) const |
Get the default value of persistent property with the name given. More... | |
virtual void | SetPersistentPropertyToDefault (const MStdString &name) |
Set the persistent property with the name given to default value. More... | |
virtual const char * | GetType () const |
Get the name of the type for the object (could be the same as class name). | |
virtual void | SetType (const MStdString &) |
Intentionally, it will set the name of the type for the object, but the service will not allow setting the name to anything other than the current name. More... | |
virtual void | Validate () |
Validate internal structures of the object. More... | |
Additional Inherited Members | |
![]() | |
static unsigned | StaticCalculateChecksum (const MByteString &buff) |
Compute checksum of the byte string given as parameters. More... | |
static unsigned | StaticCalculateChecksumFromBuffer (const char *data, unsigned size) |
Compute checksum of the buffer and length given as parameters. More... | |
static Muint16 | StaticCalculateCRC16FromBuffer (const char *buffer, unsigned length) |
Two-byte CRC calculation static procedure specific to C12 protocol. More... | |
static unsigned | CRC16 (const MByteString &buffer) |
Same as above, but taking byte string, reflected. More... | |
![]() | |
static unsigned | StaticCalculateChecksumFromBuffer (const char *buff, unsigned size) |
Most popular one-byte checksum calculation procedure, a sum of all bytes. More... | |
static unsigned | StaticCalculateChecksum (const MByteString &buffer) |
Compute checksum of the byte string given as parameters. More... | |
![]() | |
static const MClass * | GetStaticClass () |
Get the declared class of this particular object. More... | |
static bool | IsClassPresent (const MStdString &name) |
Tells if the given class name is available. More... | |
![]() | |
static const MClass | s_class |
Class of MObject. | |
![]() | |
virtual void | DoEndSession () |
Synchronously end the session, don't do service count. More... | |
![]() | |
MProtocolC12 (MChannel *channel, bool channelIsOwned=true) | |
Create a new abstract ANSI C12 protocol with the channel given. More... | |
![]() | |
MProtocol (MChannel *channel, bool channelIsOwned=true) | |
Create a new abstract protocol with the channel given. More... | |
virtual void | DoTableRead (MCOMNumberConstRef number, MByteString &data, unsigned expectedSize=0) |
Synchronously read the whole table with number given as parameter, don't do service count. More... | |
virtual void | DoTableWrite (MCOMNumberConstRef number, const MByteString &data) |
Synchronously write the whole table with number given as parameter, don't do service count. More... | |
virtual void | DoTableReadPartial (MCOMNumberConstRef number, MByteString &data, int offset, int size) |
Synchronously read part of the table with number given as parameter, don't do service count. More... | |
virtual void | DoTableWritePartial (MCOMNumberConstRef number, const MByteString &data, int offset) |
Synchronously write part of the table with number given as parameter, don't do service count. More... | |
virtual void | DoFunctionExecute (MCOMNumberConstRef number) |
Synchronously execute the function with no parameters, the number of the function is given as parameter, don't do service count. More... | |
virtual void | DoFunctionExecuteRequest (MCOMNumberConstRef number, const MByteString &request) |
Synchronously execute the function with request data, the number of the function is given as parameter, don't do service count. More... | |
virtual void | DoFunctionExecuteResponse (MCOMNumberConstRef number, MByteString &response) |
Synchronously execute the function with response data, the number of the function is given as parameter, don't do service count. More... | |
virtual void | DoFunctionExecuteRequestResponse (MCOMNumberConstRef number, const MByteString &request, MByteString &response) |
Synchronously execute the function with request and response data, the number of the function is given as parameter, don't do service count. More... | |
virtual MStdString | DoIdentifyMeter (bool sessionIsStarted, TableRawDataVector *tablesRead) |
Identify the meter if the protocol is known (note this is not an ANSI Identify protocol command). More... | |
void | DoTryPasswordOrPasswordList () |
Try password or passwords for the protocol according to the PASSWORD and PasswordList settings. More... | |
virtual void | DoTryPasswordEntry (const MByteString &entry) |
Try one password, throw if error. More... | |
virtual void | DoBuildComplexServiceName (MChars fullServiceName, MConstChars serviceName, MCOMNumberConstRef number, int par1=-1, int par2=-1) |
Build service name with a number and given parameters. More... | |
void | DoBuildPossiblyNumericComplexServiceName (MChars fullServiceName, MConstChars serviceName, MCOMNumberConstRef number, bool isHex, int par1=-1, int par2=-1) |
Helper service name builder that can interpret numeric values either as hex or as decimal. More... | |
![]() | |
MCOMObject () | |
Object constructor, protected as the class is abstract. | |
![]() | |
MObject () | |
Object constructor, protected as the class is abstract. | |
void | DoSetPersistentPropertiesToDefault (const MClass *staticClass) |
Set the persistent properties to their default values for one object provided the class for that object. More... | |
ANSI C12.21 protocol implementation.
ANSI Std C12.21-1998 "PROTOCOL SPECIFICATION FOR TELEPHONE MODEM COMMUNICATION", is intended as a single communications standard for Water, Gas, and Electricity meters that will work on any manufacturer's conforming product. A copy of the document can be obtained through NEMA or ANSI. MProtocolC1221 is an extension of MProtocolC1218 and inherits it's properties.
This protocol is intended for working with modems (MChannelModem) or through the serial port channel (MChannelSerialPort). When working through the modem, the GetSessionBaud property of the protocol has no affect.
void MProtocolC1221::Authenticate | ( | ) |
Perform ANSI C12 Authenticate request.
This service is called from StartSession, but it can also be called directly by the user for testing purpose. C12.21 allows authentication procedure for better security.
|
virtual |
Synchronously start the session, don't do service count.
This protected service is indeed the one, which needs overwriting by a particular protocol. Depending on the particular protocol this leads to sequence of handshake and logon commands.
See StartSession, which is public. That one does necessary statistics, monitor handling and error message formatting.
Reimplemented from MProtocolC1218.
|
virtual |
Perform services required by C12.21 protocol to clear security with the meter.
This overridable can call Security, or Authenticate, depending on the current property.
Reimplemented from MProtocolC12.
|
inline |
Return the authentication key for C12.21 Authenticate request.
This property is used during authentication upon starting the C12.21 session.
|
inline |
Authentication key ID for C12.21 Authenticate request.
|
inline |
Authentication key list for the protocol.
The authentication key lists overwrite the authentication key property, when given. These are used to try multiple authentication keys through a single session, which is, no doubt, a too nice security invention.
|
inline |
Protocol data format.
Some meters have the ability to transparently route packets from the meter's optical port to its option board using a C12.22 meter-internal routing mechanism. The DataFormat property determines whether or not this mechanism is used.
The ANSI C12.21 data link packet has a control byte (3rd byte of the packet), where bits 1 .. 0 are reserved and are set to zero in normal communications. In contrast, the ANSI C12.22 standard defines these same bits as the DataFormat. Devices that support the C12.22 meter-internal routing mechanism, have been made to understand the control byte's DataFormat bits when talking C12.21. The value assigned to DataFormat will be the value used for the control byte's bits 1 .. 0.
|
inline |
Tells whether the authentication or security service will be performed by StartSession service.
EnableAuthentication determines whether the authentication service or the security service is sent during the start session. It is only applicable when GetIssueSecurityOnStartSession is True. When IssueSecurityOnStartSession is False, then EnableAuthentication is ignored as neither the authenticate service nor the security service will be sent to the device.
When EnableAuthentication is True (and IssueSecurityOnStartSession is True), the authenticate service is sent. Use the properties GetAuthenticationKey, and GetAuthenticationKeyId to set the key for the authenticate service.
When EnableAuthentication is False (and IssueSecurityOnStartSession is True), the security service is sent. Use SetPassword property to set the password for the security service.
MeteringSDK has a check prior to sending the authenticate service. When an identify service is sent (always the first service sent in a start session sequence), the device responds with what it supports. If it says that it does not support authentication, then MeteringSDK aborts the start session sequence and throws the error "Meter does not support authentication".
Refer to the ANSI protocol standards for more information on the start session, security, and authenticate services.
int MProtocolC1221::GetIdentifiedAuthenticationAlgorithm | ( | ) | const |
Get the authentication algorithm, as received by C12.21 Identify service.
This property is available only after the ANSI C12.21 Identify request is executed (for example, through a start session sequence). The value of this property will persist unchanged until the identification of a different meter is performed. If the property is queried before a successful Identify request, an error will be raised. The property GetIdentifiedPropertiesPresent can be used to determine if the IdentifiedAuthenticationAlgorithm is available.
|
inline |
End device identity property, the number that uniquely identifies the device.
The notion of a device number is referred to as "Identity" in C12.21. In a multi-drop installation, it must be specified to target communications to a specific meter. Setting this property to zero targets all meters at once. This value is encoded in every packet sent to the meter.
|
inline |
Get the end device data format.
It keeps two bits of ctrl field of link-layer packet
|
inline |
Get the end device incoming identity.
The identity is the number that uniquely identifies the device.
|
inline |
Return true if the Negotiate will be applied on starting the session.
|
inline |
Determines whether or not the start session will issue the C12.21 timing setup service.
When true, the timing setup service is issued with the values of GetChannelTrafficTimeout, GetIntercharacterTimeout, GetAcknowledgementTimeout and GetLinkLayerRetries given as parameters to the timing setup service.
When false, the timing setup service is not issued and instead the default values as defined by the ANSI C12.21 standard are used for communications. In this case, setting the values of SetChannelTrafficTimeout, SetIntercharacterTimeout, SetAcknowledgementTimeout, or SetLinkLayerRetries, has no affect on communications, and getting their values does not necessarily reflect the values used during communications.
Set IssueTimingSetupOnStartSession to False for devices that do not support the timing setup service. The ANSI C12.21 protocol specifies that the timing setup service is optional and end devices can respond with Service Not Supported (SNS). When MeteringSDK receives a SNS from the end device, it passes the error back to the caller and does not continue with communications.
|
virtual |
Perform ANSI C12 Identify request.
This service is called from StartSession, but it can also be called directly by the user for testing purpose. The implementation of C12.21 differs from C12.18 in the aspect that the authentication algorithm is supplied by the meter.
Reimplemented from MProtocolC1218.
|
virtual |
Perform ANSI C12 Negotiate request.
This service is called from StartSession, but it can also be called directly by the user for testing purpose. The implementation negotiates packet size, and number of packets. Whether the baud rate will be negotiated depends whether the protocol uses the modem channel (in this case no baud rate is negotiated, code 0x60), or the optical probe channel (in this case one baud rate is negotiated, command 0x61).
Reimplemented from MProtocolC1218.
void MProtocolC1221::SetAuthenticationKey | ( | const MByteString & | key | ) |
Return the authentication key for C12.21 Authenticate request.
This property is used during authentication upon starting the C12.21 session.
void MProtocolC1221::SetAuthenticationKeyId | ( | unsigned | ) |
Authentication key ID for C12.21 Authenticate request.
void MProtocolC1221::SetAuthenticationKeyList | ( | const MByteStringVector & | ) |
Authentication key list for the protocol.
The authentication key lists overwrite the authentication key property, when given. These are used to try multiple authentication keys through a single session, which is, no doubt, a too nice security invention.
void MProtocolC1221::SetDataFormat | ( | DataFormatEnum | dataFormat | ) |
Protocol data format.
Some meters have the ability to transparently route packets from the meter's optical port to its option board using a C12.22 meter-internal routing mechanism. The DataFormat property determines whether or not this mechanism is used.
The ANSI C12.21 data link packet has a control byte (3rd byte of the packet), where bits 1 .. 0 are reserved and are set to zero in normal communications. In contrast, the ANSI C12.22 standard defines these same bits as the DataFormat. Devices that support the C12.22 meter-internal routing mechanism, have been made to understand the control byte's DataFormat bits when talking C12.21. The value assigned to DataFormat will be the value used for the control byte's bits 1 .. 0.
|
inline |
Tells whether the authentication or security service will be performed by StartSession service.
EnableAuthentication determines whether the authentication service or the security service is sent during the start session. It is only applicable when GetIssueSecurityOnStartSession is True. When IssueSecurityOnStartSession is False, then EnableAuthentication is ignored as neither the authenticate service nor the security service will be sent to the device.
When EnableAuthentication is True (and IssueSecurityOnStartSession is True), the authenticate service is sent. Use the properties GetAuthenticationKey, and GetAuthenticationKeyId to set the key for the authenticate service.
When EnableAuthentication is False (and IssueSecurityOnStartSession is True), the security service is sent. Use SetPassword property to set the password for the security service.
MeteringSDK has a check prior to sending the authenticate service. When an identify service is sent (always the first service sent in a start session sequence), the device responds with what it supports. If it says that it does not support authentication, then MeteringSDK aborts the start session sequence and throws the error "Meter does not support authentication".
Refer to the ANSI protocol standards for more information on the start session, security, and authenticate services.
void MProtocolC1221::SetIdentity | ( | unsigned | ) |
End device identity property, the number that uniquely identifies the device.
The notion of a device number is referred to as "Identity" in C12.21. In a multi-drop installation, it must be specified to target communications to a specific meter. Setting this property to zero targets all meters at once. This value is encoded in every packet sent to the meter.
|
inline |
Return true if the Negotiate will be applied on starting the session.
|
inline |
Determines whether or not the start session will issue the C12.21 timing setup service.
When true, the timing setup service is issued with the values of GetChannelTrafficTimeout, GetIntercharacterTimeout, GetAcknowledgementTimeout and GetLinkLayerRetries given as parameters to the timing setup service.
When false, the timing setup service is not issued and instead the default values as defined by the ANSI C12.21 standard are used for communications. In this case, setting the values of SetChannelTrafficTimeout, SetIntercharacterTimeout, SetAcknowledgementTimeout, or SetLinkLayerRetries, has no affect on communications, and getting their values does not necessarily reflect the values used during communications.
Set IssueTimingSetupOnStartSession to False for devices that do not support the timing setup service. The ANSI C12.21 protocol specifies that the timing setup service is optional and end devices can respond with Service Not Supported (SNS). When MeteringSDK receives a SNS from the end device, it passes the error back to the caller and does not continue with communications.
void MProtocolC1221::TimingSetup | ( | ) |
Perform ANSI C12 TimingSetup request.
This service is called from StartSession, but it can also be called directly by the user for testing purpose. C12.21 allows negotiating the session timing values, as the modems or similar devices might have very different timing characteristics.
void MProtocolC1221::TimingSetupWithWorkaround | ( | ) |
Perform ANSI C12 TimingSetup request, and assume a potentially buggy device that does tries instead of retries.
IF the link layer retries are not zero, the behavior of this method is exactly like one of TimingSetup.