!if 0
Copyright (c) Microsoft Corporation.  All rights reserved.
!endif
!if 0
This source code is licensed under Microsoft Shared Source License
Version 1.0 for Windows CE.
For a copy of the license visit http://go.microsoft.com/fwlink/?LinkId=3223.
!endif
This file provides an overview of the registry settings which affect the 
behaviour of modems under WinCE. 

The following examples explain all the available modem related registry keys and
values for PCMCIA and non-PCMCIA modems.
To enable multiple TAPI service providers, service provider specific values for
a particular device exist in a subkey of the device. When a new device driver is
loaded, the device manager looks for a subkey which contains a "Tsp" value and
notifies TAPI. TAPI loads the service provider and passes it a pointer to its
specific values.

1. PCMCIA Modem Example (also explains all of the modem registry values)
------------------------------------------------------------------------

In this example, I assume a fictitous modem with the PCMCIA ID
"CompanyX-GenericModem-1234".  For an actual modem, you would replace this
string with the PNP ID, which is always of the form
CompanyName-ModelName-Checksum.

------------ Sample Registry Setting -----------------------------

[HKEY_LOCAL_MACHINE\Drivers\PCMCIA\CompanyX-GenericModem-1234]
   "Prefix"="COM"
   "Dll"="Serial.dll"
   "ResetDelay"=dword:800

[HKEY_LOCAL_MACHINE\Drivers\PCMCIA\CompanyX-GenericModem-1234\Unimodem]
   "Tsp"="Unimodem.dll"
   "FriendlyName"="CompanyX Generic Modem"
   "DeviceType"=dword:3
   "DevConfig"=hex: 10,00, 00,00, 78,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00
   
[HKEY_LOCAL_MACHINE\Drivers\PCMCIA\CompanyX-GenericModem-1234\Unimodem\Init]
   "1"="AT<cr>"
   "2"="ATE0V1&C1&D2<cr>"
   "3"="ATS7=60M1<cr>"

[HKEY_LOCAL_MACHINE\Drivers\PCMCIA\CompanyX-GenericModem-1234\Unimodem\Settings]
   "MaxCmd"=dword:40
   "Prefix"="AT"
   "Terminator"="<cr>"
   "DialPrefix"="D"
   "DialSuffix"=";"
   "DialBilling"=dword:1
   "Pulse"="P"
   "Tone"="T"
   "Blind_Off"="X4"
   "Blind_On"="X3"
   "CallSetupFailTimeout"="S7=<#>"
   "Reset"="ATZ<cr>"
   "FlowHard"="AT\Q3<cr>"
   "FlowSoft"="AT\Q1<cr>"
   "FlowOff"="AT\Q<cr>"
   "Answer"="ATA<cr>"
   "Monitor"="ATS0=0<cr>"
-------------------------------------------------------------------

Note that the above registry settings constitute a fully qualified set
of values.  For efficieny, Unimodem actually supports a default for
many of these values.  If you do not specify a modem specific value,
then Unimodem will attempt to read that value from a default set of 
registry values.  The available defaults are detailed below.

For example, if we removed value "1" from the \init key above, then 
Unimodem would instead use the value from the Unimodem\init key shown 
below.

-------------------- Default Registry Settings --------------------

[HKEY_LOCAL_MACHINE\Drivers\PCMCIA\Modem]
   "Prefix"="COM"
   "Dll"="Serial.Dll"
   "ResetDelay"=dword:300

[HKEY_LOCAL_MACHINE\Drivers\PCMCIA\Modem\Unimodem]
   "Tsp"="Unimodem.dll"
   "DeviceType"=dword:3

[HKEY_LOCAL_MACHINE\Drivers\Unimodem]
   "DevConfig"=hex: 10,00, 00,00, 78,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00

[HKEY_LOCAL_MACHINE\Drivers\Unimodem\Init]
   "1"="AT<cr>"
   "2"="ATE0V1&C1&D2<cr>"

[HKEY_LOCAL_MACHINE\Drivers\Unimodem\Settings]
   "Prefix"="AT"
   "Terminator"="<cr>"
   "DialPrefix"="D"
   "DialSuffix"=";"
   "Pulse"="P"
   "Tone"="T"
   "Blind_Off"="X4"
   "Blind_On"="X3"
   "CallSetupFailTimeout"="S7=<#>"
   "Reset"="ATZ<cr>"

