- Tue May 03, 2011 4:42 pm
#126504
I posted a solution to space in the SSID name on another thread viewtopic.php?f=32&t=28163&p=126503#p126503
Where electronics enthusiasts find answers.
jaycollett wrote:I'll update the post again once I have the server side parts updated.Hi Jay, did you have a chance to look into the server side? Would be wonderful if you could kindly share. Thank you very much!
void WiFlyDevice::beginAdhoc() {
/*
Create and AdHoc network with the WiFly Shield.
*/
DEBUG_LOG(1, "Entered WiFlyDevice::beginAdhoc()");
uart.begin();
reboot(); // Reboot to get device into known state
requireFlowControl();
enterCommandMode();
// Turn on Adhoc Mode
sendCommand("set wlan join 4");
// Set SSID of Adhoc Network
sendCommand("set wlan ssid MY_SSID");
// Set Channel for Adhoc Network
sendCommand("set wlan chan 1");
// Set IP for Adhoc Network
sendCommand("set ip address 169.254.1.1");
sendCommand("set ip netmask 255.255.0.0");
// Turn off DHCP
sendCommand("set ip dhcp 0");
// Set server port
sendCommand("set ip localport ", true);
uart.print(serverPort);
sendCommand("");
// Turn off remote connect message
sendCommand("set comm remote 0");
sendCommand("save", false, "Storing in config");
//Ensures sucessful reboot. See requireFlowControl for more info.
sendCommand("get uart", false, "Flow=0x1");
reboot();
//After rebooting, your AdHoc network will be available.
}
jcrouchley wrote:Hi Jay,John:
Just got a WiFly shield - and when I update the firmware the latest one it will give is 2.23 !! I cannot find/get 2.26.
Also your library appears to have lost the WiFly.Configure(..) method along the way (your commit of 2011-07-19 19:21:32) - was this intentional?
Best regards
John.
Client& Server::available() {
/*
*/
// TODO: Ensure no active non-server client connection.
if (!WiFly.serverConnectionActive) {
activeClient._port = 0;
}
// TODO: Ensure begin() has been called.
// Return active server connection if present
if (!activeClient) {
// TODO: Handle this better
if (WiFly.uart.available() >= strlen(TOKEN_MATCH_OPEN)) {
if (WiFly.responseMatched(TOKEN_MATCH_OPEN)) {
// The following values indicate that the connection was
// created when acting as a server.
// TODO: Work out why this alternate instantiation code doesn't work:
//activeClient = Client((uint8_t*) NULL, _port);
activeClient._port = _port;
activeClient._domain = NULL;
activeClient._ip = NULL;
activeClient.connect();
WiFly.serverConnectionActive = true;
} else {
// Ignore other feedback from the WiFly module.
// TODO: Should we check we're not ditching a connect accidentally?
//WiFly.skipRemainderOfResponse();
WiFly.uart.flush();
}