Datasheet

// add HTTP requests counter to reply
WordToStr(httpCounter, dyna) ;
len += putConstString("var REQ=") ;
len += putString(dyna) ;
len += putConstString(";") ;
}
else if(getRequest[5] == 't') // if request path
name starts with t, toggle P3 (LED) bit number that comes after
{
unsigned char bitMask = 0 ; // for bit mask
if(isdigit(getRequest[6])) // if 0 <= bit num-
ber <= 9, bits 8 & 9 does not exist but does not matter
{
bitMask = getRequest[6] - '0' ; //
convert ASCII to integer
bitMask = 1 << bitMask ; // create bit mask
PORTD ^= bitMask ; //
toggle PORTD with xor operator
}
}
if(len == 0) // what do to by default
{
len = putConstString(httpHeader) ; //
HTTP header
len += putConstString(httpMimeTypeHTML) ; //
with HTML MIME type
len += putConstString(indexPage) ; //
HTML page first part
len += putConstString(indexPage2) ; //
HTML page second part
}
return(len) ; //
return to the library with the number of bytes to transmit
}
/*
* this function is called by the library
* the user accesses to the UDP request by successive calls to
Spi_Ethernet_getByte()
* the user puts data in the transmit buffer by successive calls to
Spi_Ethernet_putByte()
* the function must return the length in bytes of the UDP reply, or
0 if nothing to transmit
*
* if you don't need to reply to UDP requests,
* just define this function with a return(0) as single statement
*
*/
449
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6