uint16_t print_net_config(void)
{
	uint16_t plen;
	plen=http200ok();
	
	// Check if gatewy MAC look-up has been already done
	if (gw_arp_state==GW_ARP_STATE_IN_PROGRESS)
	{
		plen=fill_tcp_data_p(buf,plen,PSTR("waiting for GW MAC\n"));
		return(plen);
	}
	plen=fill_tcp_data_p(buf,plen,PSTR("<a href=/>[home]</a>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<h2>Network config</h2><pre>\n"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<form action=/u method=get>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("DHCP:<input type=checkbox value=1 name=dh "));
	if (dhcpOn){
		plen=fill_tcp_data_p(buf,plen,PSTR("checked"));
	}
	plen=fill_tcp_data_p(buf,plen,PSTR(">\nIP=<input type=text name=ip value="));
	mk_net_str(gStrbuf,myip,4,'.',10);
	plen=fill_tcp_data(buf,plen,gStrbuf);
	plen=fill_tcp_data_p(buf,plen,PSTR(">\ngwip=<input type=text name=gi value="));
	mk_net_str(gStrbuf,gwip,4,'.',10);
	plen=fill_tcp_data(buf,plen,gStrbuf);
	plen=fill_tcp_data_p(buf,plen,PSTR(">\nHeartbeat timeout=<input type=text name=hb value="));
	itoa(heartbeat_timeout_sec,gStrbuf,10);
	plen=fill_tcp_data(buf,plen,gStrbuf);
	plen=fill_tcp_data_p(buf,plen,PSTR(">\nPasswd: <input type=password name=pw>\n"));
	
	plen=fill_tcp_data_p(buf,plen,PSTR("<input type=submit value=change></form>\n<hr>"));
	return(plen);
}
uint16_t print_alarm_config(void)
{
	uint16_t plen;
	plen=http200ok();
	
	// Check if gatewy MAC look-up has been already done
	if (gw_arp_state==GW_ARP_STATE_IN_PROGRESS)
	{
	        plen=fill_tcp_data_p(buf,plen,PSTR("waiting for GW MAC\n"));
		    return(plen);
	}
	plen=fill_tcp_data_p(buf,plen,PSTR("<a href=/>[home]</a>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<h2>Alarm config</h2><pre>\n"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<form action=/u method=get>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("Enabled:<input type=checkbox value=1 name=ae "));
	if (alarmOn){
		plen=fill_tcp_data_p(buf,plen,PSTR("checked"));
	}
	plen=fill_tcp_data_p(buf,plen,PSTR(">\nName:   <input type=text name=n value=\""));
	plen=fill_tcp_data(buf,plen,myname);
	plen=fill_tcp_data_p(buf,plen,PSTR("\">\nSendto: ip=<input type=text name=di value="));
	mk_net_str(gStrbuf,udpsrvip,4,'.',10);
	plen=fill_tcp_data(buf,plen,gStrbuf);
	plen=fill_tcp_data_p(buf,plen,PSTR("> port=<input type=text name=dp size=4 value="));
	itoa(udpsrvport,gStrbuf,10);
	plen=fill_tcp_data(buf,plen,gStrbuf);
	plen=fill_tcp_data_p(buf,plen,PSTR(">\nPasswd: <input type=password name=pw>\n"));
	
	plen=fill_tcp_data_p(buf,plen,PSTR("<input type=submit value=change></form>\n<hr>"));
	return(plen);
}
示例#3
0
// main site for control
uint16_t print_webpage_config(uint8_t *buf)
{
	uint16_t plen;
	plen=http200ok();
	
	plen=fill_tcp_data_p(buf,plen,PSTR("<style type=\"text/css\">*{padding:0;margin:0;}body{font-size:10pt;font-family:\"georgia\";color:#333333;background:#74888e;}"));
	plen=fill_tcp_data_p(buf,plen,PSTR("h5{font-size:0.7em;}#outer{width:350px;border:2px solid #fff;background-color:#fff;margin:0 auto;}#header{background:#2b2b2b;margin-bottom:2px;}#headercontent{bottom:0;padding:0.7em 1em 0.7em 1em;}"));
	plen=fill_tcp_data_p(buf,plen,PSTR("#headercontent h1{font-weight:normal;color:#fff;font-size:2.5em;}#menu{position:relative;background:#2b2b2b;height:3.5em;padding:0 1em 0 1em;margin-bottom:2px;}#menu ul{position:absolute;top:1.1em;}"));
	plen=fill_tcp_data_p(buf,plen,PSTR("#menu ul li{display:inline;}#menu ul li a{padding:0.5em 1em 0.9em 1em;color:#fff;}#content{padding:2em 2em 0 2em;}"));
	plen=fill_tcp_data_p(buf,plen,PSTR("</style></head><body><div id=\"outer\"><div id=\"header\"><div id=\"headercontent\">"));
	// Webserver header
	plen=fill_tcp_data_p(buf,plen,PSTR("<h1>Kontroll</h1></div></div>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<div id=\"menu\"><ul>"));
	//the "menu" or links
	plen=fill_tcp_data_p(buf,plen,PSTR("<li><a href=\"/\">Hoved</a></li>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<li><a href=\"/room1\">Rom-1</a></li>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<li><a href=\"/room2\">Rom-2</a></li>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<li><a href=\"/clk\">Klokke</a></li>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("</ul></div><div id=\"content\">"));
	
	// Change the IP
	plen=fill_tcp_data_p(buf,plen,PSTR("<fieldset><legend><h4>Endre IP</h4></legend>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<form action=/ipc method=get>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<br>Passord:<input type=password size=8 name=pw><br>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("Ny IP: <input type=text size=12 name=nip value="));
	mk_net_str(strbuf,myip,4,'.',10);
	plen=fill_tcp_data(buf,plen,strbuf);
	plen=fill_tcp_data_p(buf,plen,PSTR("><br>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<input type=submit value=\"OK\"></form><br></fieldset>"));
	
	// Change the password
	plen=fill_tcp_data_p(buf,plen,PSTR("<br><fieldset><form action=/ipc method=get>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<br>Gammelt passord:<input type=password size=8 name=pw><br>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("Nytt passord: <input type=password size=8 name=npw><br>"));
	plen=fill_tcp_data_p(buf,plen,PSTR("<input type=submit value=\"OK\"></form><br></fieldset>"));
	
	return(plen);
}
示例#4
0
void EtherShield::ES_mk_net_str(char *resultstr,uint8_t *bytestr,uint8_t len,char separator,uint8_t base) {
	mk_net_str(resultstr,bytestr,len,separator,base);
}