Seite 1 von 2

text to display

Verfasst: 09.09.2008, 21:33:06
von dori
Hi guys!
Sorry for English but I don't speak German.

I made a third page to the server (test page) I put a link to status page

"<BR><BR> <p align=\"left\"> <h2></h2><BR>\r\n"
"<p><a href=\"test.htm\">test</a></p><BR>\r\n"


and I added

{"test.htm",Page5},

to WEBPAGE_ITEM WEBPAGE_TABLE[]

and here is the page code

PROGMEM char Page5[] = {

"<blockquote>\r\n"
"<blockquote>\r\n"
"<blockquote>\r\n"
"<body bgcolor=\"powderblue\"> <div align=\"center\">\r\n"
"<h1>Test Page</h1>\r\n"
"</div><BR>\r\n"
"<h4>Write text to display</h4>\r\n"
"<form name=\"form2\" method=\"get\" action=\"html_form_action.asp\">\r\n"
"<p align=\"left\">&nbsp; </p>\r\n"
"<p align=\"left\">\r\n"

"<textarea rows=\"2\" cols=\"16\"></textarea>\r\n"
"<br>"
"<pre align=\"left\"> <input type=\"submit\" value=\"SEND\"></pre>\r\n"



"<BR><BR> <p align=\"left\"> <h2></h2><BR>\r\n"
"<p><a href=\"index.htm\">Main Page</a></p><BR>\r\n"
"<br>\r\n"
"<br>\r\n"
"</a><br>test 2008</p><BR></small>\r\n"
"</body></html>\r\n"
"%END"};


My question is about the text area.
When I pres the send button I want the text that is in the text area to be send to the LCD display or even to RS232.
How can I do this? Is it easy?

Sorry for the big question!

Best Regards

Re: text to display

Verfasst: 09.09.2008, 23:41:51
von jornbyte
na da schreibe es in DE mal her, sorry for my english

Re: text to display

Verfasst: 10.09.2008, 08:47:04
von philipp.fister
Also ich probiere mal Inhaltlich zu übersetzten.
Der Type möchte gern den auf einer zusätzlichen Seite eine Textbox machen und wenn er dann auf senden klickt will er das der eingegebene Text dann auf dem Display oder der V24 erscheint.
Würde mich auch sehr interessieren.

Gruß Philipp

Re: text to display

Verfasst: 10.09.2008, 12:39:58
von dori
entschuldige bitte, es wird nicht wieder vorkommen

Re: text to display

Verfasst: 10.09.2008, 16:07:42
von Thomas
@jornbyte
Watch your language!

@dori
You've done nothing wrong! I apologize for jornbyte. We will answer your question soon.

Re: text to display

Verfasst: 11.09.2008, 07:41:43
von dori
Danke Thomas!

Re: text to display

Verfasst: 11.09.2008, 23:52:13
von jornbyte
Hallo Thomas
Es war nicht meine Absicht dori zu verärgern. Der alte Mann, so wie ich einer bin, hat die 1. Zeile:
Sorry for English but I don't speak German.
falsch verstanden.

Re: text to display

Verfasst: 12.09.2008, 09:31:39
von philipp.fister
"Alter Mann"
Da würde mich mal interessieren wie du das verstanden hast ;-)

Lustig ist auch die auf einmal vorhandenen Deutsch Kenntnisse

Re: text to display

Verfasst: 12.09.2008, 10:09:03
von dori
philipp.fister hat geschrieben: Lustig ist auch die auf einmal vorhandenen Deutsch Kenntnisse
dori spricht kein wort Deutsch, aber ich! ich bin eine collegin habe aber keine technische kenntnisse und kann so nicht uebersetzen.

Re: text to display

Verfasst: 12.09.2008, 12:27:20
von philipp.fister
hehe ;-)
Ist ja nicht so wild fand es eben nur ein wenig Lustig. Ich bin der Meinung wer sich in solchen Foren rum treibt sollte auch Englisch können. Schließlich gibt es kaum Datenblätter in Deutsch.
Also meiner Meinung nach werden die Leute die Dori helfen können seine Frage auch auf Englisch verstehen ;-)

