C12Adapter Opensource C++ Interface
MChannelModem Class Reference

Modem channel is a channel based on serial port. More...

Inheritance diagram for MChannelModem:

Public Types

enum  MModemResponse {
  MODEM_RESPONSE_UNKNOWN,
  MODEM_RESPONSE_OK,
  MODEM_RESPONSE_CONNECT,
  MODEM_RESPONSE_RING,
  MODEM_RESPONSE_NO_CARRIER,
  MODEM_RESPONSE_ERROR,
  MODEM_RESPONSE_TIMEOUT,
  MODEM_RESPONSE_NO_DIALTONE,
  MODEM_RESPONSE_BUSY,
  MODEM_RESPONSE_NO_ANSWER
}
 Possible modem response codes. More...
 
- Public Types inherited from MChannel
enum  { CANCEL_COMMUNICATION_CHECK_OPTIMUM_INTERVAL = 1000 }
 

Public Member Functions

 MChannelModem ()
 Create a channel with initial parameters.
 
virtual ~MChannelModem ()
 Destroy channel modem. More...
 
virtual void Connect ()
 Connect to the meter, where connection means hook off, dialing phone number, checking for modem responses. More...
 
virtual void WaitForNextIncomingConnection (bool reinitialize=true)
 When GetAutoAnswer true, wait for the incoming connection without disconnecting the channel. More...
 
virtual void Disconnect ()
 Disconnect channel. More...
 
virtual bool IsConnected () const
 Returns true if channel is connected and false otherwise. More...
 
virtual void CheckIfConnected ()
 Throw an appropriate exception if the channel is not connected. More...
 
const MByteStringGetModemResponse () const
 Full modem response after the successful connection, or after any successful control command. More...
 
virtual void CancelCommunication (bool callDisconnect=false)
 Request canceling of the communication. More...
 
void HookOn ()
 Auxiliary function "hook on". More...
 
void SendCommand (const MByteString &command)
 Send command to the modem and complete it with line completion char (see m_lineCompletionChar). More...
 
MByteString ReceiveResponse ()
 Receive response string from the modem after the command was sent. More...
 
MModemResponse ReceiveKnownResponse (int timeout)
 Get the response which is enlisted in MModemResponse type definition. More...
 
void SendCommandCheckOK (const MByteString &command)
 Send command and completion char then check response for OK. More...
 
const MByteStringGetAutoAnswerString () const
 
void SetAutoAnswerString (const MByteString &autoAnswerString)
 
const MByteStringGetInitString () const
 
void SetInitString (const MByteString &initString)
 
const MByteStringGetDialString () const
 
void SetDialString (const MByteString &dialString)
 
const MByteStringGetPhoneNumber () const
 
void SetPhoneNumber (const MByteString &phoneNumber)
 
unsigned GetDialTimeout () const
 
void SetDialTimeout (unsigned timeout)
 
unsigned GetCommandTimeout () const
 
void SetCommandTimeout (unsigned timeout)
 
bool GetMatchConnectBaud () const
 
void SetMatchConnectBaud (bool doMatch)
 
- Public Member Functions inherited from MChannelSerialPort
 MChannelSerialPort ()
 Construct serial port channel.
 
virtual ~MChannelSerialPort ()
 Destructor.
 
virtual void FlushOutputBuffer (unsigned numberOfCharsInBuffer=UINT_MAX)
 Ensure that the characters from the output buffer are sent. More...
 
void SetParameters (unsigned baud, int dataBits, char parity, int stopBits)
 SetParameters is a convenience function for setting the properties baud rate, number of data bits, parity, and number of stop bits in a single call.
 
bool GetDCD () const
 The current state of the DCD signal of the port. More...
 
virtual MStdString GetMediaIdentification () const
 Return a string that will identify the media through which this channel is talking to. More...
 
const MStdStringGetPortName () const
 
void SetPortName (const MStdString &portName)
 
unsigned GetBaud () const
 
void SetBaud (unsigned baud)
 
char GetParity () const
 
void SetParity (char p)
 
int GetStopBits () const
 
