The application sends text to a website via UART or USB.
You can see the text that was entered by going to the address:
http://appzone.telit.com/Demo/GETserver/
M2M_main.c
• Send to Process 1.
M2M_proc1.c
• Set the variable 'APN' according to the network provider (for example: INTERNETG).
|
The APN must be set according to the SIM card network provider in order to connect to the internet. |
• Set the variable 'SERVER' to the AppZone server address (APPZONE.TELIT.COM).
• Open USB or UART.
• Call the function 'get_IP'.
The function activates PDP context and gets the IP from the network.
• Set USB or UART callback.
After setting the callback, the function 'hw_usb_read_cb' (or 'hw_uart_read_cb') will be called each time data is transferred over USB or UART.
Wait for data to be sent over USB or UART.
• Gather the data that is received over USB or UART and wait until the 'Enter' key is entered.
When the 'Enter' key is entered, call the function 'send_data'.
• Call 'create_socket' function
The function creates a TCP socket that will be used to send data to the servers.
• Call 'create_socket' function.
The function sets the socket port (80 for HTTP) and the server Address (APPZONE.TELIT.COM).
Then, it connects the socket.
• Send HTTP GET request to the server with the string sent over USB or UART.
The HTTP GET request format is as follows:
GET /Demo/GETserver/report.php?text=%s HTTP/1.1\r\n
Host: %s\r\n
\r\n\r\n\r\n\r\n
• Read and print the results from the server.
The following figures provide an example for sending information using UART to the server:
The following figures provide an example
for sending information using USB to the server: