コード例 #1
0
void CStringParser::ProcessReadString(const TDesC8& aReadString)
	{
	LOGTEXT(_L8("[Ltsy] Starting CStringParse::ProcessReadString()"));
	LOGTEXT2(_L8("[Ltsy] Read String = %S"), &aReadString);
	for (TInt nBufferOffset = 0; nBufferOffset < aReadString.Length(); nBufferOffset++)
		{
		TText8 tChar = aReadString[nBufferOffset];
		
		// we have already found a char which is a delimiter of the Line
        // so would dismiss any of delimiter following this one already found		
		if (iInDelimiter && (tChar == '\r' || tChar == '\n'))
			{
			continue;
			}
		
		// move on lastchar
		*iLastChar++ = tChar;
		// Diacarding characters if our buffer was overflowed
		if (iLastChar >= iBufferEnd)
			{
			iLastChar = iBufferEnd;
			}
        // we anyway to find out the delimiter and notify the obser the line was found 		
		if (tChar == '\r' || tChar == '\n')
			{
			iInDelimiter = ETrue;
			TPtrC8 tLine(CurrentLine());
			LOGTEXT2(_L8("[Ltsy] Line Content = %S"), &tLine);
			TRAPD(err, iReadLineNotify->NotifyOneLineFoundL(KErrNone, tLine));
			if (err != KErrNone)
				{
				ClearCurrentLine();
				}
			}
		else
			{
			if(iInDelimiter) // the last char is a delimiter
			    {
				iInDelimiter=EFalse;
			    iLineStart=iLastChar-1;	
			    if(tChar == '>')
			    	{
			    	TPtrC8 tLine(CurrentLine());
			    	TRAPD(err, iReadLineNotify->NotifyOneLineFoundL(KErrNone, tLine));
					if (err != KErrNone)
						{
						ClearCurrentLine();
						}			    	
			    	}
				}   
			}
		}
	LOGTEXT(_L8("[Ltsy] End CStringParse::ProcessReadString()"));
	}
コード例 #2
0
ファイル: svctlcui.cpp プロジェクト: zukisoft/external
const INT_PTR ConsoleUI::PromptUser(UINT uType) const
{
	LPCTSTR			pszPromptText = NULL;		// Pointer to the prompt text
	PCVKEY			rgvkResponses = NULL;		// Pointer to valid responses
	VKEY			vkInput = NULL;				// User's response character
	DWORD			dwIndex;					// Loop index variable

	uType &= 0x0000000F;			// Strip all but button codes from uType

	// Locate the prompt text and valid response key codes in the global array

	for(dwIndex = 0; dwIndex < g_cConsolePrompts; dwIndex++) {
		if(uType == g_rgConsolePrompts[dwIndex].uButtonCode) {

			pszPromptText = g_rgConsolePrompts[dwIndex].pszPrompt;
			rgvkResponses = g_rgConsolePrompts[dwIndex].rgvkRepsonses;
			
			break;					// Found the prompt information
		}
	}

	// If the button code did not exist, fall back to a default response

	if((!pszPromptText) || (!rgvkResponses)) return DefaultUserResponse(uType, false);

	// Display the prompt, wait for a response, and erase everything when done
	
	Write(pszPromptText, CONSOLE_NORM_LMARGIN, false);
	vkInput = GetVkResponse(rgvkResponses);
	ClearCurrentLine();

	// If we were unable to retrieve the user's response use a default
	
	if(vkInput == NULL) return DefaultUserResponse(uType, false);

	// Map the response virtual key code into both the response text and the
	// associated MessageBox() INT_PTR return value
	
	for(dwIndex = 0; dwIndex < g_cConsoleResponses; dwIndex++) {

		if(g_rgConsoleResponses[dwIndex].vkResponse == vkInput) {

			Write(g_rgConsoleResponses[dwIndex].pszResponse);
			return g_rgConsoleResponses[dwIndex].nResponse;
		}
	}

	return DefaultUserResponse(uType, false);		// Response key code was not mapped
}
コード例 #3
0
void CATDtmfVts::EventSignal(TAtEventSource /*aEventSource*/, TInt aStatus)
	{
	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDtmfVts::EventSignal()"));
	LOGTEXT2(_L8("[Ltsy CallControl] aEventSource = %d\taStatus = %d"),aStatus);
	
	iIOStatus = aStatus;
	
	//Process I/O Error
	if (iIOStatus != KErrNone)
		{
		HandleResponseError();
		Complete();
		return;
		}
	
	//Process at step
	switch(iAnswerStep)
		{
		case EATWaitForWriteComplete:
			iAnswerStep = EATReadComplete;
			break;
			
		case EATReadComplete:
			ClearCurrentLine();
			if (iATResult == KErrNone)
				{
				HandleSendDtmfTonesSuccess();
				}
			else
				{
				HandleResponseError();
				}
			Complete();
			break;
			
		default:
			break;
		}
	}
