Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

exchanging data between HTTP server and c

Posted by rasty1 on July 16, 2016

Hi, I'm trying to find information regarding interface between HTTP server and c. I was searching source code for CGI, but did not find anything. Is there any example or documenation? I need to read data (string, numeric) from form and put results back.

Thanks Rasty


exchanging data between HTTP server and c

Posted by rtel on July 16, 2016

You can do this using AJAX. See http://www.w3schools.com/ajax/


exchanging data between HTTP server and c

Posted by rasty1 on July 16, 2016

I'd appreciate any example that we can follow.


exchanging data between HTTP server and c

Posted by rasty1 on July 16, 2016

I googled internet for AJAX and FreeRTOS and did not find anything usable. There is simple example that shows dynamic change of page from local file, which is nice, but how to exchange data with run-time, not via files?


exchanging data between HTTP server and c

Posted by heinbali01 on July 16, 2016

The HTTP server as it is currently, doesn't have any hooks yet to pass data to the application. But it would certainly be very useful.

The approach that I like is using JQuery, which is a library "on top of" JS and AJAX. The JQuery application in the browser will send requests to the embedded application in a form like this:

~~~~ /request?temperature=? /request?temperature=23.5 ~~~~

Or using JSON expressions:

~~~~ /request?add={"colour":"red","weight":1200} ~~~~

When loading pages, the browser sends GET commands. The above requests will also be sent as a GET. The difference is the question mark: if it is present the HTTP driver will no even attempt to search for a directory or file named "/request". In stead the string will be forwarded


exchanging data between HTTP server and c

Posted by rasty1 on July 17, 2016

" In stead the string will be forwarded" to ... ? I played a little bit with AJAX and lhttpd on Linux, it can pass strings (via CGI) to python script. What would be equivalent in FreeRTOS httpd?


exchanging data between HTTP server and c

Posted by heinbali01 on July 17, 2016

I played a little bit with AJAX and lhttpd on Linux, it can pass strings (via CGI) to python script.

Great. Maybe you can you record this communication by running WireShark? The you can see what HTTP commands are exchanged, literally.

What would be equivalent in FreeRTOS httpd?

For instance, like I described shortly here above.

I'm thinking of a callback that can be defined in the application:

~~~~ BaseTypet xHTTPApplicationHook( char *pcCommand, sizet uxMaxLength ) { } ~~~~

The function will check the command and write the reply into the same buffer.


exchanging data between HTTP server and c

Posted by rasty1 on July 17, 2016

Above is simple request, it starts python script and sends DIR command via python to the target. It is not ajax - I didn't managed to access form field from ajax - I'll finish ajax example in few days.

When do you think xHTTPApplicationHook will be available?

Attachments

http-python.pcapng (32000 bytes)

exchanging data between HTTP server and c

Posted by rasty1 on July 24, 2016

Hi, Everything works fine once I set correct gateway address. When do you think you will have application Hooks for Dymamic contents?

Best regards rasty


exchanging data between HTTP server and c

Posted by heinbali01 on July 24, 2016

Still on holiday, but I restart on the first of August. If you write me an email ( h point tibosch on freertos point org ), we'll make a setup for this and test it.

Regards, Hein


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists