Hello,
Some of the guys here are using MikroElektronika boards, so I thought this may help them or at least save some time if they are using the Wifi+ Click board : WiFi Plus click - Breakout board for MRF24WB0MA & TCP/IP stack .
So here’s a beta version of a NetMF driver for this (very) nice board : http://www.lsp-fr.com/FEZ/WifiPlusClick/download.php
The main thing with this driver is that it is event driven. So you can subscribe to what you want to know/listen and not bother with anything else. A minimal working code could then look like this :
using System;
using System.Text;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using WifiPlusClick;
using WifiPlusClick.Events;
namespace wfpclick
{
public class Program
{
static WifiBaf wifi;
static Byte Handle1;
public static void Main()
{
wifi = new WifiBaf("COM3", new OutputPort((Cpu.Pin)GHI.Hardware.FEZCerb.Pin.PC4, false));
wifi.CreateProfile("baf", WifiBaf.SecurityModes.WEP40, new Byte[] { 0xAA, 0xBB, 0xCC, 0xDD, 0xEE }, 0);
wifi.SocketDataReceived += wifi_SocketDataReceived;
wifi.ConnectDHCP();
wifi.SocketCreate(WifiBaf.SocketType.TCP);
wifi.SocketConnect(Handle1, 4001, "192.168.0.6");
wifi.StartReceiving(Handle1);
Thread.Sleep(Timeout.Infinite);
}
static void wifi_SocketDataReceived(object sender, SocketDataReceivedEventArgs e)
{
Debug.Print("Message from server : ");
Debug.Print(new String(Encoding.UTF8.GetChars(e.Data)));
}
}
}
The driver comes in two versions, NetMF 4.1 and NetMF 4.2, and a complete help file is provided.
Right now, since the driver is still in a beta state (though running flawlessly at home on a PandaII and a CerbuinoBee), source code is not provided yet. As soon as it could be considered as stable, I will release it to the CodeShare section. I just don’t want to spread potentially bad code for the moment.
Also, Ad-Hoc mode is not yet implemented, only Infrastructure. I didn’t have the need for it when I first began to code the driver.
Help file has many C# examples in it. If anybody is using VB.Net with this driver/board, he could then send me sample code so that I can include it in the help file.
In the attached picture, you can see :
[ul]the setup for a PandaII and a CerbuinoBee board
a screenshot of a test with sockets to a remote TCP server[/ul]
I hope it will be useful. If you have any question, remarks or bug report then do not hesitate to ask.
Regards,
Christophe