Hi!
Thanks, for the reply.
I reinstalled everything again, used the registry keys swi_wince_ndis.reg.
I managed to connect to the Internet, but the API works very unstable. Some functions are executed successfully, but some always or very often return the result of the SWI_RCODE_REQUEST_TIMEOUT.
Here is my experimental code
bool Connect()
{
SWI_STRUCT_ApiStartup Startup;
Startup.sizeStruct = sizeof(Startup);
Startup.sLogging.sizeStruct = sizeof(SWI_STRUCT_Logging);
wcscpy(Startup.sLogging.szFileName, L"SwiLog.txt");
Startup.sLogging.bEnable = true;
SWI_RCODE rCode = SwiApiStartup(&Startup);
if(SWI_RCODE_OK != rCode) return false;
SWI_TYPE_Device eTypeDevice = SWI_DEVICE_None;
SWI_STRUCT_AirServerList sAvailDevList;
sAvailDevList.sizeStruct = sizeof(SWI_STRUCT_AirServerList);
rCode = SwiGetAvailAirServers(sAvailDevList);
if (SWI_RCODE_OK != rCode) return false;
// how many avail devices?
if (0 == sAvailDevList.nNumber) return false;
//Info about first modem
SWI_STRUCT_AirServerExtended Info;
rCode=SwiGetAirServerInfo(sAvailDevList.AirServers[0], Info);
if(SWI_RCODE_OK != rCode) return false;
//select first modem
DECLARE_MacAny;
SWI_STRUCT_AirServer sAirServer;
sAirServer.sizeStruct = sizeof(SWI_STRUCT_AirServer);
memcpy(sAirServer.ClientMac, MacAny, LENGTH_MacAddress);
memcpy(sAirServer.ServerMac, MacAny, LENGTH_MacAddress);
sAirServer.eDevice = sAvailDevList.AirServers[0].eDevice;
rCode = SwiSelectAirServer(sAirServer);
if(SWI_RCODE_OK != rCode) return false;
rCode= SwiRegisterCallback(NotificationCallback, 0xFFFFFFFFFFFFFFFF);
if(SWI_RCODE_OK != rCode) return false;
//Modem Type?
SWI_STRUCT_AirCardType CT;
CT.sizeStruct=sizeof(SWI_STRUCT_AirCardType );
rCode = SwiGetAirCardType(&CT, 5000); //!!!! sometimes TIMEOUT
if(SWI_RCODE_OK != rCode) return false;
//Notification?
rCode=SwiNotify(SWI_NOTIFY_ServiceIcon,10000);
if(SWI_RCODE_OK != rCode) return false; //!!!! always TIMEOUT
rCode=SwiNotify(SWI_NOTIFY_PktSessionCall,10000);
if(SWI_RCODE_OK != rCode) return false; //!!!! very often TIMEOUT
rCode=SwiNotify(SWI_NOTIFY_Rssi,10000);
if(SWI_RCODE_OK != rCode) return false; //!!!!! always TIMEOUT
//OnLine
rCode = SwiSetHostStartup(true, 30000); //!!!! sometimes TIMEOUT
if(SWI_RCODE_OK != rCode) return false;
//profile
#define MTS_PROFILE 1
SWI_STRUCT_GsmProfileBasic sProfileBasic;
memset (&sProfileBasic, 0, sizeof(SWI_STRUCT_GsmProfileBasic));
sProfileBasic.sizeStruct = sizeof(SWI_STRUCT_GsmProfileBasic);
sProfileBasic.nProfileId = MTS_PROFILE;
rCode = SwiGetGsmProfileBasic(&sProfileBasic, 30000);
if(SWI_RCODE_OK != rCode) return false;
//now set the new information for this Profile
wcscpy(sProfileBasic.szLabel, L"MTS");
wcscpy(sProfileBasic.szPassword, L"mts");
wcscpy(sProfileBasic.szUserName, L"mts");
wcscpy(sProfileBasic.szAccessPoint, L"internet.mts.ru");
sProfileBasic.bValid = true;
sProfileBasic.eAuthentication = SWI_PDPAUTHENTICATION_Pap; //default
sProfileBasic.bAutoActivation = FALSE;
sProfileBasic.bPromptPassword = FALSE;
//setting information to selected Profile
rCode = SwiSetGsmProfileBasic(sProfileBasic, 3000);
if(SWI_RCODE_OK != rCode) return false;
//Profile active
rCode = SwiActivateProfile(MTS_PROFILE, true, 30000);
if(SWI_RCODE_OK != rCode) return false;
//Waiting Connect....
//.....
//Connect Ready
SWI_STRUCT_GsmSystemStatus SS;
SS.sizeStruct=sizeof(SS);
rCode=SwiGetGsmSystemStatus(&SS, 20000);
if(SWI_RCODE_OK != rCode) return false; //!!!!! often TIMEOUT
SWI_STRUCT_Rssi RSSI;
RSSI.sizeStruct = sizeof(SWI_STRUCT_Rssi);
rCode = SwiGetRssiBer (&RSSI, 30000);
if(SWI_RCODE_OK != rCode) return false;
TCHAR BufIP[50];
rCode = SwiGetIPAddress(BufIP, 50, 30000);
if(SWI_RCODE_OK != rCode) return false; //!!!!! always TIMEOUT
SwiDeRegisterCallback(NotificationCallback);
SwiApiShutdown();
return true;
}
Functions SwiNotify (), SwiGetIPAddress (), SwiGetGsmSystemStatus () is almost always return SWI_RCODE_REQUEST_TIMEOUT. Function SwiSetHostStartup - very often. If you remove the call SwiNotify (), then sometimes the connection can be set, and it works.
In what the reason of such instability and what should I do? What can I see, what to pay attention to?
I tried to turn on log, in accordance with the description, but the log file is not created. How I can enable a log?
Thanks!