Plug And Program HTTP GET parameters source code

This page holds the source code for Plug & Program custom HTTPGet parameters.  In the Microchip TCPIP Stack HTTPGet parameters are added into HTTP2.c -> HTTPExecuteGet

	//Plug & Program custom HTTPGet Params, not tied to an specific form handler page
	//Use httpget.cgi if no specific page required

	//LEDTris updater file
	//Determine which LED to toggle
	//Toggles led to Output/required state if LED is currently Input or current state is different
	//Toggles to Input (Off) if required state is same as current
	ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"led");
	if(ptr != NULL)
	{
		// Toggle the specified LED
		switch(*ptr) {
			case '0':
				ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"ledstate");
				if(ptr != NULL)
				{
					if(LED0_TRIS == 1)
					{
						LED0_TRIS = 0;
						LED0_IO = (*ptr == '1') ? 1 : 0;
					}
					else

						if(LED0_IO == ((*ptr == '1') ? 1 : 0))
							LED0_TRIS = 1;
						else
							LED0_IO = !LED0_IO;
				}
				break;
			case '1':
				ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"ledstate");
				if(ptr != NULL)
				{
					if(LED1_TRIS == 1)
					{
						LED1_TRIS = 0;
						LED1_IO = (*ptr == '1') ? 1 : 0;
					}
					else

						if(LED1_IO == ((*ptr == '1') ? 1 : 0))
							LED1_TRIS = 1;
						else
							LED1_IO = !LED1_IO;
				}
				break;
			case '2':
				ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"ledstate");
				if(ptr != NULL)
				{
					if(LED2_TRIS == 1)
					{
						LED2_TRIS = 0;
						LED2_IO = (*ptr == '1') ? 1 : 0;
					}
					else

						if(LED2_IO == ((*ptr == '1') ? 1 : 0))
							LED2_TRIS = 1;
						else
							LED2_IO = !LED2_IO;
				}
				break;
			case '3':
				ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"ledstate");
				if(ptr != NULL)
				{
					if(LED3_TRIS == 1)
					{
						LED3_TRIS = 0;
						LED3_IO = (*ptr == '1') ? 1 : 0;
					}
					else

						if(LED3_IO == ((*ptr == '1') ? 1 : 0))
							LED3_TRIS = 1;
						else
							LED3_IO = !LED3_IO;
				}
				break;
			case '4':
				ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"ledstate");
				if(ptr != NULL)
				{
					if(LED4_TRIS == 1)
					{
						LED4_TRIS = 0;
						LED4_IO = (*ptr == '1') ? 1 : 0;
					}
					else

						if(LED4_IO == ((*ptr == '1') ? 1 : 0))
							LED4_TRIS = 1;
						else
							LED4_IO = !LED4_IO;
				}
				break;
			case '5':
				ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"ledstate");
				if(ptr != NULL)
				{
					if(LED5_TRIS == 1)
					{
						LED5_TRIS = 0;
						LED5_IO = (*ptr == '1') ? 1 : 0;
					}
					else

						if(LED5_IO == ((*ptr == '1') ? 1 : 0))
							LED5_TRIS = 1;
						else
							LED5_IO = !LED5_IO;
				}
				break;
			case '6':
				ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"ledstate");
				if(ptr != NULL)
				{
					if(LED6_TRIS == 1)
					{
						LED6_TRIS = 0;
						LED6_IO = (*ptr == '1') ? 1 : 0;
					}
					else

						if(LED6_IO == ((*ptr == '1') ? 1 : 0))
							LED6_TRIS = 1;
						else
							LED6_IO = !LED6_IO;
				}
				break;
			case '7':
				ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"ledstate");
				if(ptr != NULL)
				{
					if(LED7_TRIS == 1)
					{
						LED7_TRIS = 0;
						LED7_IO = (*ptr == '1') ? 1 : 0;
					}
					else

						if(LED7_IO == ((*ptr == '1') ? 1 : 0))
							LED7_TRIS = 1;
						else
							LED7_IO = !LED7_IO;
				}
				break;
		}
	}

	//Plug & Program custom HTTPGet Params, not tied to an specific form handler page

	// Set pnpLedH 0-7
	ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"ledh");
	if(ptr != NULL)
	{
		extern BYTE pnpLEDH;
		pnpLEDH = pnpLEDH ^ (1<<(BYTE)atoi(ptr));
	}

	// Set pnpLedL 0-7
	ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"ledl");
	if(ptr != NULL)
	{
		extern BYTE pnpLEDL;
		pnpLEDL = pnpLEDL ^ (1<<(BYTE)atoi(ptr)); 	} 	//LED modes 	ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"ledsmode"); 	if(ptr != NULL) 	{ 			extern BYTE pnpLEDUserMode; 			pnpLEDUserMode = (BYTE)atoi(ptr); 	} 	//LCD modes 	ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"lcdblmode"); 	if(ptr != NULL) 	{ 			extern BYTE pnpLCDBLUserMode; 			BYTE pnpBYTETemp = (BYTE)atoi(ptr); 			if(pnpBYTETemp == pnpLCDBLUserMode) 				pnpLCDBLUserMode = 0; 			else 				pnpLCDBLUserMode = pnpBYTETemp; 	} 	//LCDDim level 	ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"lcdbldim"); 	if(ptr != NULL) 	{ 			extern BYTE pnpLCDBLUserDim; 			pnpLCDBLUserDim = (BYTE)atoi(ptr); 	} 	//LCD Cycle speed 	ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"lcdblspeed"); 	if(ptr != NULL) 	{ 			extern BYTE pnpLCDBLUserPulseSpeed; 			pnpLCDBLUserPulseSpeed = (BYTE)atoi(ptr); 	} 	//Erase  	ptr = HTTPGetROMArg(curHTTP.data, (ROM BYTE *)"proberaselog"); 	if(ptr != NULL) 	{ 		BYTE currProbe = (BYTE)atoi(ptr); 		if(currProbe > 0 && currProbe <= PNP_MAX_CLIENT_PROBES)
			PNP_EraseClientProbeEEPROM(currProbe);
	}

Page updated 20110318