Gruß Philipp

Re: text to display

Verfasst: 20.09.2008, 21:37:38
von jornbyte
So, heute könnte ich Dori helfen, da ich aber den Text nicht in Englisch verfassen kann, werd ichs wohl nicht machen können (dürfen).

Re: text to display

Verfasst: 21.09.2008, 14:50:46
von philipp.fister
Schreibe mal in Deutsch vielleicht kann ich dann weiter helfen. Mich würde das ganze auch interessieren.

Gruß Philipp

Re: text to display

Verfasst: 22.09.2008, 22:06:51
von jornbyte
Hallo
nun der Versuch das Gewirr verständlich zu erklären.
Ulli sieht in seiner httpd.c vor, ein einzelnes Zeichen zu übergeben.
Ich möchte aber auch die Schaltschwelle der ADC jederzeit verändern können.
Damit all seine Funktionen erhalten bleiben, da die auch genutzt werden, ist es nötig sich darann vorbei zu mogeln.
Dazu lese ich von der *htm aus einem nicht sichbaren Textfeld den Namen der htm-Seite.
Die Seiten liegen auf einer SD-Karte.

In der index.htm ist es der Eintrag:
<input type="text" name="OUT" style="display:none" value="index.htm">

Code: Alles auswählen

	......
  <p>  </p><BR><BR>

	<form name="form1" method="post" action="index.htm">´

                <input type="text" name="OUT" style="display:none" value="index.htm">

	<p align="left">&nbsp;    </p>
	<p align="left">

	<input type="checkbox" name="OUT" value="A" %PORTA0>
	<span class="Stil2"> OUT 1</span></p>
	<p align="left">
                 .........
In meiner setup.htm ist es
<input type="text" name="OUT" style="display:none" value="setup.htm">

Code: Alles auswählen

<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <title></title>
  
<script language=JavaScript>