void SetStopBits (int stopBits)
 
int GetDataBits () const
 
void SetDataBits (int dataBits)
 
bool GetCtsFlow () const
 
void SetCtsFlow (bool isCtsFlow)
 
bool GetDsrFlow () const
 
void SetDsrFlow (bool isDsrFlow)
 
bool GetDsrSensitivity () const
 
void SetDsrSensitivity (bool isDsrSens)
 
char GetDtrControl () const
 
void SetDtrControl (char dtrControl)
 
char GetRtsControl () const
 
void SetRtsControl (char rtsControl)
 
MSerialPortGetPort ()
 
const MSerialPortGetPort () const
 
- Public Member Functions inherited from MChannel
virtual MChannelCreateClone () const
 Virtual copy constructor, creates the channel, which is a clone of current. More...
 
virtual ~MChannel ()
 The destructor is public, and virtual. More...
 
void WriteBytes (const MByteString &buffer)
 Writes the data to the channel, and returns when the last byte has been sent by the software. More...
 
void WriteByte (Muint8 b)
 Writes a byte to the channel, and returns when it has been sent. More...
 
void WriteBuffer (const char *buf, unsigned len)
 Writes the data buffer to the channel, and returns when the last character has been sent by the software (but hardware might still need to do some work). More...
 
Muint8 ReadByte ()
 Read a single byte from the channel. More...
 
void ReadBuffer (char *buf, unsigned numberToRead)
 Read an exact number of characters from the channel. More...
 
void Unread (const MVariant &byteOrBytes)
 Return the given byte or bytes to the stream buffer so they get read at the next read operation. More...
 
void UnreadBuffer (const char *buff, unsigned size)
 Return the given bytes to the stream buffer so they get read at the next read operation. More...
 
MByteString ReadBytes (unsigned numberToRead)
 Read bytes directly from the communication channel. More...
 
MByteString ReadBytesUntil (const MByteString &terminatingString)
 Read bytes from the channel until a specified sequence is read. More...
 
MByteString ReadBytesUntilAnyByte (const char *finisher, unsigned finisherSize, unsigned headerSize, unsigned footerSize)
 Read bytes from the channel until a specified sequence is read. More...
 
MByteString ReadAllBytes ()
 Read an arbitrary number of characters from the channel, as much as available. More...
 
void ClearInputBuffer ()
 Immediately discards all the pending characters from the channel. More...
 
void ClearInputUntilSilence (unsigned milliseconds)
 Keep reading and ignoring input until there is silence. More...
 
void CheckIfConnectedConst () const
 Throw an appropriate exception if the channel is not connected, constant version. More...
 
unsigned GetCountBytesSent () const
 Number of bytes sent through the channel since its creation or since the last ResetCounts(). More...
 
unsigned GetCountBytesReceived () const
 The number of bytes received through the channel since creation or since the last ResetCounts(). More...
 
void ResetCounts ()
 Reset channel statistical data, so the counters become zeros. More...
 
virtual void WriteToMonitor (const MStdString &message)
 Synchronously write a message to the monitor, if it is connected. More...
 
void EnterUninterruptibleCommunication (bool notify=true)
 Enter a communication sequence that shall not be be interrupted with CancelCommunication call. More...
 
void LeaveUninterruptibleCommunication (bool notify=true)
 Leave a communication sequence that shall not be be interrupted with CancelCommunication call. More...
 
void CheckIfOperationIsCancelled ()
 Check if the user has requested the termination of the communication, and whether the cancel operation lock is zero. More...
 
void Sleep (unsigned milliseconds)
 Channel version of Sleep, a delay function that is aware of cancel communication event. More...
 
unsigned ReadWithTimeout (char *buf, unsigned size, unsigned timeout)
 Read up to size bytes into buffer using the given timeout. More...
 
bool GetAutoAnswer () const
 
void SetAutoAnswer (bool isAutoAnswer)
 
unsigned GetAutoAnswerTimeout () const
 
void SetAutoAnswerTimeout (unsigned timeout)
 
void SetMonitor (MMonitor::Pointer monitor)
 
