/*********************************************************************
 * FileName: http_print.h
 * Provides callback headers and resolution for user's custom
 * HTTP Application.
 * Processor: PIC24E, PIC24F, PIC24H, dsPIC30F, dsPIC33F, dsPIC33E,PIC32
 * Compiler:  Microchip C30, C32,XC30,XC32
 * 
 * This file is automatically generated by the MPFS Utility
 * ALL MODIFICATIONS WILL BE OVERWRITTEN BY THE MPFS GENERATOR
 *
 * Software License Agreement
 *
 * Copyright (C) 2012 Microchip Technology Inc.  All rights
 * reserved.
 * Microchip licenses to you the right to use, modify, copy, and distribute
 * software only embedded on a Microchip microcontroller or digital signal 
 * controller that is integrated into your product or third party product
 * (pursuant to the sublicense terms in the accompanying license agreement)

 * You should refer to the license agreement accompanying this 
 * Software for additional information regarding your rights and 
 * obligations.
 *
 * You should refer to the license agreement accompanying this 
 * Software for additional information regarding your rights and 
 * obligations.
 *
 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A 
 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE 
 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER 
 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
 *
 *********************************************************************/

#ifndef __HTTPPRINT_H
#define __HTTPPRINT_H

#include "tcpip/tcpip.h"

#if defined(TCPIP_STACK_USE_HTTP2_SERVER)