function chkFormular() 
{
// hier können die Werte auf güligkeit geprüft werden
//
//  alert( "help!!!")
//  return false;
  return true;
}
</script>
  
  </head>
  <body>

  
	<style type="text/css">
	<!--
	BODY {	margin: 0 0 0 0; background-color: #90B0D0; text-align:center; }
	P, DIV, H1, H2 {font-family: verdana, arial; font-size: 11px;}
	H1 {  background-color: #CCCCFF; padding-top:5px; padding-bottom:5px;
	font-size: 20px; color: #004060; font-weight:bold; letter-spacing: 8px;
	border-top: 2px solid #EEEEEE; border-left: 2px solid #EEEEEE;
	border-bottom: 2px solid #004060; border-right: 2px solid #004060;}
	H2 { font-size: 15px; padding-top: 20px; padding-left:50px; padding-right:50px;
	color:#004080; font-weight:bold; text-decoration:underline;
	border-top: 1px solid #004080;} P, H1, H2 {margin: 0px 0px 5px 0px;}
	-->
	
	</style></head>

	</style></head>
	<blockquote>
	<blockquote>
	<blockquote>
	<body><div align="center">
	<h1>Setup %DATE %TIME </h1>
  <div align="left">
	 <form name="Formular" action="setup.htm" method="post" onsubmit="return chkFormular()">

<input type="text" name="OUT" style="display:none" value="setup.htm">
	<pre>
 
   Temp1 <input type="text" size="4" name="OUT" value="%adc4"> Licht <input type="text" size="4" name="OUT" value="%adc5"> Temp2 <input type="text" size="4" name="OUT" value="%adc6"> Temp3 <input type="text" size="4" name="OUT" value="%adc7">
         
  <BR>
  
   <input type="submit" name="SUB" value="Setzen">
	</pre>
	</form>

	<p> </p><BR><BR>
	<BR><BR> <p align="left"> <h2></h2><BR>
	<p><a href="index.htm">Hauptseite</a></p><BR>
  <BR><BR><p align="left"> <h2></h2><BR>
  
  </body>
</html>
Die Übergabe der Werte erfollgt über die Token (%adc4 ....) in der httpd.c

Nun zu den Änderungen in der httpd.c
Da gibt es die Zeile mit der Änderung:
for( input = 0, a = TCP_DATA_START_VAR;a<(TCP_DATA_END_VAR);a++ )

Mit dieser Zeile wird der Name der *htm (das versteckte Textfeld) gelesen
und der Name extrahiert.
eth_buffer[a+1+strcspn( (char*)(&eth_buffer[a+1]), "&" )] = 0;

und der var "quellfile" übergeben
if( !input ) strcpy( quellfile, (char*)(&eth_buffer[a+1]) );

nun wird geprüft, wo es hingeht (index.htm oder setup.htm)
if( !strcmp( quellfile, "index.htm" ) )
ab hier gehts "normal" weiter

Code: Alles auswählen

//Einzelne Postpacket (z.B. bei firefox)
	if(http_entry[index].http_auth && http_entry[index].post == 1)
	{
		quellfile[0] = 0; 

		for(input = 0, a = TCP_DATA_START_VAR;a<(TCP_DATA_END_VAR);a++ )
		{	
			//Schaltanweisung finden!
			if (eth_buffer[a] != *http_entry[index].post_ptr++)
			{
				http_entry[index].post_ptr = post_in;
			}
			if(*http_entry[index].post_ptr == 0) 
			{
				// HTML-Seitenname lesen !! Dieser ist in der HTML 
				eth_buffer[a+1+strcspn( (char*)(&eth_buffer[a+1]), "&" )] = 0;    
//			    usart_write( "input%i = %s\r\n", input, (char*)(&eth_buffer[a+1]));

			
				if( !input ) strcpy( quellfile, (char*)(&eth_buffer[a+1]) );


				if( !strcmp( quellfile, "index.htm" ) )
				{
					switch (eth_buffer[a+1])
				  	{
				    	case ('A'):
					   		PORT_tmp = PORT_tmp + 1;
				      		break;
//case (B) und so weiter
nun kommt die Stelle an der die Ausgabe erfollgt.
Dazu wieder der Quelltextteil, der sicher leicht einzufügen ist

Code: Alles auswählen

					http_entry[index].post_ptr = post_in;
					//Schaltanweisung wurde gefunden
				} //if( !strcmp( quellfile, "index.htm" ) )
//**********************************************************************
				if( !strcmp( quellfile, "setup.htm" ) )
				{	
					switch( input )
					{
						case 1:
							adc4 = atoi( (char*)&eth_buffer[a+1] );
							break;
						case 2:  
							lcd_print(3,12, "ADC5:%s", (char*)&eth_buffer[a+1]); //Testausgabe auf LCD
							adc5 = atoi( (char*)&eth_buffer[a+1] );
							break;
						case 3:  
							adc6 = atoi( (char*)&eth_buffer[a+1] );
							break;
						case 4:  
							adc7 = atoi( (char*)&eth_buffer[a+1] );
							break;

							
					}
					
					http_entry[index].post_ptr = post_in;
				} //if( !strcmp( quellfile, "setup.htm" ) )
			input++;
			
//**********************************************************************				

			} // if(*http_entry[index].post_ptr == 0) 

// ab hier gest auch wieder "normal" weiter :)
Die Übergabe adc4, adc5, adc6 und adc7 an die Seite setup.htm wird über die Token erledigt.
Ich habe es nach der Analogwertausgabe eingefügt.

Code: Alles auswählen

			if (strncasecmp_P(token,PSTR("VA@"),3)==0) 
			{	
				//HTTP_DEBUG(" - Analogwert");
				b = (token[3]-48)*10; 	//zehner stelle (VA08)
				b +=(token[4]-48);		//einer stelle
				itoa (var_array[b],var_conversion_buffer,10);
				str_len = strnlen(var_conversion_buffer,CONVERSION_BUFFER_LEN);
				memmove(&eth_buffer[TCP_DATA_START+a],var_conversion_buffer,str_len);
				a += str_len-1;
				nchars = 5;
			}
//*****************************************************
//AD
			if (strncasecmp_P(token,PSTR("adc4"),4)==0) 
			{
				sprintf_P(var_conversion_buffer,PSTR("%i"), adc4);
				str_len = strnlen(var_conversion_buffer,CONVERSION_BUFFER_LEN);

				memmove(&eth_buffer[TCP_DATA_START+a],var_conversion_buffer,str_len);
				a += str_len-1;
				nchars = 4;
			}
			if (strncasecmp_P(token,PSTR("adc5"),4)==0) 
			{
				sprintf_P(var_conversion_buffer,PSTR("%i"), adc5);
				str_len = strnlen(var_conversion_buffer,CONVERSION_BUFFER_LEN);

				memmove(&eth_buffer[TCP_DATA_START+a],var_conversion_buffer,str_len);
				a += str_len-1;
				nchars = 4;
			}
			if (strncasecmp_P(token,PSTR("adc6"),4)==0) 
			{
				sprintf_P(var_conversion_buffer,PSTR("%i"), adc6);
				str_len = strnlen(var_conversion_buffer,CONVERSION_BUFFER_LEN);

				memmove(&eth_buffer[TCP_DATA_START+a],var_conversion_buffer,str_len);
				a += str_len-1;
				nchars = 4;
			}
			if (strncasecmp_P(token,PSTR("adc7"),4)==0) 
			{
				sprintf_P(var_conversion_buffer,PSTR("%i"), adc7);
				str_len = strnlen(var_conversion_buffer,CONVERSION_BUFFER_LEN);

				memmove(&eth_buffer[TCP_DATA_START+a],var_conversion_buffer,str_len);
				a += str_len-1;
				nchars = 4;
			}

//*****************************************************
Nun hoffe ich nix vergessen zu haben.
Es ist bestimmt möglich einiges zu verbessern, da ich selbst mit meinen 53 die ersten Gehversuche mit C mache, möge man mir gemachte Fehler verzeihen.

mfg
jornbyte

Re: text to display

Verfasst: 01.10.2008, 21:58:17
von Oliver Worm
Hi Dori,

I had a similar request and solved it.
I wanted the content of a html text box to be written to a lcd (directly wired, using lcd.h/lcd.c).
I added a global variable unsigned char internal_message[256] in httpd.h.

In my webpage.h I added
"<p align=\"left\">Interne Nachricht <input size=\"30\" type=\"text\" name=\"IMES\" value=\"%VM@I\"> %VM@I </p>\r\n"
to the form section.

In httpd.c I changed/added:

Code: Alles auswählen

if(http_entry[index].http_auth && http_entry[index].post == 1)
	{

			
			//nun die LCD Inhalte finden
			//IMES=....&
			
			char* nPos=strstr_P((char*)&eth_buffer[TCP_DATA_START], PSTR("IMES="));
			
			strlcpy(internal_message, nPos+5,100); //SUBBUG: nur 100 von 255 möglichen
			for(int i=0;i<strlen(internal_message);i++)
			{	
				if(internal_message[i]=='&')
					{
						internal_message[i]=0x00;
						break;
					}
			}
			urldecode(internal_message);
			

			for(a = TCP_DATA_START_VAR;a<(TCP_DATA_END_VAR);a++)
			{	
				HTTP_DEBUG("%c",eth_buffer[a]);
				//Schaltanweisung finden!
				if (eth_buffer[a] != *http_entry[index].post_ptr++)
				{
					//HTTP_DEBUG("%c", *http_entry[index].post_ptr);
					http_entry[index].post_ptr = post_in;
				}
				if(*http_entry[index].post_ptr == 0) 
				{
					switch (eth_buffer[a+1])
					  {
					    case ('A'):
						  PORT_tmp = PORT_tmp + 1;
					      break;
					    case ('B'):
						  PORT_tmp = PORT_tmp + 2;
					      break;
					    case ('C'):
						  PORT_tmp = PORT_tmp + 4;
					      break;

	                    #if USE_WOL
	                    case 'W':
	                        wol_enable = 1;
							break;
	                    #endif //USE_WOL
					  }
					http_entry[index].post_ptr = post_in;
					//Schaltanweisung wurde gefunden
				}
				

		
				//Submit schließt die suche ab!
				if (eth_buffer[a] != *http_entry[index].post_ready_ptr++)
				{
					http_entry[index].post_ready_ptr = post_ready;
				}
				if(*http_entry[index].post_ready_ptr == 0) 
				{
					http_entry[index].post = 0;
					PORTC = PORT_tmp;
	                PORT_tmp = 0;
					break;
					//Submit gefunden
				}
			}
		

		





	}
,

one more section in the http_data_send function to display the current content as e.g. text in another context

Code: Alles auswählen

if (strncasecmp_P("VA@",http_entry[index].new_page_pointer,3)==0)
			{	
				b = (pgm_read_byte(http_entry[index].new_page_pointer+3)-48)*10;
				b +=(pgm_read_byte(http_entry[index].new_page_pointer+4)-48);	
				itoa (var_array[b],var_conversion_buffer,10);
				str_len = strnlen(var_conversion_buffer,CONVERSION_BUFFER_LEN);
				memmove(&eth_buffer[TCP_DATA_START+a],var_conversion_buffer,str_len);
				a = a + (str_len-1);
				http_entry[index].new_page_pointer=http_entry[index].new_page_pointer+5;
			}
			if (strncasecmp_P("VM@", http_entry[index].new_page_pointer,3)==0)
			{
				b = (pgm_read_byte(http_entry[index].new_page_pointer+3));
				if(b=='I') 
				{//internal Message
					str_len=strnlen(internal_message, 255);
					memmove(&eth_buffer[TCP_DATA_START+a], internal_message, str_len);
					a = a + (str_len-1);
					http_entry[index].new_page_pointer=http_entry[index].new_page_pointer+4;
				}
				
			}
and the function urldecode for the %20 stuff.

Code: Alles auswählen

void urldecode(char *urlbuf)
{
        char c;
        char *dst;
        dst=urlbuf;
        while ((c = *urlbuf)) {
                if (c == '+') c = ' ';
                if (c == '%') {
                        urlbuf++;
                        c = *urlbuf;
                        urlbuf++;
                        c = (h2int(c) << 4) | h2int(*urlbuf);
                }
                *dst = c;
                dst++;
                urlbuf++;
        }
        *dst = '\0';
}
Please mention that the form action remains as POST and hasn´t been changed.

I hope this helps - comments are appreciated.

With Most Kind Regards

Oliver

Re: text to display

Verfasst: 18.11.2008, 17:52:31
von MisterX
Hallo jornbyte,

ich habe Deinen Beitrag gelesen. Leider verstehe ich die Zusammenhänge nicht ganz. :(
Ich möchte auf der Webseite ein Eingabefeld haben, wenn dort ein Text eingegeben wird soll dieser, nach klicken auf "Senden", auf dem Display angezeigt werden (zB. in Zeile 3).
Was muß ich genau tun, um dieses zu realisieren?
Kannst Du das mir bitte genauer erklären! Bitte auch den von Dir eingefügten Code hervorheben (zB. "// Text to LCD Begin" und "//Text to LCD Ende") damit ich es besser nachvollziehen kann, was Du geändert hast.
Den Beitrag von Oliver Worm verstehe ich leider auch nicht.
Ich kann momentan noch kein "C" - habe vor 25 Jahren 'mal Z80 in Assembler programmiert.

Danke für Deine Mühe

MisterX

PS:
ich verwende das Pollin-Board mit Ulirch's Software 1.1.00 (vom 08.10.08)
das LCD habe ich an den Port C angeschlossen und es funktioniert
an Port D habe ich im Moment LED's zur Stausanzeige - über die geänderte Webseite kann ich diese auch ansteuern