MMonitor::Pointer GetMonitor () const
 
SHOW_INTERNAL bool GetEcho () const
 
void SetEcho (bool echo)
 
bool GetSendEchoBytesToMonitor () const
 
void SetSendEchoBytesToMonitor (bool doSend)
 
unsigned GetIntercharacterTimeout () const
 
void SetIntercharacterTimeout (unsigned timeout)
 
unsigned GetReadTimeout () const
 
void SetReadTimeout (unsigned timeout)
 
unsigned GetWriteTimeout () const
 
void SetWriteTimeout (unsigned timeout)
 
- Public Member Functions inherited from MCOMObject
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...
 
- Public Member Functions inherited from MObject
virtual ~MObject ()
 Object destructor.
 
virtual const MClassGetClass () 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 &params)
 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 &params)
 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 Public Member Functions inherited from MChannelSerialPort
static MStdStringVector GetAvailablePortNames (bool addExtraInfo=false)
 Return a collection of serial port names available at this computer. More...
 
static MStdString GetPortType (const MStdString &portName)
 Get type based on the port name. More...
 
- Static Public Member Functions inherited from MObject
static const MClassGetStaticClass ()
 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 Public Attributes inherited from MObject
static const MClass s_class
 Class of MObject.
 
- Protected Member Functions inherited from MChannel
 MChannel ()
 Construct the channel object from parent class. More...
 
- Protected Member Functions inherited from MCOMObject
 MCOMObject ()
 Object constructor, protected as the class is abstract.
 
- Protected Member Functions inherited from MObject
 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...
 

Detailed Description

Modem channel is a channel based on serial port.

Win-modems and the other modems that are not based on the serial port have to be separate classes. Among the COM port modems, only Hayes compatible modems are supported.

The connection attempt can take a long time to complete or time out. If the connection is queued with QConnect and committed asynchronously with QCommit(True), then the connection can be aborted with QAbort.

Member Enumeration Documentation

Possible modem response codes.

Not all modems can handle enumerated responses, but most of them can.

Enumerator
MODEM_RESPONSE_UNKNOWN 

Unknown modem response or timeout as a result of some functions.

MODEM_RESPONSE_OK 

OK response.

MODEM_RESPONSE_CONNECT 

Any kind of CONNECT response (CONNECT 19200, CONNECT 9600 and so on)

MODEM_RESPONSE_RING 

RING response.

MODEM_RESPONSE_NO_CARRIER 

NO CARRIER response.

MODEM_RESPONSE_ERROR 

ERROR response.

MODEM_RESPONSE_TIMEOUT 

TIMEOUT response.

MODEM_RESPONSE_NO_DIALTONE 

NO DIAL TONE response.

MODEM_RESPONSE_BUSY 

BUSY response.

MODEM_RESPONSE_NO_ANSWER 

NO ANSWER response.

Constructor & Destructor Documentation

virtual MChannelModem::~MChannelModem ( )
virtual

Destroy channel modem.

Precondition
If channel is connected then it will be disconnected.

Member Function Documentation

virtual void MChannelModem::CancelCommunication ( bool  callDisconnect = false)
virtual

Request canceling of the communication.

This service is overloaded to support canceling of modem dialing. Disconnect will be called only if the parameter of the function is true.

Reimplemented from MChannel.

virtual void MChannelModem::CheckIfConnected ( )
virtual

Throw an appropriate exception if the channel is not connected.

The exception can be different depending on whether the connection was not made previously, or if the connection was unexpectedly terminated.

Precondition
The channel is connected, or an exception is thrown.

Reimplemented from MChannel.

virtual void MChannelModem::Connect ( )
virtual

Connect to the meter, where connection means hook off, dialing phone number, checking for modem responses.

If the channel is configured with GetAutoAnswer false, then the channel attempts to connect using the configured GetPhoneNumber, GetBaud, GetInitString, GetDialString, and GetDialTimeout. An exception is thrown if the connection cannot be established during the Dial Timeout.

