A remote timer, equipped with a scheduling Web interface, controls a "DigitalOut".

Dependencies:   Timezone NTPClient

WebTimer

The WebTimer is an Mbed device enabling to remotely control a DigitalOut. It has a "calendar-like" user interface to edit the schedule - a table you can click on (or tap on a touch-screen device).
The program was ported to Mbed from the Tuxgraphics site. Thank you Guido for sharing!

  • When starting, it will print it's IP address over the USB serial link to the terminal screen. However, you can set a different static IP address if you modify the code in the main.cpp.
  • To connect to the WebTimer, type the IP address into the web browser edit box and hit ENTER.
  • When a cell is green then the timer keeps it's output ON during that period of time. If a cell is not green it means the output is OFF.
  • To select or deselect multiple cells you can click (keep down the button) and move the mouse over more cells.
  • The smallest time interval on this 24h timer is 15minutes.
  • To save the changes type in the password and hit ENTER or click on the Save button.
  • The default password is "secret". But you can change it by editing the source code in main.cpp.
OnDesktopOnPhone

websrv_help_functions.h

Committer:
hudakz
Date:
2020-11-11
Revision:
0:f78e57015038

File content as of revision 0:f78e57015038:

/*********************************************
 * vim:sw=8:ts=8:si:et
 * To use the above modeline in vim you must have "set modeline" in your .vimrc
 * Author: Guido Socher 
 * Copyright: LGPL V2
 * See http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html
 *
 * Some common utilities needed for IP and web applications.
 * The defines below are controlled via ip_config.h. By choosing
 * the right defines for your application in ip_config.h you can 
 * significantly reduce the size of the resulting code.
 *********************************************/
//@{
#ifndef WEBSRV_HELP_FUNCTIONS_H
#define WEBSRV_HELP_FUNCTIONS_H
//#include "ip_config.h"
#include "stdint.h"

#define FROMDECODE_websrv_help
#define URLENCODE_websrv_help

#ifdef __cplusplus
extern "C" {
#endif

#ifdef FROMDECODE_websrv_help
// These functions are documented in websrv_help_functions.c. 
// find_key_val searches for key=value pairs in urls, returns 1 if the key was found (may be empty string) and returns 0 if the key was not found:
extern uint8_t find_key_val(char *str,char *strbuf, uint8_t maxlen,char *key);

extern void urldecode(char *urlbuf); // decode a url string e.g "hello%20joe" or "hello+joe" becomes "hello joe"
#endif
#ifdef URLENCODE_websrv_help
extern void urlencode(const char *str,char *urlbuf); // result goes into urlbuf. There must be enough space in urlbuf. In the worst case that would be 3 times the length of str.
#endif
// parse a string that is an IP address and extract the IP to bytestr
extern uint8_t parse_ip(uint8_t *ip_byte_str,const char *str);
extern void mk_net_str(char *resultstr,uint8_t *ip_byte_str,uint8_t len,char separator,uint8_t base);

#ifdef __cplusplus
}
#endif

#endif /* WEBSRV_HELP_FUNCTIONS_H */
//@}