Hi
I have a WAP G2 that I've set to autoconnect. I also use the WWAN API to listen to events generated by the modem. When I receive the OnStatus WanLineUp event, I assume that an internet connection exists, and then start my processing.
Sometimes when I suspend and resume the device however, the modem will reach the WanLineUp stage before my application has finished calling WirelessWAN.Initialize(), and therefore never get the WanLineUp event.
Is there a way that I can query for this status (WanLineUp)?
Marcel
Question: how often during your application do you call WirelessWAN.Initialize()? You should only call it once during the lifetime of your application, and it is NOT necessary to recall it following a resume from a suspend.
Also, are you using RAS or Connection Manager to establish a connection?
I call it when the app starts, and on resume. I do a WirelessWAN.Shutdown() and SetIndicationsListener(null) on the PowerManager's Suspend event. I've found that when I resume from a suspend, that none of the API events are fired.
Which version of the MDSDK are you using?
Also, what operating system are you using? Windows Mobile? Windows CE 5.0?
Windows CE 5.0, with the newest SDK (3.4 I think).
I've also tried to disable listening to events (SetIndicationsListener(null) and SetIndicationsState(false)) in my suspend event, and then setting them again (SetIndicationsListener(this) and SetIndicationsState(true)) when I receive the power on/resume event, without doing a WirelessWAN.Shutdown()... Same results. Events aren't fired after the resume from suspend.
Marcel,
You are correct: it appears that you have to call Disconnect, Initialize on each resume from suspend during normal operation.
Now, if you were to set the power settings of WWAN to be 'Always On', then this wouldn't be necessary.
For you're immediate situation, following the call to WirelessWAN::Initialize(), try calling WirelessWAN::GetPacketService:
WCHAR status[128]={0}; if (WirelessWAN::GetPacketService(opts, packetService) == WwanRequestSuccess) { switch (packetService.AttachState) { case WwanAttachStateAttached: wcscpy(status, L"WwanAttachStateAttached"); break; case WwanAttachStateDetached: wcscpy(status, L"WwanAttachStateDetached"); break; case WwanAttachStateUnknown: wcscpy(status, L"WwanAttachStateUnknown"); break; case WwanAttachStateSearching: wcscpy(status, L"WwanAttachStateSearching"); break; case WwanAttachStateDenied: wcscpy(status, L"WwanAttachStateDenied"); break; default: wcscpy(status, L"??? default ???"); break; } }
WCHAR status[128]={0};
if (WirelessWAN::GetPacketService(opts, packetService) == WwanRequestSuccess)
{
switch (packetService.AttachState)
case WwanAttachStateAttached:
wcscpy(status, L"WwanAttachStateAttached");
break;
case WwanAttachStateDetached:
wcscpy(status, L"WwanAttachStateDetached");
case WwanAttachStateUnknown:
wcscpy(status, L"WwanAttachStateUnknown");
case WwanAttachStateSearching:
wcscpy(status, L"WwanAttachStateSearching");
case WwanAttachStateDenied:
wcscpy(status, L"WwanAttachStateDenied");
default:
wcscpy(status, L"??? default ???");
}
When you get the 'WwanAttachStateAttached' event, then this should indicate you have the ability to access the internet