Wifi connection programmatically without WZC

S

soilanete

Hi,

We are developing an application with .netcf to connect programatically
with several AP's.
We wan't use the wireless zero configuration dll and we delete the
entry registry value
HKEY_LOCAL_MACHINE->Drivers->BuiltIn->ZeroConfig->Dll

Without delete this key my application works fine because the WZC dll
makes the first bind with an AP and with the latest version of
SetWirelessSettings we can change the SSID.

The problem is when we are trying to connect the first time with the
key HKEY_LOCAL_MACHINE->Drivers->BuiltIn->ZeroConfig->Dll deleted
because we don't have conexion without any AP.

Is posible to do this?
Wich are the steps we need to do a wifi connection without using WZC?
Is necessary use the connectionManager class before use the
SetWirelessSetting method?
How?
Is there any sample code?

Thanks in advance,
 
G

Guest

Why are you deleting the registry key? WZC is a software interface to the
adapter - without it you have to talk directly with the adapter driver, and
the interface is not standard.

-Chris
 
S

soilanete

3 points about my application:

1. I have my application in kiosk mode
2. I wan't notifications popups about available LAN's
3. I need connect with a specific AP between several AP's.

Is possible deactivate WZC popups?

Thanks a lot.
 
P

Paul G. Tobey [eMVP]

1. OK
2. You *what* notification popups? "wan't" isn't a word. You "want" them
or you "don't want" them? If "don't want", then disable that feature via
the checkbox for notification of new SSIDs (and figure out where this is
stored by WZC for next time, registry or whatever).
3. You are doing this already, right? With WZC enabled? I think it's a
*really* bad, maybe horrible, idea to delete that key.

Paul T.
 
S

soilanete

OK, We have now WZC enabled and notifications disabled.
The problem is when we want connect the first time, the code is ...

private void First_Time()
{
TakeConnection();
OpenNETCF.Net.AdapterCollection oCol =
OpenNETCF.Net.Networking.GetAdapters();
foreach (OpenNETCF.Net.Adapter a in oCol)
{
if (a.IsWireless)
{
a.SetWirelessSettings("PDATeam");
a.RebindAdapter();
}
}
}


private void TakeConnection()
{
DestinationInfoCollection oInfo = oCon.EnumDestinations();
foreach (DestinationInfo d in oInfo)
{
bool connected = false;
if (d.description == "Internet")
{
oCon.Connect();
while (!connected)
{
if (oCon.Status != ConnectionStatus.Connected)
{
System.Threading.Thread.Sleep(5000);
continue;
}
connected = true;
}
}
}
}

The first time, without a previous connection, the var oCon.Status
return "NoPathToDestination" always, but if I stablish a connexion
before starts the program the same var returns "Connected" and in this
case I can use the SetWirelessSettings to set my specifically SSID


Thanks a lot.
 
P

Paul G. Tobey [eMVP]

OK, so the problem is one where the Connection Manager is doing something
that you don't expect, not WZC, right?

Paul T.
 
S

soilanete

OK, the problem is the Connection Manager I think, not WZC, but only if
I don't have a previous connection.
Thanks.
 
P

Paul G. Tobey [eMVP]

Yes, you might see if there is a method of the connection manager which will
establish a suitable connection and, if there seems not to be one, do that
(I suppose that this might use GPRS, 802.11, etc., whatever seems to it to
be available). Or, you might try forgetting about connection manager and
just attempt to establish a connection to each of the SSID values that you
know about via the WZC wrapper in OpenNETCF. I don't do any Pocket PC
programming, so I don't know which is more likely to be the right answer,
maybe someone else can help, but I think that you're on the right track.

Paul T.
 
I

indiekiduk

Looks to me like you are doing things in the wrong order, surely you
should be doing:

private void First_Time()
{
OpenNETCF.Net.AdapterCollection oCol =
OpenNETCF.Net.Networking.GetAdapters();
foreach (OpenNETCF.Net.Adapter a in oCol)
{
if (a.IsWireless)
{
a.SetWirelessSettings("PDATeam");
a.RebindAdapter();
TakeConnection();
}
}
}

i.e. connect to an SSID and wait to see if you get a connection. When
I'm doing this (In StreetHawk
http://www.aspecto-software.com/Streethawk/ ) I dont use the connection
manager at all. I set the SSID and then keep checking my IP address to
see if I have been given one by DHCP, if not I give up and move onto
the next SSID.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top