Need help with Wishield program.

I am new to aruino. I a trying to grasp the basics for using client application. My end goal is to create a super simple app that will light a LED when the wishield connects to a network. However so far I cannot get an example from the library to work. I researched the some examples and found a program that controls leds from a web page, I keep receiving the same errors when I try to compile the program.

errors

In file included from try2.cpp:8:
C:\Program Files (x86)\arduino-1.0\libraries\WiShield/WiServer.h:198: error: conflicting return type specified for 'virtual void Server::write(uint8_t)'
C:\Program Files (x86)\arduino-1.0\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'

I have found other post that stated solutions that required modifying included files in the wishield library. I have tried to follow these solutions with no luck. Being new i suspect that I am missing something. Could someone help me please??

Here is the programs code.

#include <WiShield.h>
#include <WiServer.h>

#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,2,150}; // IP address of WiShield
unsigned char gateway_ip[] = {192,168,2,1}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = {"jon_repeater"}; // max 32 bytes

unsigned char security_type = 3; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"jvjerp2009"}; // max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Key 3
};

// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;

unsigned char ssid_len;
unsigned char security_passphrase_len;
//---------------------------------------------------------------------------

int redState = 0;
int whiteState = 0;
int greenState = 0;

int redPin = 5;
int whitePin = 6;
int greenPin = 7;