-------------------------------------------------------------------


Following is a description of each of these keys/values.


[HKEY_LOCAL_MACHINE\Drivers\PCMCIA\CompanyX-GenericModem-1234]

   "Prefix" - Device prefix.  Normally = "COM" for PCMCIA serial devices

   "Dll"="Serial.dll"

   "ResetDelay" - Optional value.  Specifies a number of milliseconds of Delay
	used during the PCMCIA reset sequence. Most modems do not require this
	value, but some modem seem to need more than the PCMCIA specified reset
	delay.  For such modems, specify an appropriate value here.


[HKEY_LOCAL_MACHINE\Drivers\PCMCIA\CompanyX-GenericModem-1234\Unimodem]
   "Tsp" - Provides the name of the TSP which services this port.
	Always "Unimodem.dll" for V1 and V1.01 devices.

   "FriendlyName" - Name displayed to user by TAPI applications 

   "DeviceType" - Values from unimodem.h in the OAK
        0 = null modem
        1 = external modem
        2 = internal modem
        3 = PCMCIA modem
        4 = parallel port
        5 = parallel modem
        6 = IRCOMM modem

   "DevConfig" - Unimodem specific information.  This is a binary structure
	indicating the serial device capabilities (baud, parity, etc).  Not
	published.  Use default case.


[HKEY_LOCAL_MACHINE\Drivers\PCMCIA\CompanyX-GenericModem-1234\Unimodem\Config]
        The values under this key override corresponding fields of the DevConfig structure.
        
   "BaudRate" - Default baud rate for this device (usually 19200)
   
   "ByteSize" - Byte size for this device (usually 8)
   
   "CallSetupFailTimer" - default number of seconds for connection establishment (usually 120)
   
   "DialModifier" - Modem command string to be issued immediately before dial command   
                    (usually not specified, i.e. empty string).
                        
   "EnableAutoBaud" - Enable or disable auto-baud rate detection for direct serial connection devices
                      (usually 0, disabled)
                      
   "EnableBlindDial" - Enable or disable blind dial feature (usually 0, disabled)
   
   "EnableFlowHard" - Enable or disable hardware flow control (usually 1, enabled)
   
   "EnableFlowSoft" - Enable or disable software flow control (usually 0, disabled)
   
   "EnableToneDial" - Enable or disable tone dial feature (usually 1, enabled)
   
   "ManualDial" - Enable or disable manual dial terminal window (usually 0, disabled)
   
   "Parity" - One of the parity modes from winbase.h (usually 0, no parity)
   
   "PostDialTerminal" - Enable or disable post-dial terminal window (usually 0, disabled)
   
   "PreDialTerminal" - Enable or disable pre-dial terminal window (usually 0, disabled)
   
   "StopBits" - One of the stop bits modes from winbase.h (usually 0, 1 stop bit)
   
   "WaitBong" - Seconds to wait for prompt tone (usually 0)


[HKEY_LOCAL_MACHINE\Drivers\PCMCIA\CompanyX-GenericModem-1234\Unimodem\Init]
	The init sequence is an enumerated sequence of strings used to 
	initialize the modem.  You can have any number of init strings.
	Unimodem will step through them in sequence, sending the init 
	string to the modem and waiting for a "OK" response before
	continuing to the next command in the sequence. It is recommended
        that extended response codes be enabled if your modem supports
        them. Unimodem uses these to determine the connected baud rate.


