Click to See Complete Forum and Search --> : Modem Configuration


Nioc
February 20th, 2004, 02:01 AM
I need some help in using the struktures MODEMSETTINGS and MODEMDEVCAPS, for switching off the flow-controll... Is there anyone, who has experiences with this?

Codeplug
February 20th, 2004, 11:58 PM
Serial Communications in Win32 (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp)

gg

Mick
February 21st, 2004, 12:04 AM
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/communications_resources.asp

Nioc
February 23rd, 2004, 01:53 AM
i have read already a lot in the msdn sites. I wanted to use the SetComConfig - Function. This Function needs a pointer to a COMMCONFIG-stucture. In this sturucture there is a item that is called wcProviderData[1] and of type WCHAR. And in the description is written, that "If the provider subtype is PST_MODEM, the wcProviderData member contains a MODEMSETTINGS structure." But how can a WCHAR contain a MODEMSETTINGS structure... ?

Mick
February 23rd, 2004, 02:21 AM
Originally posted by Nioc
i have read already a lot in the msdn sites. I wanted to use the SetComConfig - Function. This Function needs a pointer to a COMMCONFIG-stucture. In this sturucture there is a item that is called wcProviderData[1] and of type WCHAR. And in the description is written, that "If the provider subtype is PST_MODEM, the wcProviderData member contains a MODEMSETTINGS structure." But how can a WCHAR contain a MODEMSETTINGS structure... ?

it's just a memory location. Farily standard way of exposing variable struct definintions, or variable records. That is why you have a offset member and a size member, you can just cast the address location into the type of provider defined struct/specific data, or memcpy it. And use pointer arithmetic to continue moving down each record via the offset.

Nioc
February 23rd, 2004, 06:25 AM
Is it possible, that you send me some example-Code, it is still not clear to me, how i can read and than set the modem-properties...
That would be very nice :)

TDM
February 23rd, 2004, 06:47 AM
Hi,

If your modem has an AT command set you can use the AT commands to set the registers on the modem. On my modem to disable flow control I can send AT&K0. This command will write 0 to register S39. You could also write directly to the register by using ATS39=0. The commands I have listed are for the Rockwell chipset and may differ for your modem (which may not even have an AT command set). See if your modem has an AT command set list.

TDM

Nioc
February 23rd, 2004, 06:54 AM
The problem is, that the modem i use is an RAS serial Cable. So i have to switch of flow-controll for "modem" the in the Windows-Configuration.

Mick
February 24th, 2004, 02:34 AM
Originally posted by Nioc
The problem is, that the modem i use is an RAS serial Cable. So i have to switch of flow-controll for "modem" the in the Windows-Configuration.

Been one of those dayz ;) Back to your question, if you haven't found the answer already. But would you not just call GetCommConfig(...) passing a large enough buffer as indicated by the return value of the third parameter (I would just call it with size zero and call again after allocating what size is needed by the returned value).

Then modify whatever you need to in that structure, and then call
SetCommConfig(...)

Nioc
February 24th, 2004, 05:12 PM
nice to hear of you :) i was just about giving up hope...

i will try to explain a little bit more detailed. it's perhps a little difficult because i'm not that good in english, and i've my source not here. But i will try


first i fetch a handle to the port, the modem is installed at with CreateFile(..) ;

(or is this already wrong ?!? can i fatch a handle of the modem?)

then i call
GetCommConfig(..);

now i have the COMMCONFIG-Structe filled with the parameters of the com-port

Now i change the item
dwProviderSubType = PST_MODEM ;

now i'm not sure...
must i change the item
dwProviderOffset to the differenz of the adresses of the first item of the structure and wcProviderData

and
dwProviderSize = sizeof(MODEMSETTINGS);

and now ...

i just cant memcpy the MODEMSETTINGS-Sturctre behind the COMMCONFIG-Stucture...

hope you understand my description ;)
thanks a lot,
nioc