
-46-
v4.9
HTTP and HTTPS
Example of use:
{
// Sends a GET procedure to www.url.com
_3G.readURL(“www.url.com”, 80, “GET /index HTTP/1.1\r\nHost:
www.url.com\r\nUser-Agent: Waspmote\r\nContent-Length: 0\r\n\r\n”);
// Shows the answer from www.url.com
USB.println(_3G.buffer_3G);
}
This function returns:
•
‘1’ on success
•
‘-1’ if error setting APN, username and password
•
‘-2’ if error opening a HTTP session
•
‘-3’ if error receiving data or timeout waiting data
•
‘-4’ if error changing the baudrate (data received is OK)
•
‘-5’ if unknown error for HTTP
•
‘-6’ if HTTP task is busy
•
‘-7’ if fail to resolve server address
•
‘-8’ if HTTP timeout
•
‘-9’ if fail to transfer data
•
‘-10’ if memory error
•
‘-11’ if invalid parameter
•
‘-12’ if network error
•
‘-15’ if error setting APN, username and password with CME_error code available
•
‘-16’ if error opening a HTTP session with CME_error code available
Reading an URL using GET and POST methods example:
http://www.libelium.com/development/waspmote/examples/3g-15-getting-url/
9.3. Sending a frame to Meshlium
The function sendHTTPframe( url, port, data, length, method) has been developed to send a frame from Waspmote to Meshlium.
Meshlium will parse the frame and will store in the internal database. This function requires the next parameters:
•
url: IP address from Meshlium
•
port: HTTP port from Meshlium
•
data: variable
frame.buffer
from the frame generated
•
length: variable
frame.length
from the frame generated
•
method: GET or POST
The response from Meshlium will be stored in
buffer_3G
variable.
Note:
Buffer_3G
is limited to 512 bytes. If the answer from the HTTP server is greater than 512 bytes data may be lost. The size of the
buffer can be incrmented changing the value of the constant
#define BUFFER_SIZE
in Wasp3G.h.
Содержание Waspmote 3G Plus GPS
Страница 1: ...Waspmote 3G GPS Networking Guide ...