// This is our page serving function that generates web pages
boolean sendMyPage(char* URL) {
if (strcmp(URL, "/red") == 0) redState = !redState;
if (strcmp(URL, "/white") == 0) whiteState = !whiteState;
if (strcmp(URL, "/green") == 0) greenState = !greenState;
digitalWrite(redPin, redState);
digitalWrite(whitePin, whiteState);
digitalWrite(greenPin, greenState);
// Check if the requested URL matches "/"
// if (strcmp(URL, "/") == 0) {
// Use WiServer’s print and println functions to write out the page content
WiServer.print("");
WiServer.print("Light Control

");
printLightStatus("red", redState);
printLightStatus("white", whiteState);
printLightStatus("green", greenState);
WiServer.print("The page you requested was: ");
WiServer.print(URL);
WiServer.print("
The arduino has been running for: ");
WiServer.print(millis());
WiServer.print(" milliseconds
");
WiServer.print("");
// URL was recognized
return true;
//}
// URL not found
return false;
}

void printLightStatus( String lightName, int lightState) {
WiServer.print(lightName);
WiServer.print(" Light is ");
if(lightState ==0) {
WiServer.print(" off <a href=/");
WiServer.print(lightName);
WiServer.print(">Turn On
");
} else {
WiServer.print(" on <a href=/");
WiServer.print(lightName);
WiServer.print(">Turn off
");
}
}

void setup() {
// Initialize WiServer and have it use the sendMyPage function to serve pages
WiServer.init(sendMyPage);
// Enable Serial output and ask WiServer to generate log messages (optional)
Serial.begin(57600);
WiServer.enableVerboseMode(true);
pinMode(redPin, OUTPUT);
pinMode(whitePin, OUTPUT);
pinMode(greenPin, OUTPUT);
}

void loop(){

// Run WiServer
WiServer.server_task();
delay(10);
}

I have found other post that stated solutions that required modifying included files in the wishield library. I have tried to follow these solutions with no luck. Being new i suspect that I am missing something. Could someone help me please??

Sure. The problem is not in your code, so posting it wasn't helpful. The problem is in the library. You say you modified the library, but you didn't post the modifications you made. You need to do that.

According to the post I found before within the below code, which is inside the wiserver.h file in the wishield library, the section using "unit8_t" needed to be changed to "size_t". the file print.h cannot be changed due to it is part of arduino's core files.

#ifndef WISERVER_H_
#define WISERVER_H_

extern "C" {
#include "witypes.h"
#include "server.h"
#include "config.h"
#include "uip.h"
}

#include "Print.h"

/*

  • Function for handling data returned by a POST or GET request
    */
    typedef void (returnFunction)(char data, int len);

/*

  • Function for serving web pages
    */
    typedef boolean (pageServingFunction)(char URL);

/*

  • Function for providing the body of a POST request
    */
    typedef void (*bodyFunction)();

#ifdef ENABLE_CLIENT_MODE
/*********** Classes for client-mode functionality *********/

/*

  • Class that encapsulates an HTTP GET request
    */
    class GETrequest
    {
    public:

/*

  • Creates a new GETrequest with the provided IP, port, host name and URL
    /
    GETrequest(uint8
    ipAddr, int port, char* hostName, char* URL);

/*

  • Submits the request and prevents further changes to the request until it has been
  • processed.
    */
    void submit();

/*

  • Sets the function that should be called with data returned by the server.
    */
    void setReturnFunc(returnFunction func);

/*

  • Sets the authorization string for the request. Calls to this method will be ignored if the request
  • has been submitted and is still being processed by WiServer.
    /
    void setAuth(char
    auth);

/*

  • Checks if this request is currently being processed by the WiServer (i.e. it is awaiting a connection
  • or is currently connected and communicating with the server). If it is, any calls that attempt
  • to change the properties of the request will be ignored.
    */
    boolean isActive();

/*

  • Sets the URL for the request. Calls to this method will be ignored if the request
  • has been submitted and is currently being processed by WiServer.
    /
    void setURL(char
    URL);

// Server IP address (network byte order)
uip_ipaddr_t ipAddr;
// Server port number
int port;
// Server domain name
char* hostName;
// Request URL
char* URL;
// Authorization string (may be NULL)
char* auth;
// Return value callback function (may be NULL)
returnFunction returnFunc;
// Indicates if the request is currently active (i.e. has a connection)
boolean active;
// Body data callback function (may be NULL)
bodyFunction body;
// Body preamble (may be NULL)
char* bodyPreamble;
// Pointer to the next request in the queue
GETrequest* next;
};

/*

  • Class that encapsulates aN HTTP POST request
    */
    class POSTrequest : public GETrequest
    {
    public:

/*

  • Creates a new POSTrequest with the provided IP, port, host name, URL and body function.
    /
    POSTrequest(uint8
    ipAddr, int port, char* hostName, char* URL, bodyFunction body);

void setBodyFunc(bodyFunction body);

};

/*

  • Class that encapsulates a TWEET request (basically a POST request populated with Twitter-specific data)
    */
    class TWEETrequest : public POSTrequest
    {
    public:

/*

  • Creates a new TWEETrequest with the provided auth string and message function.
  • The body function will be called to provide the contents of the message; the
  • 'status=' prefix is automatically inserted before the message.
    /
    TWEETrequest(char
    auth, bodyFunction message);
    };

#endif // ENABLE_CLIENT_MODE

class Server: public Print
{
public:

/**

  • Inits the server with the provided page serving function
  • @param pageServerFunc name of the sketch's page serving function
    */
    void init(pageServingFunction function);

/*

  • Enables or disables verbose mode. If verbose mode is true, then WiServer
  • will output log info via the Serial class. Verbose mode is disabled by
  • default, but is automatically enabled if DEBUG is defined
    */
    void enableVerboseMode(boolean enable);

/**

  • The server task method (must be called in the main loop to run the WiServer)
    */
    void server_task();

/**

  • Writes a single byte to the current connection buffer
    */
    virtual void write(uint8_t);

/**

  • Prints a string that is stored in program memory
    */
    void print_P(const char[]);

/**

  • Prints a string that is stored in program memory followed by a line feed
    */
    void println_P(const char[]);

/**

  • Writes data of a specified length that is stored in program memory
    */
    void write_P(const char[], int len);

/**

  • Prints a time value in the form HH:MM:SS. The time value is in milliseconds.

*/
void printTime(long t);

/**

  • Indicates if a page is currently being sent, and that a subsequent call to the page
  • serving function may occur to request more data or to retransmit data that was lost
  • in the network. Changes to the content of the page should only be made if this method
  • returns false.
    */
    boolean sendInProgress();

/**

  • Checks if the client for the current server request resides on the same local network

  • as the server. This information can be used to control access to data

  • and capabilities based on where the client is located. The check is made

  • by comparing the server and client addresses using the subnet mask.

  • For example, a web page front-end for a HVAC system might display read-only data

  • to all clients, but may restrict changes to the settings to only those clients

  • connected via the building's local network.

  • Note that security checks based on the client IP address are not 100% reliable,

  • so this feature should not be relied upon to control access to sensitive data!
    */
    boolean clientIsLocal();

/**

  • Sets the pins used to indicate TX and RX activity over the network.
  • These pins will be set to a HIGH output when activity occurs, and may
  • be connected to LEDs via a suitable resistor to provide indicator lights.
  • A value of -1 disables activity indication.
    */
    void setIndicatorPins(int tx, int rx);

#ifdef ENABLE_CLIENT_MODE

/*

  • Called by request classes to submit themselves to the queue
    */
    void submitRequest(GETrequest *req);

char* base64encode(char* data);

#endif // ENABLE_CLIENT_MODE

};

// Single instance of the Server
extern Server WiServer;

#endif /* WISERVER_H_ */

the file print.h cannot be changed due to it is part of arduino's core files.

That's true. So, you need to change the line you highlighted, instead.

virtual void write(uint8_t); ==> virtual size_t write(uint8_t);

Then, you'll need to change the implementation of the write() function in the cpp file, changing void write to size_t write AND adding a return statement to the write method.

Thank you! You input helped greatly!