If the channel is configured with GetAutoAnswer true, the channel waits GetAutoAnswerTimeout for the connection to be established. If after the first ring, the connection cannot be established during GetDialTimeout, then the channel continues to wait for the remaining Auto Answer Timeout for another call. If the connection cannot be established during the Auto Answer Timeout, an exception is thrown.

Precondition
Connect throws an exception if the connection to the meter has already been made, one can use IsConnected to check. Many operating system and program exceptions can be thrown by this method.

Reimplemented from MChannelSerialPort.

virtual void MChannelModem::Disconnect ( )
virtual

Disconnect channel.

This service can be called as many times as the user wants. Not exception will be thrown. Disconnect means hook on.

Reimplemented from MChannelSerialPort.

const MByteString& MChannelModem::GetAutoAnswerString ( ) const
inline

The AT command used to put the modem into Auto Answer mode. The channel must also be configured with SetAutoAnswer true.

The connection attempt can take a long time to complete or time out. If the connection is queued with QConnect and committed asynchronously with QCommit(True), then the connection can be aborted with QAbort.

Since
MeteringSDK Version 2.1.27.
Default value:
"ATS0=1"
Possible values:
Precondition
Channel is not connected, otherwise the behavior is unpredictable.
unsigned MChannelModem::GetCommandTimeout ( ) const
inline

Command timeout.

Number of seconds to wait for the completion of a command until an answer is received.

Since
MeteringSDK Version 2.1.27.
Default value:
10 seconds
Possible values:
  • Typically about 2 seconds for most modems.
const MByteString& MChannelModem::GetDialString ( ) const
inline

The string that initiates dialing, typically this is the ATD command. The "DialString" and "PhoneNumber" are combined to yield the full dialing command that is sent to the modem.

Since
MeteringSDK Version 2.1.27.
Default value:
"ATD"
Possible values:
Precondition
Channel is not connected. Otherwise the behavior is unpredictable.
unsigned MChannelModem::GetDialTimeout ( ) const
inline

Dial timeout.

Number of seconds to wait for the connection after dialing the phone number. SetAutoAnswer must be False for the channel to make an outbound call. This property is not used for inbound calls (when Auto Answer = True).

The connection attempt can take a long time to complete or time out. If the connection is queued with QConnect and committed asynchronously with QCommit(True), then the connection can be aborted with QAbort.

Since
MeteringSDK Version 2.1.27.
Default value:
60 seconds
Possible values:
  • Typically 30 to 60 seconds. Anything below 10 will most likely fail.
const MByteString& MChannelModem::GetInitString ( ) const
inline

This is the modem initialization string sent to the modem prior to making a phone call (GetAutoAnswer = False) or prior to waiting for a phone call (GetAutoAnswer = True). Not all modems support the same commands, and the InitString may need to be tuned for your particular modem. For our MODEM channel implementation, the modem needs to be told to turn echo off, return verbal result codes, track the DCD state, and hang up when the DTR line is dropped. All of these modem commands are included in the InitString default value and are described in the Default Value section below.

Since
MeteringSDK Version 2.1.27.
Default value:
"ATZE0Q0V1&C1&D2"
- Z resets the modem to its default settings.
- E0 tells the modem to turn echo off.
- Q0V1 tells the modem to turn quiet mode off and return verbal result codes.
- &C1 tells the modem to track the Data Carrier Detection state, instead of forcing it high.
- &D2 tells the modem to hang up when the DTR line is dropped. Use caution when changing this value. If the phone call is not disconnected when the DTR line is dropped, you could end up with a huge phone bill.
Possible values:
Precondition
Channel is not connected. Otherwise the behavior is unpredictable.
bool MChannelModem::GetMatchConnectBaud ( ) const
inline

Whether to match port and modem baud rates.

When this flag is true, then during connection, the CONNECT response from the meter is parsed in order to recognize the line connect speed. If the number is present, the software tries to set the modem speed to match the connect speed (or to be slightly below it), so there is no need for the flow control to be imposed between the modem and the computer. This is rarely needed, but is available for those internal modems which do not support flow control.

If the flag is set to false, no attempt to match port and modem baud rates is made.

