Beispiel #1
0
void
_DtTermPrimParserSaveSign
(
    Widget w
)
{
    ParserContext   context = GetParserContext(w);

    SetSign(context, (*GetInputChar(context) == '-') ? TermPARSER_SIGNnegative :
	    TermPARSER_SIGNpositive);
}
Beispiel #2
0
void NextChar (void)
/* Skip the current input character and read the next one from the input
 * stream. CurC and NextC are valid after the call. If end of line is
 * reached, both are set to NUL, no more lines are read by this function.
 */
{
    /* Skip the last character read */
    SB_Skip (Line);

    /* Read the next one */
    GetInputChar ();
}
Beispiel #3
0
BOOL CAuthTest::Test_ChangePIN()
{
    SHOW_PROCESS("ChangePIN");
    if (NULL == g_hApp)
    {
        printf("OPen application first!\n");
        return  FALSE;
    }

    int szBuf;
    ULONG nAccountType = 0;
    printf("Input 0: administrator, 1:User\n");

    fflush(stdin);
//	szBuf = getchar();
    szBuf = GetInputChar();

    if (szBuf == '0')
        nAccountType = 0;
    else if (szBuf == '1')
        nAccountType = 1;
    else
        return FALSE;

    char szOldPIN[256] = {0};
    char szNewPIN[256] = {0};
    ULONG nRetryNum = 0;

    printf("Input Old PIN:\n");
    fflush(stdin);
    gets(szOldPIN);

    printf("Input New PIN:\n");
    fflush(stdin);
    gets(szNewPIN);

    ULONG ulReval = SKF_ChangePIN(g_hApp, nAccountType, (LPSTR)szOldPIN, (LPSTR)szNewPIN, &nRetryNum);
    SHOW_ERROR(ulReval);

    return (SAR_OK == ulReval);
}
Beispiel #4
0
BOOL CAuthTest::Test_GetPINInfo()
{
    SHOW_PROCESS("GetPINInfo");
    if (NULL == g_hApp)
    {
        printf("OPen application first!\n");
        return FALSE;
    }

    int szBuf;
    ULONG nAccountType = 0;
    printf("Input 0: administrator, 1:User\n");

    fflush(stdin);
//	szBuf = getchar();
    szBuf = GetInputChar();

    if (szBuf == '0')
        nAccountType = 0;
    else if (szBuf == '1')
        nAccountType = 1;
    else
        return FALSE;

    ULONG ulMaxRetryCount = 0;
    ULONG ulRemainRetryCount = 0;
    BOOL DefaultPin = FALSE;

    ULONG ulReval = SKF_GetPINInfo(g_hApp, nAccountType, &ulMaxRetryCount, &ulRemainRetryCount, &DefaultPin);
    SHOW_ERROR(ulReval);
    if (SAR_OK == ulReval)
    {
        printf("Max retry count is : %d\n", ulMaxRetryCount);
        printf("Remain retry count is: %d\n", ulRemainRetryCount);
        printf("is Default PIN: %d\n", DefaultPin);
    }

    return (SAR_OK == ulReval);
}
Beispiel #5
0
bool ParseKeys(CNV11* nv11)
{
	// If a keyboard hit is detected
	if (_kbhit())
	{
		char c = _getch(); // Get the key
		switch (c)
		{
		case 'x': return false;
		case 'e': 
				// Enable unit
				nv11->EnableValidator();
				break;
		case 'd':
				// Disable unit
				nv11->DisableValidator();
				break;
		case 'p':
			{
				if (IsPolling)
				{
					IsPolling = false; 
					cout << "Stopped polling" << endl;
				}
				else
				{
					IsPolling = true;
					cout << "Started polling" << endl;
				}
				break;
			}
		case 'r':
			{
				// Report the positions of any notes stored in the NV11
				cout << "Note positions: " << endl;
				nv11->OutputNoteLevelInfo();

				// Report which channel is recycling (1 recycling at once in NV11)
				nv11->OutputCurrentRecycling();
				WriteString(" is currently recycling");
				break;
			}
		case 'h': DisplayCommands(); break;
		case 't': 
				// Wait for thread release then reset the unit
				nv11->ResetValidator();
				nv11->CloseComPort();
				break;
		case 'c': 
			{
				string denom = GetInputString("Enter note value and currency E.g. 10 EUR: ");

				// Break into 2 strings, first contains value, second currency
				string s1 = "";	
				size_t pos = denom.find_first_of(' ');
				if (pos == denom.npos)
				{
					WriteString("Input was not in the correct format");
					break;
				}
				s1 = denom.substr(pos+1, s1.npos);
				denom.erase(pos, denom.npos);

				// Convert value to float
				float value = (float)atof(denom.c_str()) * 100.0f;

				if (value <= 0)
				{
					WriteString("Value was less than or equal to zero");
					break;
				}

				// Make sure each char in the currency is uppercase and
				// only 3 chars were entered
				if (s1.length() != 3)
				{
					WriteString("Invalid currency");
					break;
				}
				for (int i = 0; i < 3; ++i)
					s1[i] = toupper(s1[i]);

				// Get whether to stack or store note
				char stack = GetInputChar("1 = Store note\n2 = Stack note\n");
				int b = atoi(&stack)-1;
				if (b < 0 || b > 1)
				{
					WriteString("Invalid input");
					break;
				}
				nv11->ChangeRouting((int)value, (char*)s1.c_str(), b);
				break;
			}
		case 's':
				nv11->StackNextNote(); // Move the next note in the recycler to the cashbox
				break;
		case 'n': 
				nv11->PayoutNextNote(); // Payout the next note in the recycler
				break;
		case 'm': 
				nv11->EmptyPayout(); // Move all the notes in the recycler to the cashbox
				break;
		default: break;
		}
	}
	return true;
}
Beispiel #6
0
char Keyboard::getInputChar( ) {
	return GetInputChar( TRUE );
}