コード例 #4
0
// ---------------------------------------------------------------------------
// CAtPhbkStoreRead::EventSignal
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtPhbkStoreRead::EventSignal(TAtEventSource aEventSource, TInt aStatus)
	{
	LOGTEXT3(_L8("CAtPhbkStoreRead::EventSignal aStatus=%D iSource=%D"),aStatus,aEventSource);
	if(aStatus != KErrNone)
		{
		Complete();
		iPhoneGlobals.iEventSignalActive = EFalse;
		iCtsyDispatcherCallback.CallbackPhonebookStoreReadEntryComp(aStatus,iPhoneBookType,iPhbkData);
		}
	else
		{
		if( aEventSource== EWriteCompletion )
			{
			if( iState==ESetStoreName )
				{
				iState = ESetStoreNameComplete;
				}
			else if( iState==EReadEntry )
				{
				iState = EReadEntryComplete;
				}
			}
		else 
			{
			if( iState==ESetStoreNameComplete )
				{
				Complete();
				iPhoneGlobals.iEventSignalActive = EFalse;
				if(iError == KErrNone)
					{
					ClearBuffer();
					iState = EReadEntry;
					ReadEntry();
					}
				else 
					{
					iCtsyDispatcherCallback.CallbackPhonebookStoreReadEntryComp(iError,iPhoneBookType,iPhbkData);
					}
				}
			else if( iState==EReadEntryComplete )
				{
				Complete();
				iPhoneGlobals.iEventSignalActive = EFalse;
				//encounter OK or ERROR
				if( iEndFlag )
					{
					ClearBuffer();
					iPhbkData.Zero();
					iCtsyDispatcherCallback.CallbackPhonebookStoreReadEntryComp(iError,iPhoneBookType,iPhbkData);
					}
				else
					{
					if( iError==KErrNone )
						{
						TRAPD(err, GeneratePhbkDataL());
						iCtsyDispatcherCallback.CallbackPhonebookStoreReadEntryComp(err,iPhoneBookType,iPhbkData);
						ClearCurrentLine();
						}
					else
						{
						iCtsyDispatcherCallback.CallbackPhonebookStoreReadEntryComp(iError,iPhoneBookType,iPhbkData);
						}
					}
				}
			}
		}
	}
コード例 #5
0
ファイル: svctlcui.cpp プロジェクト: zukisoft/external
DWORD ConsoleUI::ProgressProc(void)
{
	CONSOLE_SCREEN_BUFFER_INFO	conInfo;		// Console information
	int							nPosition;		// Current cursor position
	DWORD						dwWait;			// Result from wait operation

	// If a cancellation event handle is available, display the CTRL+C message,
	// otherwise just set up the left margin by writing the NULL string

	if(m_hevtCancel) Write(CONSOLE_CANCEL_PROGRESS, CONSOLE_NORM_LMARGIN, false);
	else Write(CONSOLE_NULL_STRING, CONSOLE_NORM_LMARGIN, false);
	
	GetConsoleScreenBufferInfo(m_hout, &conInfo);		// Retrieve dimensions
	conInfo.dwSize.X -= CONSOLE_NORM_RMARGIN;			// Adjust for the right margin
	
	nPosition = conInfo.dwCursorPosition.X;				// Set initial position
	HANDLE rghWait[] = { m_hevtStop, s_hevtCtrlC };		// Initialize handle array
	
	do {

		// Continually write progress dots to the console until we are told to stop,
		// or the user cancels the operation via the CTRL+C handler

		dwWait = WaitForMultipleObjects((m_hevtCancel) ? 2 : 1, rghWait, FALSE,
			CONSOLE_PROGRESS_INTERVAL);

		switch(dwWait) {

			// WAIT_TIMEOUT : Display another progress dot on the console

			case WAIT_TIMEOUT :

				WriteChar(CONSOLE_PROGRESS);

				// If the current cursor position has exceeded the right margin,
				// clear any of the already displayed dots and reset the cursor

				if(++nPosition >= conInfo.dwSize.X) {

					SetConsoleCursorPosition(m_hout, conInfo.dwCursorPosition);
					nPosition = conInfo.dwCursorPosition.X;

					while(nPosition++ < conInfo.dwSize.X) WriteChar(CONSOLE_SPACE);
					
					SetConsoleCursorPosition(m_hout, conInfo.dwCursorPosition);
					nPosition = conInfo.dwCursorPosition.X;
				}

				break;

			// WAIT_OBJECT_0 + 1 : The CTRL+C handler has been invoked

			case WAIT_OBJECT_0 + 1 :

				if(m_hevtCancel) SetEvent(m_hevtCancel);	// Set cancellation event
				
				break;

			// WAIT_FAILED : Something bad has happened

			case WAIT_FAILED : return GetLastError();
		}
	
	} while(dwWait == WAIT_TIMEOUT);

	// After the loop has been broken, display the final status of the progress
	// on the current line after it has been cleared off
	
	ClearCurrentLine();
	Write((dwWait == WAIT_OBJECT_0) ? g_pszIDOK : g_pszIDCANCEL);
	
	return ERROR_SUCCESS;
}