[HKEY_LOCAL_MACHINE\Drivers\PCMCIA\CompanyX-GenericModem-1234\Unimodem\Settings]

   "CmdSendDelay" - number of milliseconds to delay between modem commands. Some modems
    cannot handle commands that are issued immediately after they have responded to a
    previous command. Maximum value is 500. Default is 0.

   "MaxCmd" - maximum command length allowed for this modem. If a command
    exceeds this length, it will be sent as multiple commands separated by
    the dial suffix (see DialSuffix below).

   "Prefix" - Modem command prefix.  Always "AT" for Hayes compat modems.

   "Terminator" - Command terminator, added to the end of any command 
	sequences sent to the modem by Unimodem.  Normally "<cr>"

   "DialPrefix" - Prefix for any dial commands.  Normally "D".

   "DialSuffix" - Command suffix used to extend a dialing string across
	multiple commands.  Unimodem always breaks long dial commands
	into approximately 40 char strings since many modems cannot handle
	longer commands.  This suffix char is used to indicate to the modem
	that the dial sequence is continued in the next command.  Usually ";"

   "DialBilling" - Specifies whether the modem supports the '$' wait for
    credit card prompt tone (bong). A value of 0 indicates that this capability
    is not supported. If it is not supported, unimodem will insert multiple
    commas to cause the modem to wait. If this registry value is not present
    then support for '$' is assumed.

   "Pulse" - Dial prefix used for pulse dialing (i.e. ATDP).  Usually "P"

   "Tone" - Dial prefix used for tone dialing (i.e. ATDT).  Usually "T"

   "Blind_Off" - Command used to disable blind dialing.  In V1 this was sent
	as part of the dial sequence.  Some modems cannot parse this.  In V2
	Unimodem sends this as a separate command, after init but before 
	dialing.  Typically "X4".  Note : In V1 a problem in the dialing dialog
	caused blind_on & blind_off to be reversed.  This was not a problem in 
	Unimodem or the registry, but rather a problem in the UI.

   "Blind_On" - Command used to enable blind dialing. Typcially "X3". See above.

   "CallSetupFailTimeout" - Command to program Call timeout register. Usually "S7=<#>"

   "Reset" - Full AT command used to reset modem.  Usually "ATZ<cr>"

   "FlowHard" - Command to enable hardware flow control.  Varies across modems, but
	a typical value might be "AT\Q3<cr>"

   "FlowSoft" - Command to enable software flow control.  Varies across modems, but
	a typical value might be "AT\Q1<cr>"

   "FlowOff" - Command to disable all flow control.  Varies across modems, but
	a typical value might be "AT\Q<cr>"

   "Answer" - Command to answer an incoming call. Usually "ATA<cr>"
   
   "AnswerTimeout" - Time in seconds to allow the answer command to complete. Default is 25.

   "Monitor" - Command to listen for an incominig call. Usually "ATS0=0<cr>"

   "MdmLogFile" - Control logging of modem commands and responses.
        0 = no logging (default), 1 = write commands and responses to log file named
        mdmlogN.txt where N is the line device identifier.

   "DCCRetries" - Number of times to retry direct cable connection. Default is 3.

   "PPPMTU" - Size in bytes of the max transfer unit that PPP should use on this
    device. Default is 1500.



2. External Modem Example
-------------------------

A default registry entry always exists for a Hayes compatible modem connected
to COM1:. Additional external modems can also be specified under the
HKEY_LOCAL_MACHINE\ExtModems key. Most of the same values apply for external
modems as for PCMCIA modems, except that the following values are ignored:
   "Tsp"="Unimodem.dll" - Redundant because unimodem is the component
                          processing the ExtModem keys

   The following 4 values are used by serial.dll when it loads for the port on
   which the external modem is connected
   "Prefix"="COM"
   "Dll"="Serial.dll"
   "ResetDelay"=dword:800
   
External modems have an additional dword value that specifies the order in which a
modem is registered with TAPI. It controls the order in which modems are presented
to applications and hence to users. The order value is processed in ascending order,
so the external modem with the lowest order value is the first device listed. If no
order is specified, then the external modems are processed in the order they appear
in the registry. If an order value is not specified for an external modem, then a
default value of 0xffffffff (last order value) is used.

    "Order" - Order in which this external modem is to be presented to the user.


The following example registry entries will cause TAPI to create a line device
for the external modem from CompanyX and present it as the first available
TAPI device. In this minimal example, all the default settings from the
HKEY_LOCAL_MACHINE\Drivers\Unimodem Init and Settings keys will be used.

[HKEY_LOCAL_MACHINE\ExtModems\CompanyX-Modem]
   "Port"="COM1:"
   "DeviceType"=dword:1
   "Order"=dword:0
   "FriendlyName"="CompanyX External Modem"

[HKEY_LOCAL_MACHINE\ExtModems\CompanyX-Modem\Init]

[HKEY_LOCAL_MACHINE\ExtModems\CompanyX-Modem\Settings]