Since
MeteringSDK Version 2.1.27.
Default value:
False : Satisfactory for most modems
Possible values:
  • True [1]
  • False [0]
const MByteString& MChannelModem::GetModemResponse ( ) const
inline

Full modem response after the successful connection, or after any successful control command.

All non-printable characters will be replaced with blanks. The modem can be configured to respond with numeric codes instead of verbs, however MeteringSDK can not interpret them and will throw an "unknown response from the modem" error.

The modem response is the response sent by the modem in response to a MeteringSDK Connect attempt. The response could contain text like CONNECT 2400, ERROR, BUSY, NO CARRIER, etc. anything that the modem will respond with.

This property will be an empty string if queried before the connect attempt or if MeteringSDK did not get the modem response during the connect attempt.

Since
MeteringSDK Version 3.1.5.
Default value:
"" (empty string)
const MByteString& MChannelModem::GetPhoneNumber ( ) const
inline

The phone number to be dialed. Typically, this would be just a phone number like 555-5555, but it can contain a number of control characters, like P, T, comma, etc. The "DialString" and "PhoneNumber" are combined to yield the full dialing command that is sent to the modem.

Since
MeteringSDK Version 2.1.27.
Default value:
"" (empty string)
Possible values:
  • Your best resource will be your modem manual. You can also find online documentation for modem commands at sites like www.modem.com/general/extendat.html or http://en.wikipedia.org/wiki/Hayes_command_set. Some of the possible values are "" (modem goes off-hook without dialing), "P555-5555" (pulse dial a local number, "T1,(919) 123-4567" (tone dial a long distance number with a pause after the 1).
Precondition
Channel is not connected. Otherwise the behavior is unpredictable.
void MChannelModem::HookOn ( )

Auxiliary function "hook on".

Hook on is made by setting DTR low, then high, which works on the most of modems. "+++" command is not used.

Precondition
Serial port is opened.
virtual bool MChannelModem::IsConnected ( ) const
virtual

Returns true if channel is connected and false otherwise.

Can be called at any time.

Reimplemented from MChannelSerialPort.

MModemResponse MChannelModem::ReceiveKnownResponse ( int  timeout)

Get the response which is enlisted in MModemResponse type definition.

Possibly return MODEM_RESPONSE_UNKNOWN.

Precondition
Channel is in the command mode.
MByteString MChannelModem::ReceiveResponse ( )

Receive response string from the modem after the command was sent.

Precondition
Modem was sent by the command.
void MChannelModem::SendCommand ( const MByteString command)

Send command to the modem and complete it with line completion char (see m_lineCompletionChar).

Precondition
Channel is in command mode.
void MChannelModem::SendCommandCheckOK ( const MByteString command)

Send command and completion char then check response for OK.

If no response is received before 'm_commandTimeout' timeout expires, or the response is not OK then the appropriate exception will be raised.

Precondition
Modem is in command mode.
void MChannelModem::SetAutoAnswerString ( const MByteString autoAnswerString)
inline

The AT command used to put the modem into Auto Answer mode. The channel must also be configured with SetAutoAnswer true.

The connection attempt can take a long time to complete or time out. If the connection is queued with QConnect and committed asynchronously with QCommit(True), then the connection can be aborted with QAbort.

Since
MeteringSDK Version 2.1.27.
Default value:
"ATS0=1"
Possible values:
Precondition
Channel is not connected, otherwise the behavior is unpredictable.
void MChannelModem::SetCommandTimeout ( unsigned  timeout)
inline

Command timeout.

Number of seconds to wait for the completion of a command until an answer is received.

Since
MeteringSDK Version 2.1.27.
Default value:
10 seconds
Possible values:
  • Typically about 2 seconds for most modems.
void MChannelModem::SetDialString ( const MByteString dialString)
inline

The string that initiates dialing, typically this is the ATD command. The "DialString" and "PhoneNumber" are combined to yield the full dialing command that is sent to the modem.

