From dea4af4b50e3700668365df37d9533b7fd31cf0a Mon Sep 17 00:00:00 2001 From: Andrew Niemantsverdriet Date: Thu, 29 Nov 2012 13:34:13 -0700 Subject: [PATCH] Modifed file to remove depreciated calls and let the SimpleServer example work. --- WiServer.cpp | 24 ++++++++++++------------ config.h | 10 +++++----- examples/SimpleServer/SimpleServer.pde | 6 +++--- strings.c | 24 ++++++++++++------------ 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/WiServer.cpp b/WiServer.cpp index cac8515..2da093e 100644 --- a/WiServer.cpp +++ b/WiServer.cpp @@ -56,18 +56,18 @@ extern "C" { #define LF 10 // Strings stored in program memory (defined in strings.c) -extern const prog_char httpOK[]; -extern const prog_char httpNotFound[]; -extern const prog_char http10[]; -extern const prog_char post[]; -extern const prog_char get[]; -extern const prog_char authBasic[]; -extern const prog_char host[]; -extern const prog_char userAgent[]; -extern const prog_char contentTypeForm[]; -extern const prog_char contentLength[]; -extern const prog_char status[]; -extern const prog_char base64Chars[]; +extern const char PROGMEM httpOK[]; +extern const char PROGMEM httpNotFound[]; +extern const char PROGMEM http10[]; +extern const char PROGMEM post[]; +extern const char PROGMEM get[]; +extern const char PROGMEM authBasic[]; +extern const char PROGMEM host[]; +extern const char PROGMEM userAgent[]; +extern const char PROGMEM contentTypeForm[]; +extern const char PROGMEM contentLength[]; +extern const char PROGMEM status[]; +extern const char PROGMEM base64Chars[]; diff --git a/config.h b/config.h index 2897503..5b0aa3f 100644 --- a/config.h +++ b/config.h @@ -41,17 +41,17 @@ extern U8 local_ip[]; extern U8 gateway_ip[]; extern U8 subnet_mask[]; -extern const prog_char ssid[]; +extern const char PROGMEM ssid[]; extern U8 ssid_len; -extern const prog_char security_passphrase[]; +extern const char PROGMEM security_passphrase[]; extern U8 security_passphrase_len; extern U8 security_type; extern U8 wireless_mode; -extern prog_uchar wep_keys[]; +extern const uint8_t wep_keys[]; -extern const prog_char webpage[]; -extern const prog_char twitter[]; +extern const char PROGMEM webpage[]; +extern const char PROGMEM twitter[]; extern unsigned char mfg_id[4]; #define WIRELESS_MODE_INFRA 1 diff --git a/examples/SimpleServer/SimpleServer.pde b/examples/SimpleServer/SimpleServer.pde index aeb9288..353c4d7 100644 --- a/examples/SimpleServer/SimpleServer.pde +++ b/examples/SimpleServer/SimpleServer.pde @@ -12,16 +12,16 @@ unsigned char local_ip[] = {192,168,1,2}; // IP address of WiShield unsigned char gateway_ip[] = {192,168,1,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 = {"ASYNCLABS"}; // max 32 bytes +const char PROGMEM ssid[] PROGMEM = {"ASYNCLABS"}; // max 32 bytes unsigned char security_type = 0; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2 // WPA/WPA2 passphrase -const prog_char security_passphrase[] PROGMEM = {"12345678"}; // max 64 characters +const char PROGMEM security_passphrase[] PROGMEM = {"12345678"}; // 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 +const uint8_t 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 diff --git a/strings.c b/strings.c index f49dec9..566d844 100644 --- a/strings.c +++ b/strings.c @@ -36,43 +36,43 @@ // They are stored in program memory to reduce RAM usage. // HTTP OK response -const prog_char httpOK[] = {"HTTP/1.0 200 OK"}; +const char PROGMEM httpOK[] = {"HTTP/1.0 200 OK"}; // HTTP Not Found response -const prog_char httpNotFound[] = {"HTTP/1.0 404 Not Found"}; +const char PROGMEM httpNotFound[] = {"HTTP/1.0 404 Not Found"}; #ifdef ENABLE_CLIENT_MODE // Trailing HTTP/1.0 for GET and POST requests -const prog_char http10[] = {" HTTP/1.0"}; +const char PROGMEM http10[] = {" HTTP/1.0"}; // Authorization: Basic field name -const prog_char authBasic[] = {"Authorization: Basic "}; +const char PROGMEM authBasic[] = {"Authorization: Basic "}; // Content-Length field name -const prog_char contentLength[] = {"Content-Length: "}; +const char PROGMEM contentLength[] = {"Content-Length: "}; // User agent field with value -const prog_char userAgent[] = {"User-Agent: WiServer/1.1"}; +const char PROGMEM userAgent[] = {"User-Agent: WiServer/1.1"}; // Content type form data -const prog_char contentTypeForm[] = {"Content-Type: application/x-www-form-urlencoded"}; +const char PROGMEM contentTypeForm[] = {"Content-Type: application/x-www-form-urlencoded"}; // POST request -const prog_char post[] = {"POST "}; +const char PROGMEM post[] = {"POST "}; // GET request -const prog_char get[] = {"GET "}; +const char PROGMEM get[] = {"GET "}; // Host, User-Agent, and Content-Type lines for Twitter POSTs -const prog_char host[] = {"Host: "}; +const char PROGMEM host[] = {"Host: "}; // Status prefix for Twitter -const prog_char status[] = {"status="}; +const char PROGMEM status[] = {"status="}; /* Base64 Encoder data */ -const prog_char base64Chars[] PROGMEM = {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}; +const char PROGMEM base64Chars[] PROGMEM = {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}; #endif // ENABLE_CLIENT_MODE