Hi all,
I don't know, but the function below doesn't work. It cannot change the
network prefs
Anybody has an idea ?
static Err SetPhoneNumberAndOtherStuff(char *phone, Byte usePulse, Boolean
waitForDialtone,
Ptr script, UInt scriptLength, char *userName, char *pw)
{
Err err;
Err err2;
UInt netlib;
Word iInterface = 0;
Word pppInstance = 0xffff;
DWord dwCreator;
Word wInstance;
char *serviceName = "MYCONN";
Byte trueByte = 1;
char *modemInit;
char *newPhone;
if (waitForDialtone)
modemInit = "ATX4";
else
modemInit = "ATX3";
newPhone = MemPtrNew(StrLen(phone) + 2);
if (usePulse)
StrCopy(newPhone, "P");
else
StrCopy(newPhone, "T");
StrCat(newPhone, phone);
err = SysLibFind("Net.lib", &netlib);
ErrFatalDisplayIf(err, "Can not find net library.");
do
{
err = NetLibIFGet(netlib, iInterface, &dwCreator, &wInstance);
if (!err)
{
if (dwCreator == netIFCreatorPPP) {
err2 = NetLibIFAttach(netlib, iInterface, dwCreator, 1000);
pppInstance = wInstance;
}
else if (dwCreator != netIFCreatorLoop)
err2 = NetLibIFDetach(netlib, iInterface, dwCreator, 1000);
#ifdef nodef
wBufLen = sizeof(bigBuf);
err = NetLibIFSettingGet(netlib, dwCreator, wInstance,
netIFSettingServiceName, bigBuf, &wBufLen);
if (!err && 0==StrCompare(bigBuf, "test"))
break;
#endif
}
iInterface++;
} while (!err);
ErrFatalDisplayIf(pppInstance == 0xffff, "can't find PPP interface");
// at this point dwCreator and wInstance reference
// our PPP connection settings
// set the service name
err = NetLibIFSettingSet(netlib, netIFCreatorPPP, pppInstance,
netIFSettingServiceName,
serviceName, StrLen(serviceName) + 1);
// set the new phone #
err = NetLibIFSettingSet(netlib, netIFCreatorPPP, pppInstance,
netIFSettingModemPhone,
newPhone, StrLen(newPhone) + 1);
// set the pulse/touchtone
err = NetLibIFSettingSet(netlib, netIFCreatorPPP, pppInstance,
netIFSettingPulseDial,
&usePulse, 1);
// set to use modem
err = NetLibIFSettingSet(netlib, netIFCreatorPPP, pppInstance,
netIFSettingUseModem,
&trueByte, 1);
// set modem initialization string
err = NetLibIFSettingSet(netlib, netIFCreatorPPP, pppInstance,
netIFSettingModemInit,
modemInit, StrLen(modemInit) + 1);
// set userName
err = NetLibIFSettingSet(netlib, netIFCreatorPPP, pppInstance,
netIFSettingUsername,
userName, userName ? StrLen(userName) + 1 : 0);
// set password
err = NetLibIFSettingSet(netlib, netIFCreatorPPP, pppInstance,
netIFSettingPassword,
pw, pw ? StrLen(pw) + 1 : 0);
// Set the script
err = NetLibIFSettingSet(netlib, netIFCreatorPPP, pppInstance,
netIFSettingLoginScript,
script, scriptLength);
MemPtrFree(newPhone);
return 0;
}
Thanks in Advance.
___________________________________________
Luiz Fernando Barbosa
Analista de Sistemas / Palm Developer
E-Mail <mailto:[EMAIL PROTECTED]>
ARCOM Com. Imp. Exp. Ltda
Anel Viario Ayrton Senna, 2001 - Distrito Industrial
Uberlandia - Minas Gerais - Brazil - Cep: 38414-512
Phone: +55 (0xx34) 218-4054 Fax: +55 (0xx34) 218-4100
____________________________________________
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html