Since
MeteringSDK Version 2.1.27.
Default value:
"ATD"
Possible values:
Precondition
Channel is not connected. Otherwise the behavior is unpredictable.
void MChannelModem::SetDialTimeout ( unsigned  timeout)
inline

Dial timeout.

Number of seconds to wait for the connection after dialing the phone number. SetAutoAnswer must be False for the channel to make an outbound call. This property is not used for inbound calls (when Auto Answer = True).

The connection attempt can take a long time to complete or time out. If the connection is queued with QConnect and committed asynchronously with QCommit(True), then the connection can be aborted with QAbort.

Since
MeteringSDK Version 2.1.27.
Default value:
60 seconds
Possible values:
  • Typically 30 to 60 seconds. Anything below 10 will most likely fail.
void MChannelModem::SetInitString ( const MByteString initString)
inline

This is the modem initialization string sent to the modem prior to making a phone call (GetAutoAnswer = False) or prior to waiting for a phone call (GetAutoAnswer = True). Not all modems support the same commands, and the InitString may need to be tuned for your particular modem. For our MODEM channel implementation, the modem needs to be told to turn echo off, return verbal result codes, track the DCD state, and hang up when the DTR line is dropped. All of these modem commands are included in the InitString default value and are described in the Default Value section below.

Since
MeteringSDK Version 2.1.27.
Default value:
"ATZE0Q0V1&C1&D2"
- Z resets the modem to its default settings.
- E0 tells the modem to turn echo off.
- Q0V1 tells the modem to turn quiet mode off and return verbal result codes.
- &C1 tells the modem to track the Data Carrier Detection state, instead of forcing it high.
- &D2 tells the modem to hang up when the DTR line is dropped. Use caution when changing this value. If the phone call is not disconnected when the DTR line is dropped, you could end up with a huge phone bill.
Possible values:
Precondition
Channel is not connected. Otherwise the behavior is unpredictable.
void MChannelModem::SetMatchConnectBaud ( bool  doMatch)
inline

Whether to match port and modem baud rates.

When this flag is true, then during connection, the CONNECT response from the meter is parsed in order to recognize the line connect speed. If the number is present, the software tries to set the modem speed to match the connect speed (or to be slightly below it), so there is no need for the flow control to be imposed between the modem and the computer. This is rarely needed, but is available for those internal modems which do not support flow control.

If the flag is set to false, no attempt to match port and modem baud rates is made.

Since
MeteringSDK Version 2.1.27.
Default value:
False : Satisfactory for most modems
Possible values:
  • True [1]
  • False [0]
void MChannelModem::SetPhoneNumber ( const MByteString phoneNumber)
inline

The phone number to be dialed. Typically, this would be just a phone number like 555-5555, but it can contain a number of control characters, like P, T, comma, etc. The "DialString" and "PhoneNumber" are combined to yield the full dialing command that is sent to the modem.

Since
MeteringSDK Version 2.1.27.
Default value:
"" (empty string)
Possible values:
  • Your best resource will be your modem manual. You can also find online documentation for modem commands at sites like www.modem.com/general/extendat.html or http://en.wikipedia.org/wiki/Hayes_command_set. Some of the possible values are "" (modem goes off-hook without dialing), "P555-5555" (pulse dial a local number, "T1,(919) 123-4567" (tone dial a long distance number with a pause after the 1).
Precondition
Channel is not connected. Otherwise the behavior is unpredictable.
virtual void MChannelModem::WaitForNextIncomingConnection ( bool  reinitialize = true)
virtual

When GetAutoAnswer true, wait for the incoming connection without disconnecting the channel.

A typical server application sequence that uses this call:

Connect() // wait for the first incoming connection
loop until interrupted:
... communicate ...
WaitForNextIncomingConnection() // wait for the next incoming connection
end loop
Parameters
reinitializeTells if the channel is reinitialized for each new incoming connection.
Precondition
Prior to this call, the channel needs to be configured with SetAutoAnswer true, and the connection established with Connect(). Not all channels support auto answer mode, and might throw an exception. A timeout exception is thrown if no call is received during the GetAutoAnswerTimeout period.

Reimplemented from MChannelSerialPort.