void HTTPPrint(HTTP_CONN_HANDLE connHandle,uint32_t callbackID);
void HTTPPrint_hellomsg(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_cookiename(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_builddate(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_led(HTTP_CONN_HANDLE connHandle,uint16_t);
void HTTPPrint_lcdtext(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_ledSelected(HTTP_CONN_HANDLE connHandle,uint16_t,uint16_t);
void HTTPPrint_version(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_btn(HTTP_CONN_HANDLE connHandle,uint16_t);
void HTTPPrint_pot(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_uploadedmd5(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_snmp_en(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_read_comm(HTTP_CONN_HANDLE connHandle,uint16_t);
void HTTPPrint_write_comm(HTTP_CONN_HANDLE connHandle,uint16_t);
void HTTPPrint_status_fail(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_config_mac(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_config_hostname(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_config_dhcpchecked(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_config_ip(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_config_gw(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_config_subnet(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_config_dns1(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_config_dns2(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_reboot(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_rebootaddr(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_status_ok(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_smtps_en(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_ddns_status(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_ddns_status_msg(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_ddns_service(HTTP_CONN_HANDLE connHandle,uint16_t);
void HTTPPrint_ddns_user(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_ddns_pass(HTTP_CONN_HANDLE connHandle);
void HTTPPrint_ddns_host(HTTP_CONN_HANDLE connHandle);

void HTTPPrint(HTTP_CONN_HANDLE connHandle,uint32_t callbackID)
{
TCP_SOCKET sktHTTP; 
	switch(callbackID)
	{
        case 0x00000000:
			HTTPIncFile(connHandle,(const uint8_t*)"header.inc");
			break;
        case 0x00000001:
			HTTPPrint_hellomsg(connHandle);
			break;
        case 0x00000002:
			HTTPIncFile(connHandle,(const uint8_t*)"footer.inc");
			break;
        case 0x00000003:
			HTTPPrint_cookiename(connHandle);
			break;
        case 0x00000004:
			HTTPPrint_(connHandle);
			break;
        case 0x00000005:
			HTTPPrint_builddate(connHandle);
			break;
        case 0x00000006:
			HTTPPrint_led(connHandle,7);
			break;
        case 0x00000007:
			HTTPPrint_led(connHandle,6);
			break;
        case 0x00000008:
			HTTPPrint_led(connHandle,5);
			break;
        case 0x00000009:
			HTTPPrint_led(connHandle,4);
			break;
        case 0x0000000a:
			HTTPPrint_led(connHandle,3);
			break;
        case 0x0000000b:
			HTTPPrint_led(connHandle,2);
			break;
        case 0x0000000c:
			HTTPPrint_led(connHandle,1);
			break;
        case 0x0000000d:
			HTTPPrint_lcdtext(connHandle);
			break;
        case 0x0000000e:
			HTTPPrint_ledSelected(connHandle,4,true);
			break;
        case 0x0000000f:
			HTTPPrint_ledSelected(connHandle,4,false);
			break;
        case 0x00000010:
			HTTPPrint_ledSelected(connHandle,3,true);
			break;
        case 0x00000011:
			HTTPPrint_ledSelected(connHandle,3,false);
			break;
        case 0x00000012:
			HTTPPrint_ledSelected(connHandle,2,true);
			break;
        case 0x00000013:
			HTTPPrint_ledSelected(connHandle,2,false);
			break;
        case 0x00000014:
			HTTPPrint_ledSelected(connHandle,1,true);
			break;
        case 0x00000015:
			HTTPPrint_ledSelected(connHandle,1,false);
			break;
        case 0x00000016:
			HTTPPrint_version(connHandle);
			break;
        case 0x00000017:
			HTTPPrint_led(connHandle,0);
			break;
        case 0x00000018:
			HTTPPrint_btn(connHandle,0);
			break;
        case 0x00000019:
			HTTPPrint_btn(connHandle,1);
			break;
        case 0x0000001a:
			HTTPPrint_btn(connHandle,2);
			break;
        case 0x0000001b:
			HTTPPrint_btn(connHandle,3);
			break;
        case 0x0000001c:
			HTTPPrint_pot(connHandle);
			break;
        case 0x0000001d:
			HTTPPrint_uploadedmd5(connHandle);
			break;
        case 0x0000001e:
			HTTPPrint_snmp_en(connHandle);
			break;
        case 0x0000001f:
			HTTPPrint_read_comm(connHandle,0);
			break;
        case 0x00000020:
			HTTPPrint_read_comm(connHandle,1);
			break;
        case 0x00000021:
			HTTPPrint_read_comm(connHandle,2);
			break;
        case 0x00000022:
			HTTPPrint_write_comm(connHandle,0);
			break;
        case 0x00000023:
			HTTPPrint_write_comm(connHandle,1);
			break;
        case 0x00000024:
			HTTPPrint_write_comm(connHandle,2);
			break;
        case 0x00000025:
			HTTPPrint_status_fail(connHandle);
			break;
        case 0x00000026:
			HTTPPrint_config_mac(connHandle);
			break;
        case 0x00000027:
			HTTPPrint_config_hostname(connHandle);
			break;
        case 0x00000028:
			HTTPPrint_config_dhcpchecked(connHandle);
			break;
        case 0x00000029:
			HTTPPrint_config_ip(connHandle);
			break;
        case 0x0000002a:
			HTTPPrint_config_gw(connHandle);
			break;
        case 0x0000002b:
			HTTPPrint_config_subnet(connHandle);
			break;
        case 0x0000002c:
			HTTPPrint_config_dns1(connHandle);
			break;
        case 0x0000002d:
			HTTPPrint_config_dns2(connHandle);
			break;
        case 0x0000002e:
			HTTPPrint_reboot(connHandle);
			break;
        case 0x0000002f:
			HTTPPrint_rebootaddr(connHandle);
			break;
        case 0x00000030:
			HTTPPrint_status_ok(connHandle);
			break;
        case 0x00000031:
			HTTPPrint_smtps_en(connHandle);
			break;
        case 0x00000032:
			HTTPPrint_ddns_status(connHandle);
			break;
        case 0x00000033:
			HTTPPrint_ddns_status_msg(connHandle);
			break;
        case 0x00000034:
			HTTPPrint_ddns_service(connHandle,0);
			break;
        case 0x00000035:
			HTTPPrint_ddns_service(connHandle,1);
			break;
        case 0x00000036:
			HTTPPrint_ddns_service(connHandle,2);
			break;
        case 0x00000037:
			HTTPPrint_ddns_user(connHandle);
			break;
        case 0x00000038:
			HTTPPrint_ddns_pass(connHandle);
			break;
        case 0x00000039:
			HTTPPrint_ddns_host(connHandle);
			break;
		default:
			// Output notification for undefined values
                       sktHTTP = HTTPCurConnectionSocketGet(connHandle);
			TCPPutArray(sktHTTP, (const uint8_t*)"!DEF", 4);
	}

	return;
}

void HTTPPrint_(HTTP_CONN_HANDLE connHandle)
{
       TCP_SOCKET sktHTTP = HTTPCurConnectionSocketGet(connHandle);
	TCPPut(sktHTTP, '~');
	return;
}

#endif

#endif
