NNN40 run a HTTP server with RPC using Soft AP mode
Dependencies: WIFI_API_32kRAM mbed
Fork of HTTP-Server by
The sample code will run as a WiFi Soft AP mode with given AP configuration setting including SSID name and password. IP address (fixed to 192.168.2.1 for the current version of WIFI_API)of AP router will be print out once Soft AP mode is operating.
User can open their web browser and go to http://192.168.2.1/. and have a try on switch on a led. Firstly, we need to create an object to control a led
Then, led can be switch on using RPC command
More information cab be found from the links below
https://developer.mbed.org/users/feb11/code/HTTP-Server/
https://developer.mbed.org/cookbook/Interfacing-Using-RPC
Formatter.h@11:f57e9de44f6f, 2015-09-16 (annotated)
- Committer:
- wgd8700
- Date:
- Wed Sep 16 02:43:42 2015 +0000
- Revision:
- 11:f57e9de44f6f
- Parent:
- 0:9e4bcb10b3e3
First commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
feb11 | 0:9e4bcb10b3e3 | 1 | #ifndef FORMATTER |
feb11 | 0:9e4bcb10b3e3 | 2 | #define FORMATTER |
feb11 | 0:9e4bcb10b3e3 | 3 | |
feb11 | 0:9e4bcb10b3e3 | 4 | |
feb11 | 0:9e4bcb10b3e3 | 5 | class Formatter |
feb11 | 0:9e4bcb10b3e3 | 6 | { |
feb11 | 0:9e4bcb10b3e3 | 7 | public : |
feb11 | 0:9e4bcb10b3e3 | 8 | |
feb11 | 0:9e4bcb10b3e3 | 9 | Formatter(int nbChunk = 1); |
feb11 | 0:9e4bcb10b3e3 | 10 | |
feb11 | 0:9e4bcb10b3e3 | 11 | char* get_page(char *reply); |
feb11 | 0:9e4bcb10b3e3 | 12 | |
feb11 | 0:9e4bcb10b3e3 | 13 | protected : |
feb11 | 0:9e4bcb10b3e3 | 14 | |
feb11 | 0:9e4bcb10b3e3 | 15 | virtual void get_chunk(const int c, char *reply); |
feb11 | 0:9e4bcb10b3e3 | 16 | |
feb11 | 0:9e4bcb10b3e3 | 17 | private : |
feb11 | 0:9e4bcb10b3e3 | 18 | |
feb11 | 0:9e4bcb10b3e3 | 19 | int currentChunk; |
feb11 | 0:9e4bcb10b3e3 | 20 | int nbChunk; |
feb11 | 0:9e4bcb10b3e3 | 21 | }; |
feb11 | 0:9e4bcb10b3e3 | 22 | |
feb11 | 0:9e4bcb10b3e3 | 23 | class SimpleHTMLFormatter : public Formatter |
feb11 | 0:9e4bcb10b3e3 | 24 | { |
feb11 | 0:9e4bcb10b3e3 | 25 | public : |
feb11 | 0:9e4bcb10b3e3 | 26 | |
feb11 | 0:9e4bcb10b3e3 | 27 | SimpleHTMLFormatter(); |
feb11 | 0:9e4bcb10b3e3 | 28 | |
feb11 | 0:9e4bcb10b3e3 | 29 | protected : |
feb11 | 0:9e4bcb10b3e3 | 30 | |
feb11 | 0:9e4bcb10b3e3 | 31 | virtual void get_chunk(const int c, char *reply); |
feb11 | 0:9e4bcb10b3e3 | 32 | |
feb11 | 0:9e4bcb10b3e3 | 33 | }; |
feb11 | 0:9e4bcb10b3e3 | 34 | |
feb11 | 0:9e4bcb10b3e3 | 35 | class InteractiveHTMLFormatter : public Formatter |
feb11 | 0:9e4bcb10b3e3 | 36 | { |
feb11 | 0:9e4bcb10b3e3 | 37 | public : |
feb11 | 0:9e4bcb10b3e3 | 38 | |
feb11 | 0:9e4bcb10b3e3 | 39 | InteractiveHTMLFormatter(); |
feb11 | 0:9e4bcb10b3e3 | 40 | |
feb11 | 0:9e4bcb10b3e3 | 41 | protected : |
feb11 | 0:9e4bcb10b3e3 | 42 | |
feb11 | 0:9e4bcb10b3e3 | 43 | virtual void get_chunk(const int c, char *reply); |
feb11 | 0:9e4bcb10b3e3 | 44 | }; |
feb11 | 0:9e4bcb10b3e3 | 45 | |
feb11 | 0:9e4bcb10b3e3 | 46 | |
feb11 | 0:9e4bcb10b3e3 | 47 | #endif |
feb11 | 0:9e4bcb10b3e3 | 48 |