/**
 * INPUT:
 *   Headers:		-
 *   Parameters:	KParamIAPName,
 *	 				KParamDomainName,
 *					KParamUNSAFBindingRequestInterval,
 *					KParamUNSAFUDPKeepaliveInterval
 *					KParamUNSAFTCPKeepaliveInterval
 *   IDs:			-
 *
 * OUTPUT:
 *   Parameters:	-
 *   IDs:			-
 */
void TCmdSetUNSAFTimers::ExecuteL()
	{
	TInt requestInterval( 0 );
	TInt udpKeepAlive( 0 );
	TInt tcpKeepAlive( 0 );
	TBool writeToRepository = ReadInputParametersL( requestInterval,
													udpKeepAlive,
													tcpKeepAlive );	

	CRepository* repository = CRepository::NewLC( KCRUidUNSAFProtocols );
	TUint32 key( 0 );
	// Existing values in repository are not needed
	TInt dummyRequestInterval( 0 );
	TInt dummyUdpKeepAlive( 0 );
	TInt dummyTcpKeepAlive( 0 );
	TInt status = ReadTimerValuesL( *repository,
								    key,
								    dummyRequestInterval,
								    dummyUdpKeepAlive,
								    dummyTcpKeepAlive );
	__ASSERT_ALWAYS( status == KErrNone || status == KErrNotFound,
					 User::Leave( status ) );


	if ( writeToRepository )
		{		
		SetValuesToRepositoryL( *repository,
								status,
								key,
								requestInterval,
								udpKeepAlive,
								tcpKeepAlive );
		}
	else
		{
		if ( status == KErrNone )
			{
			RemoveParameterL( *repository,
							  KUNSAFProtocolsIntervalUDPMask | key );
			RemoveParameterL( *repository,
							  KUNSAFProtocolsIntervalTCPMask | key );
			RemoveParameterL( *repository,
							  KUNSAFProtocolsSTUNRetransmitTimerMask | key );
			RemoveParameterL( *repository,
							  KUNSAFProtocolsDomainIntervalUDPMask | key );
			RemoveParameterL( *repository,
							  KUNSAFProtocolsDomainIntervalTCPMask | key );
			}
		}

	CleanupStack::PopAndDestroy( repository );
	}
void loop()
{

    btn1Val = digitalRead(btn1);

    if (!btn1Down && btn1Val == HIGH) {
        btn1Down = true;
        tcpLog("BTN1PRESSED");
    } else if (btn1Val == LOW) {
        btn1Down = false;
    }

    // If you want to try KeepAlive
    tcpKeepAlive();
}