Exemple #1
0
void showMessageError(void){
	BYTE linea1[80 + 1];
	BYTE i, y=0;

	if( strlen( gToken_7.msg_largo) <= 0 )
		return;

	memset(linea1, 0x00, sizeof(linea1));
	for(i=0; i<60; i++){
		if( i%20 == 0 ){
			linea1[y++] = 0x0A;
			linea1[y++] = 0x20;
			linea1[y++] = 0x20;
		}
		linea1[y++] = gToken_7.msg_largo[i];
	}
	DispLineMW( "ERROR", MW_LINE1, MW_CENTER|MW_REVERSE|MW_CLRDISP|MW_SMFONT );
	DispClrBelowMW(MW_LINE2);
	LongBeep();
	DispPutCMW(K_PushCursor);
	os_disp_textc(COLOR_RED);
	DispGotoMW( MW_LINE3 + 2, MW_SPFONT );
	printf("%s", linea1);
	DispPutCMW(K_PopCursor);
	WaitKey(1500, 0);

	procesarMensajePOS();
}
Exemple #2
0
/******************************************************************************
 *  Function        : DecData
 *  Description     : Decrypt data for testing
 *  Input           : N/A
 *  Return          : N/A
 *  Note            : N/A
 *  Globals Changed : N/A
 ******************************************************************************
 */
void DecData(void)
{
  BYTE kbdbuf[36], buf[32];
  WORD ret;
  
  while (1) {
    kbdbuf[0] = 0;
    DispLineMW("I/P Data [Dec]:", MW_LINE1, MW_CLRDISP|MW_BIGFONT);
    if (!APM_GetKbd(HEX_INPUT+ECHO+MW_LINE3, 16, kbdbuf))
      return;
    if ((kbdbuf[0]%16) == 0)
      break;
    LongBeep();
  }
  compress(&kbdbuf[1], &kbdbuf[1], kbdbuf[0]/2);
  ret = KDLL_Key3Decrypt(DKEY_IDX, &kbdbuf[1], kbdbuf[0]/2);
  if (ret) {
    SprintfMW(buf, "Dec Err: %d", ret);
    DispLineMW(buf, MW_LINE5, MW_BIGFONT);
  }
  else {
    DispLineMW("Decrypted:", MW_LINE5, MW_SMFONT);
    split(buf, &kbdbuf[1], kbdbuf[0]/2);
    DispGotoMW(MW_LINE6, MW_SMFONT);
    DispPutNCMW(buf, kbdbuf[0]);
    DispCtrlMW(K_SelBigFont);
  }
  APM_WaitKey(9000, 0);
}
Exemple #3
0
/******************************************************************************
 *  Function        : GetDukptPin
 *  Description     : Get DUKPT encrypted pin block
 *  Input           : N/A
 *  Return          : TRUE;           // key load ok
 *                    FALSE;          // key load failed
 *  Note            : N/A
 *  Globals Changed : N/A
 ******************************************************************************
 */
BOOLEAN GetDukptPin(void)
{
  const BYTE msg[]="\f\x11==== DUKPT =====\nENTER PIN:\x0";
  BYTE pinblk[32];
  BYTE buf[32];

  // format the PAN
  memcpy(pinblk, "\x40\x12\x34\x56\x78\x90\x9F\xFF\xFF\xFF", 10); //X9.24
  
  if (KDLL_DukptGetPin(pinblk, msg, dhost_idx)) {
    DispLineMW("DGetPIN Failed!", MW_LINE5, MW_CLRDISP|MW_CENTER|MW_BIGFONT);
    LongBeep();
    APM_WaitKey(9000, 0);
    return FALSE;
  }
  DispClrBelowMW(MW_LINE6);
  split(buf, pinblk, 8);
  DispGotoMW(MW_LINE7, MW_SPFONT);
  DispPutNCMW(buf, 16);
  split(buf, &pinblk[8], 10);
  DispGotoMW(MW_LINE8, MW_SPFONT);
  DispPutNCMW(buf, 20);
  DispCtrlMW(K_SelBigFont);
  APM_WaitKey(9000, 0);
  return TRUE;
}
Exemple #4
0
/******************************************************************************
 *  Function        : LoadTmk
 *  Description     : Load terminal master key
 *  Input           : N/A
 *  Return          : TRUE;           // key load ok
 *                    FALSE;          // key load failed
 *  Note            : N/A
 *  Globals Changed : N/A
 ******************************************************************************
 */
BOOLEAN LoadTmk(void)
{
  BYTE keycfg[20];
  WORD ret;
  BYTE buf[32];

  // injecting the TMK
  keycfg[0] = KEYMODE_MKEY | KEYMODE_DOUBLE;
  keycfg[1] = MKEY_IDX;
  memcpy(&keycfg[2], "\xFF\x00", 2);
  memcpy(&keycfg[4], \
    "\x01\x23\x45\x67\x89\xAB\xCD\xEF\xFE\xDC\xBA\x98\x76\x54\x32\x10", 16);
  
  ret = KDLL_KeyInject(keycfg);
  if (ret) {
    DispLineMW("TMKI Failed!", MW_LINE5, MW_CENTER|MW_BIGFONT);
    SprintfMW(buf, "Ret = %d", ret);
    DispLineMW(buf, MW_LINE7, MW_CENTER|MW_BIGFONT);
    LongBeep();
    APM_WaitKey(200, 0);
    return FALSE;
  }
  AcceptBeep();
  return TRUE;
}
Exemple #5
0
BOOLEAN procesoConsultaSaldoImp(void){
	int costServ = 0;
	BYTE kbdbuff[10];
	BYTE tmpPan[20 + 1];
	//BYTE aux[10];

	memset(kbdbuff, 0x00, sizeof(kbdbuff));
	memset(tmpPan,  0x00, sizeof(tmpPan));
	//memset(aux, 0x00, sizeof(aux));

	costServ = RSP_DATA.dd_amount;
	DispClrBelowMW(MW_LINE2);
	DispLineMW( "Costo Servicio:", MW_LINE3, MW_LEFT|MW_SPFONT );
	//split(aux, gToken_80.costoServicio, 2);
	//costServ = atoi(aux);
	DispAmnt( costServ, MW_LINE3, MW_SPFONT );
	if( SiNo() != 2 ) {  // 2 = Press Enter
		return FALSE;
	}
	DispLineMW( "DESLICE LA TARJETA", MW_LINE4, MW_SMFONT|MW_CENTER|MW_CLRDISP );

	if( GetCard( FALSE, FALSE ) == FALSE ){
		LongBeep();
		DispLineMW( "CONSULTA DE SALDO", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP );
		DispLineMW( "TRANSACCION CANCELADA", MW_LINE3, MW_CENTER );
		APM_WaitKey(200, 0);
		return FALSE;
	}
	do
	{
		DispLineMW( "CONSULTA DE SALDO", MW_LINE1, MW_CENTER|MW_REVERSE|MW_CLRDISP|MW_SMFONT );
		DispLineMW( "INGRESE LOS ULTIMOS", MW_LINE3, MW_CENTER|MW_SPFONT );
		DispLineMW( "CUATRO DIGITOS", MW_LINE4, MW_CENTER|MW_SPFONT );
		DispLineMW( "DE LA TARJETA", MW_LINE5, MW_CENTER|MW_SPFONT );

		memset(kbdbuff, 0x00, sizeof(kbdbuff));
		APM_SetCol(7); // Set Columna for TextBox
		if (!APM_GetKbd(NUMERIC_INPUT + MW_SMFONT + MW_LINE7, IMIN(4) + IMAX(4), kbdbuff)){
			return FALSE;
		}
		// Compara los ultimo 4 digitos del Pan
		memset( tmpPan, 0x00, sizeof(tmpPan) );
		split( tmpPan, INPUT.sb_pan, 10 );
		RTrim( tmpPan, 'F');
	} while (memcmp(&kbdbuff[1], &tmpPan[strlen(tmpPan) - 4], 4) != 0);

	DispLineMW( "CONSULTA DE SALDO", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP );
	DispLineMW( "Costo Servicio:", MW_LINE3, MW_LEFT|MW_SPFONT );
	DispAmnt(costServ, MW_LINE3, MW_SPFONT);

	if( !getPinblock() )
		return FALSE;

	INPUT.dd_amount = costServ;	// El costo del servicio debe viajar en el campo 4 en la proxima transaccion
	sprintf(gAmount, "%012d", INPUT.dd_amount);

	return TRUE;
}
void    key_SetRelaxsTariff(void)
{
  if (bKey == bKEY_ENTER)
  {
    if (enKeyboard == KBD_ENTER)
    {
      if (boRelaxsFlag == true)
      {
        enKeyboard = KBD_POSTENTER;
        Clear();

        LoadSlide(pszRelaxs);
        ShowChar(ibRelaxsTariff+1); 
      }
      else BlockProgram(bSET_RELAXS_FLAG);
    } 
    else if (enKeyboard == KBD_POSTINPUT1)
    {
      enKeyboard = KBD_POSTENTER;

      ibX = GetCharLo(6,8);
      if ((ibX > 0) && (ibX <= bTARIFFS))
      {
        ibRelaxsTariff = ibX-1;
        SaveCache(&chRelaxsTariff);

        ShowChar(ibRelaxsTariff+1); 
      }
      else 
      {
        enKeyboard = KBD_INPUT1;
        LongBeep();

        ShowLo(szMaskRelaxs);
      }
    }
    else Beep();
  }


  else if (bKey < 10)
  {
    if ((enGlobal != GLB_WORK) && (enKeyboard == KBD_POSTENTER))
    {
      enKeyboard = KBD_INPUT1;
      ShowLo(szMaskRelaxs);
    }

    if ((enKeyboard == KBD_INPUT1) || (enKeyboard == KBD_POSTINPUT1))
    {
      enKeyboard = KBD_POSTINPUT1;
      ShiftLo(6,8);
    }
  }
  else Beep();
}
Exemple #7
0
/******************************************************************************
 *  Function        : ResetDukptIkey
 *  Description     : Reset terminal DUKPT init key
 *  Input           : N/A
 *  Return          : TRUE;           // key load ok
 *                    FALSE;          // key load failed
 *  Note            : N/A
 *  Globals Changed : N/A
 ******************************************************************************
 */
BOOLEAN ResetDukptIkey(void)
{
  DispLineMW("Resetting Keys..", MW_LINE5, MW_CLRDISP|MW_CENTER|MW_BIGFONT);
  if (!KDLL_DukptKeyReset(dhost_idx)) {
    DispLineMW("DUKI Rst Failed!", MW_LINE5, MW_CLRDISP|MW_CENTER|MW_BIGFONT);
    LongBeep();
    APM_WaitKey(9000, 0);
    return FALSE;
  }
  Short2Beep();
  return TRUE;
}
void    key_GetPassword(void)
{
  if (bKey == bKEY_ENTER)
  {
    if (enKeyboard == KBD_ENTER)
    {
      enKeyboard = KBD_INPUT2;

      ShowHi(szPassword);
      ShowLo(szMaskPass);

      ClearPassTwo();
      ibX = 3;
    }
    else if (enKeyboard == KBD_INPUT2)
    { 
      if ((memcmp(mpbPassOne, mpbPassTwo, 10) == 0) || SuperUser())
      {       
        enKeyboard = KBD_BEGIN;
        OK();

        boSetPassword = true;
        SaveCache(&chSetPassword);

        enGlobal = GLB_REPROGRAM;
        Setting();

//        AddSysRecord(EVE_PASSWORD);
      }
      else 
      {
        enKeyboard = KBD_ENTER;
        LongBeep();

        Error();
      }
    }
  }


  else if (bKey < 10)
  {
    if (enKeyboard == KBD_INPUT2)
    {
      if (ibX < 13)
      {
        mpbPassTwo[ibX-3] = bKey;
        szLo[ibX++] = '*';
      }
    }
  }
  else Beep();
}
Exemple #9
0
BOOLEAN procesoConsultaSaldoCNB(void){
  
  BYTE kbdbuff[10];
  BYTE tmpPan[20 + 1];
  //BYTE aux[10];

  memset(kbdbuff, 0x00, sizeof(kbdbuff));
  memset(tmpPan,  0x00, sizeof(tmpPan));
  //memset(aux, 0x00, sizeof(aux));

  
  DispClrBelowMW(MW_LINE2);
  DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_CLRDISP|MW_SMFONT );
  DispLineMW( "DESLICE LA TARJETA", MW_LINE4, MW_SMFONT|MW_CENTER|MW_CLRDISP );

  if( GetCard( FALSE, FALSE ) == FALSE ){
    LongBeep();
    DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP );
    DispLineMW( "TRANSACCION CANCELADA", MW_LINE3, MW_CENTER );
    APM_WaitKey(200, 0);
    return FALSE;
  }
  do
  {
    DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_CLRDISP|MW_SMFONT );
    DispLineMW( "INGRESE LOS ULTIMOS", MW_LINE3, MW_CENTER|MW_SPFONT );
    DispLineMW( "CUATRO DIGITOS", MW_LINE4, MW_CENTER|MW_SPFONT );
    DispLineMW( "DE LA TARJETA", MW_LINE5, MW_CENTER|MW_SPFONT );

    memset(kbdbuff, 0x00, sizeof(kbdbuff));
    APM_SetCol(7); // Set Columna for TextBox
    if (!APM_GetKbd(NUMERIC_INPUT + MW_SMFONT + MW_LINE7, IMIN(4) + IMAX(4), kbdbuff)){
      return FALSE;
    }
    // Compara los ultimo 4 digitos del Pan
    memset( tmpPan, 0x00, sizeof(tmpPan) );
    split( tmpPan, INPUT.sb_pan, 10 );
    RTrim( tmpPan, 'F');
  } while (memcmp(&kbdbuff[1], &tmpPan[strlen(tmpPan) - 4], 4) != 0);

  DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP );
  

  if( !getPinblock() )
    return FALSE;

   return TRUE;
}
Exemple #10
0
/******************************************************************************
 *  Function        : SetDhostIdx
 *  Description     : Reset terminal DUKPT init key
 *  Input           : N/A
 *  Return          : TRUE;           // key load ok
 *                    FALSE;          // key load failed
 *  Note            : N/A
 *  Globals Changed : N/A
 ******************************************************************************
 */
BOOLEAN SetDhostIdx(void)
{
  BYTE kbdbuf[4];
  
  kbdbuf[0] = 1;
  kbdbuf[1] = '0' + dhost_idx;
  while (1) {
    DispLineMW("DHost Idx(0-4):", MW_LINE5, MW_CLRDISP|MW_BIGFONT);
    if (!APM_GetKbd(NUMERIC_INPUT+ECHO+MW_LINE7+MW_BIGFONT+RIGHT_JUST, IMIN(1)+IMAX(1), kbdbuf))
      return FALSE;
    if (kbdbuf[1] < '5')
      break;
    else
      LongBeep();
  }
  dhost_idx = kbdbuf[1] - '0';
  return TRUE;
}
Exemple #11
0
void SetMasterKey( void )
{
  while( TRUE )
  {
    os_sleep();
	if( !key_ready( MKEY_IDX ) )
    {
      printf("\f");
      DispLineMW("INYECTE", MW_LINE3, MW_SMFONT|MW_CENTER);
      DispLineMW("MASTERKEY", MW_LINE4, MW_SMFONT|MW_CENTER);
      LongBeep( );
      WaitKey( 300, 0 );
    }
    else
    {
      break;
    }
    KDLL_IccMKeyInject( MKEY_IDX, 0 );
  }
}
Exemple #12
0
/******************************************************************************
 *  Function        : LoadDukptIkey
 *  Description     : Load terminal DUKPT init key
 *  Input           : N/A
 *  Return          : TRUE;           // key load ok
 *                    FALSE;          // key load failed
 *  Note            : N/A
 *  Globals Changed : N/A
 ******************************************************************************
 */
BOOLEAN LoadDukptIkey(void)
{
  BYTE keycfg[32];

  // injecting the initial key
  keycfg[0] = KEYMODE_DOUBLE;
  keycfg[1] = dhost_idx;
  // initial key (16 bytes)     6AC292FAA1315B4D 858AB3A3D7D5933A
  memcpy(&keycfg[2], "\x6A\xC2\x92\xFA\xA1\x31\x5B\x4D\x85\x8A\xB3\xA3\xD7\xD5\x93\x3A", 16);
  // KSN (10 bytes)             FFFF9876543210E00000  
  memcpy(&keycfg[18], "\xFF\xFF\x98\x76\x54\x32\x10\xE0\x00\x00", 10);
  
  DispLineMW("Loading IKey..", MW_LINE5, MW_CLRDISP|MW_CENTER|MW_BIGFONT);
  if (KDLL_DukptKeyInject(keycfg)) {
    DispLineMW("DUKI Failed!", MW_LINE5, MW_CLRDISP|MW_CENTER|MW_BIGFONT);
    LongBeep();
    APM_WaitKey(9000, 0);
    return FALSE;
  }
  Short2Beep();
  return TRUE;
}
Exemple #13
0
/******************************************************************************
 *  Function        : GetPIN
 *  Description     : Get PIN from user
 *  Input           : N/A
 *  Return          : TRUE;           // get pin ok
 *                    FALSE;          // get pin failed
 *  Note            : N/A
 *  Globals Changed : N/A
 ******************************************************************************
 */
BOOLEAN GetPIN(void)
{
  BYTE pinblk[10];
  BYTE msg[] = "\f\x11\nENTER PIN";
  BYTE buf[32];
  
  memset(gGTS.s_input.sb_pin, ' ', 8);

  if (!key_ready(EKEY_IDX)) {
    DispLineMW("NO PIN KEY", MW_LINE5, MW_CLRDISP|MW_CENTER|MW_BIGFONT);
    LongBeep();
    APM_WaitKey(9000,0);
    return FALSE;
  }

#if 0
  // Online PIN
  memcpy(pinblk, gGTS.s_input.sb_pan, 10);
  if (KDLL_GetX98PIN(pinblk, msg, EKEY_IDX))
    return FALSE;
  else
    memcpy(gGTS.s_input.sb_pin, pinblk, 8);
#else
  // GetPIN demo
  memcpy(pinblk, "\x40\x12\x34\x56\x78\x90\x9F\xFF\xFF\xFF", 10); //X9.24
  if (KDLL_GetX98PIN(pinblk, msg, EKEY_IDX))
    return FALSE;
  DispClrBelowMW(MW_LINE6);
  split(buf, pinblk, 8);
  DispGotoMW(MW_LINE7, MW_SPFONT);
  DispPutNCMW(buf, 16);
  DispCtrlMW(K_SelBigFont);
  APM_WaitKey(9000, 0);
#endif

  return TRUE;
}
void    key_SetGpsConfig(void)
{
  if (bKey == bKEY_ENTER)
  {
    if (enKeyboard == KBD_ENTER)
    {
      enKeyboard = KBD_POSTENTER;

      ShowHi(szMessage);
      Clear();

      Show();
    } 
    else if (enKeyboard == KBD_POSTINPUT1)
    {
      enKeyboard = KBD_POSTENTER;

      uchar bPrt = GetCharLo(6,8);
      if (bPrt == 0)
      {
        bPortGps = 0;
        SaveCache(&chPortGps);

        Show();
      }
      else if (bPrt <= bPORTS)
      {
        if (StreamPortDirect(bPrt-1) == 0)
        {
          bPortGps = 0;
          SaveCache(&chPortGps);

          Show();
        }
        else
        {
          bPortGps = bPrt;
          SaveCache(&chPortGps);

          Show();

          uchar ibPrt = bPrt - 1;
          mppoPorts[ibPrt].ibBaud = 3;
          mppoPorts[ibPrt].ibParity = 0;
          SetSpeed(ibPrt);
          SetDefaultDelay(ibPrt);
        }
      }
      else 
      {
        enKeyboard = KBD_INPUT1;
        LongBeep();

        ShowLo(szMask);
      }
    }
    else Beep();
  }


  else if (bKey == bKEY_MINUS)
    ShowTimeDateGps(0);


  else if (bKey == bKEY_POINT)
    ShowTimeDateGps(1);


  else if (bKey < 10)
  {
    if ((enGlobal != GLB_WORK) && (enKeyboard == KBD_POSTENTER))
    {
      enKeyboard = KBD_INPUT1;
      ShowLo(szMask);
    }

    if ((enKeyboard == KBD_INPUT1) || (enKeyboard == KBD_POSTINPUT1))
    {
      enKeyboard = KBD_POSTINPUT1;
      ShiftLo(6,8);
    }
  }
  else Beep();
}
void    key_SetPassword(void)
{
  if (bKey == bKEY_ENTER)
  {
    if (enKeyboard == KBD_ENTER)
    {
      enKeyboard = KBD_INPUT1;
  
      ShowHi(szPassword);
      ShowLo(szMaskPass);

      szLo[15] = '1';
      ClearPassOne();
      ibX = 3;

      boSetPassword = false;
      SaveCache(&chSetPassword);
    }
    else if (enKeyboard == KBD_INPUT1)
    {
      enKeyboard = KBD_INPUT2;

      ShowLo(szMaskPass);

      szLo[15] = '2';
      ClearPassTwo();
      ibX = 3;
    }
    else if (enKeyboard == KBD_INPUT2)
    {
      if (memcmp(mpbPassOne, mpbPassTwo, 10) == 0)
      {
        enKeyboard = KBD_BEGIN;
        OK();

        boSetPassword = true;
        SaveCache(&chSetPassword);
      }
      else 
      {
        enKeyboard = KBD_ENTER;
        LongBeep();

        Error();
      }
    }
  }


  else if (bKey < 10)
  {
    if (enKeyboard == KBD_INPUT1)
    {
      if (ibX < 13)
      {
        mpbPassOne[ibX-3] = bKey;
        szLo[ibX++] = '*';
      }
    }
    else 
    if (enKeyboard == KBD_INPUT2)
    {
      if (ibX < 13)
      {
        mpbPassTwo[ibX-3] = bKey;
        szLo[ibX++] = '*';
      }
    }
  }
}
Exemple #16
0
//*****************************************************************************
//  Function        : MenuSelect
//  Description     : Handle Menu Selection Operation.
//  Input           : aMenu;            // pointer to menu struct
//  Return          : selection index;  // -1 => No Selection
//  Note            : N/A
//  Globals Changed : N/A
//*****************************************************************************
int MenuSelect(const struct MENU_DAT *aMenu, int aCurrIndex)
{
  int i, item_idx, start_idx;
  int no_of_item, no_of_page, curr_page, items_per_page;
  DWORD keyin, line_no;
  BYTE disp_buf[MW_MAX_LINESIZE+1], tmpbuf[MW_MAX_LINESIZE+1];
  BOOLEAN manual_entry;
  int  entry_sel=0;


  // Find Items Per Page
  //CRLEAR DISP
  ClearDispMW();
  line_no = MW_LINE2;
  items_per_page = 0;
  while(line_no < MW_MAX_LINE) {
    items_per_page++;
    line_no += MW_LINE3-MW_LINE2;
  }

  // Find total item and total page
  for (no_of_item = 0; no_of_item <= MAX_MENU_ITEMS; no_of_item++) {
    if (aMenu->psMenuItem[no_of_item].iID == -1)
      break;
  }
  no_of_page = (no_of_item+items_per_page-1)/items_per_page;

  // Draw Frame & Header
  /*GIFLoadMem( win_logo, sizeof(win_logo));
  //GIFSetPos( 0, 25 );
  GIFPlayOn( 0, 0 );
  GIFPlay();
  GIFStop(0);
  GIFUnLoad();*/
  graphicWindow("");
  DispLineMW(aMenu->scHeader, MW_LINE1+((26 - strlen(aMenu->scHeader)) / 2 + 1), MW_REVERSE|MW_SPFONT);
  //DispLineMW("+[", MW_LINE1, MW_LEFT|MW_SPFONT);
  //DispLineMW("]+", MW_LINE1, MW_RIGHT|MW_SPFONT);
  memset(tmpbuf, ' ', sizeof(tmpbuf));
  tmpbuf[MW_MAX_LINESIZE-2] = 0;

  sprintf(disp_buf, " %s ", tmpbuf);
  for (line_no=MW_LINE2; line_no < MW_MAX_LINE; line_no+=(MW_LINE2-MW_LINE1)) {
    DispLineMW(disp_buf, line_no, MW_CENTER|MW_SPFONT);
  }
  memset(tmpbuf, '-', sizeof(tmpbuf));
  tmpbuf[MW_MAX_LINESIZE-2] = 0;
  sprintf(disp_buf, "+%s+", tmpbuf);
  DispLineMW(disp_buf, MW_MAX_LINE, MW_REVERSE|MW_CENTER|MW_SPFONT);

  // Assign current selection
  curr_page = aCurrIndex / items_per_page;
  start_idx = curr_page * items_per_page;
  entry_sel = aCurrIndex;

  manual_entry = FALSE;
  while (1) {
    // Show Menu Item
    item_idx = start_idx;
    for (line_no=MW_LINE2; line_no < MW_MAX_LINE; line_no+=(MW_LINE2-MW_LINE1)) {
      if (aMenu->psMenuItem[item_idx].iID == -1)  break;
      memset(tmpbuf, ' ', sizeof(tmpbuf));
      if (aMenu->psMenuItem[item_idx].pcDesc == NULL)
        memcpy(tmpbuf, aMenu->psMenuItem[item_idx].scDescDat, sizeof(aMenu->psMenuItem[item_idx].scDescDat));
      else
        memcpy(tmpbuf, aMenu->psMenuItem[item_idx].pcDesc, strlen(aMenu->psMenuItem[item_idx].pcDesc));
      tmpbuf[MW_MAX_LINESIZE-2-3] = 0;  // max desc = max size - border - (index + .)
      sprintf(disp_buf, "%02d.%s", aMenu->psMenuItem[item_idx].iID, tmpbuf);
      if (item_idx == aCurrIndex) {
#if(NEW_MIDWARE == TRUE)
        CPutCharMW(MW_LPUSH_CURSOR);
#else
		DispPutCMW(K_PushCursor);
#endif
        os_disp_textc(COLOR_BLACK);
        //os_disp_backc(COLOR_WHITE);
        os_disp_backc(COLOR_YELLOW);
        DispLineMW(disp_buf, line_no+1, MW_REVERSE|MW_SPFONT);
#if(NEW_MIDWARE == TRUE)
        CPutCharMW(MW_LPOP_CURSOR);
#else
		DispPutCMW(K_PopCursor);
#endif
      }
      else {
        DispLineMW(disp_buf, line_no+1, MW_SPFONT);
      }
      item_idx++;
    }
    // Clear the rest line
    memset(disp_buf, ' ', sizeof(disp_buf));
    disp_buf[MW_MAX_LINESIZE-2] = 0;
    for (; line_no < MW_MAX_LINE; line_no+=(MW_LINE2-MW_LINE1)) {
      DispLineMW(disp_buf, line_no+1, MW_SPFONT);
    }

    // Show Trailer line
    if (curr_page == 0) {
      DispLineMW("----", MW_MAX_LINE, MW_REVERSE|MW_SPFONT);
    }
    else {
      DispLineMW("+<<<", MW_MAX_LINE, MW_REVERSE|MW_SPFONT);
    }
#if(NEW_MIDWARE == TRUE)
    CPutCharMW(MW_LPUSH_CURSOR);
#else
	DispPutCMW(K_PushCursor);
#endif
    os_disp_textc(COLOR_WHITE);
    sprintf(disp_buf, "[%02d] %02x/%02x", manual_entry?entry_sel:aMenu->psMenuItem[aCurrIndex].iID, curr_page+1, no_of_page);
    DispLineMW(disp_buf, MW_MAX_LINE+(MW_MAX_LINESIZE-strlen(disp_buf))/2, MW_SPFONT);
#if(NEW_MIDWARE == TRUE)
    CPutCharMW(MW_LPOP_CURSOR);
#else
	DispPutCMW(K_PopCursor);
#endif

    if (curr_page == no_of_page-1) {
      DispLineMW("----", MW_MAX_LINE, MW_REVERSE|MW_RIGHT|MW_SPFONT);
    }
    else {
      DispLineMW(">>>+", MW_MAX_LINE, MW_REVERSE|MW_RIGHT|MW_SPFONT);
    }

    keyin = APM_WaitKey(KBD_TIMEOUT, 0);
    if (keyin == MWKEY_CANCL) {
      return -1;
    }

    // Selected
    if ((keyin == MWKEY_ENTER) || (keyin == MWKEY_SELECT)) {
      break;
    }

    // id entered.
    if ((keyin >= MWKEY_0) && (keyin <= MWKEY_9)) {
      if (manual_entry == FALSE) {
        entry_sel = 0;
        manual_entry = TRUE;
      }
    }
    else
      manual_entry = FALSE;

    switch (keyin) {
      case MWKEY_RIGHT:
      case MWKEY_FUNC1:
        if (curr_page < no_of_page-1) {
          curr_page++;
          start_idx += items_per_page;
          aCurrIndex = start_idx;
          break;
        }
        LongBeep();
        break;
      case MWKEY_LEFT:
      case MWKEY_FUNC2:
        if (curr_page > 0) {
          curr_page--;
          start_idx -= items_per_page;
          aCurrIndex = start_idx;
          break;
        }
        LongBeep();
        break;
      case MWKEY_UP:
      case MWKEY_FUNC3:
        if ((aCurrIndex > 0)) {
          aCurrIndex--;
          if (aCurrIndex < start_idx) {
            curr_page--;
            start_idx -= items_per_page;
          }
          break;
        }
        LongBeep();
        break;
      case MWKEY_DN:
      case MWKEY_FUNC4:
        if ((aCurrIndex < no_of_item-1)) {
          aCurrIndex++;
          if (aCurrIndex >= start_idx+items_per_page) {
            start_idx += items_per_page;
            curr_page++;
          }
          break;
        }
        LongBeep();
        break;
      case MWKEY_0:
      case MWKEY_1:
      case MWKEY_2:
      case MWKEY_3:
      case MWKEY_4:
      case MWKEY_5:
      case MWKEY_6:
      case MWKEY_7:
      case MWKEY_8:
      case MWKEY_9:
        entry_sel *= 10;
        entry_sel += keyin - MWKEY_0;
        entry_sel %= 100;
        for (i = 0; i < no_of_item; i++) {
          if (entry_sel == aMenu->psMenuItem[i].iID) {
            aCurrIndex = i;
            curr_page = (i / items_per_page);
            start_idx = curr_page * items_per_page;
            break;
          }
          if (entry_sel < aMenu->psMenuItem[i].iID)
            break;
        }
        break;
      case MWKEY_CLR:
        aCurrIndex = 0;
        curr_page = 0;
        start_idx = 0;
        LongBeep();
        break;
      default:
        LongBeep();
        break;
    }
    SleepMW();
  }

  return aMenu->psMenuItem[aCurrIndex].iID;
}
void    Automatic(uchar  ibMin, uchar  ibMax)
{
uchar   i;

      enKeyboard = KBD_POSTENTER;

      ShowHi(szAutomatic);
      Clear(); DelayInf();

      for (ibPort=0; ibPort<bPORTS; ibPort++)
      {
        ShowPortDelayLo(ibPort);
        DelayInf(); fKey = 0;
      }

      Clear();
      InitConnectKey();

      ibX = 0;

      for (i=ibMin; i<ibMax; i++)
      {
        if (GetDigitalDevice(i) == 0) continue;

        uchar bRes = 0;

        LoadCurrDigital(i);
        ibPort = diCurr.ibPort;

        if (GetDigitalDevice(i) != 0)
        {
          if (StreamPortCan(GetDigitalPort(i),i) == 0)
          { bRes = 0xEE; break; }
        }

        ShowCanalNumber(i);
        ShowProgress(12,(ulong)100*i/(bCANALS-1)); DelayInf();

        if (LoadConnect(i) == 0) break;
        Clear();

        if (mpboEnblCan[i] == false)
        {
          ShowLo(szBlocked);
          DelayMsg();
        }
        else switch (diCurr.bDevice)
        {
#ifndef SKIP_A
          case 15:
          case 1:  if (AutomaticA() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_B
          case 12: if (AutomaticJ() != 1) bRes = 0xEE; break;

          case 8:
          case 2:  if (AutomaticB() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_C
          case 3:  if (AutomaticC() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_D
          case 4:  if (AutomaticD() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_E
          case 7:
          case 5:  if (AutomaticE() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_F
          case 6:  if (AutomaticF() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_G
          case 9:  if (AutomaticG() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_H
          case 10: if (AutomaticH() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_I
          case 11: if (AutomaticI() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_K
          case 14:
          case 13: if (AutomaticK() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_L
          case 17:
          case 16: if (AutomaticK() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_M
          case 18: if (AutomaticM() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_N
          case 19: if (AutomaticN() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_O
          case 20: if (AutomaticO() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_P
          case 21: if (AutomaticP() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_Q
          case 22: if (AutomaticK() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_R
          case 23: if (AutomaticR() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_S
          case 24: if (AutomaticS() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_T
          case 25: if (AutomaticT() != 1) bRes = 0xEE; break;
#endif

#ifndef SKIP_V
          case 27: if (AutomaticV() != 1) bRes = 0xEE; break;
#endif
        }

        SaveConnect();

        if (bRes == 0xEE)
        {
          ibX++;
          Error(); Beep(); DelayMsg();
        }

        if (fKey == true) bRes = 0xFF;
        fKey = 0;

        if (bRes == 0xFF) break;
      }

      ShowHi(szAutomatic);
      if (ibX != 0) { Clear(); sprintf(szLo+3, "ошибок: %-2u", ibX); LongBeep(); DelayMsg(); }  else OK();

      DelayMsg();
      KeyBreakConnect();

      SaveFactors();
}
Exemple #18
0
void    key_Start(void)
{
    if (enKeyboard == KBD_ENTER)
    {
        enKeyboard = KBD_BEGIN;

        ShowHi(szStart);
        Clear();


        if (boSetTime == false)
        {
            NeedProgram(bSET_CURRTIME);
            return;
        }
        else if (boSetDate == false)
        {
            NeedProgram(bSET_CURRDATE);
            return;
        }
        else if (boSetGroups == false)
        {
            NeedProgram(bSET_GROUPS);
            return;
        }
        else if (boSetPassword == false)
        {
            NeedProgram(bSET_PASSWORD);
            return;
        }

        if (TestTariffs() == 0)
            return;

        if (ValidTimeDateRTC(*GetCurrTimeDate()) == false)
        {
            ShowHi(szAlarm);
            ShowLo(szBadRTC);
            LongBeep();
            DelayMsg();
            return;
        }

        if (TestDigitals() == 0)
            return;

// TODO key_Start

        // рассчитываем массивы индексов тарифов для каждого получаса текущих суток (для мощности и энергии)
        MakeAllCurrTariffs();

        StartFactors();
        StartRealtime();
        StartImpulses();

        // устанавливаем признаки используемых каналов и групп
        MakeUsedNodes();

        StartDefects();

        tiStart = *GetCurrTimeDate();
        SaveCache(&chStart);

        Work();
        OK();

        Beep();

        SetLabelGlobal();
        enGlobal = GLB_WORK;

        AddSysRecord(EVE_START);

//    if (boDTREnable == true) DTROff_All();
    }
    else Beep();
}
void    key_SetParamsDiv(void)
{
static uint iwPrm;

  if (bKey == bKEY_ENTER)
  {
    if (enKeyboard == KBD_ENTER)
    {
      enKeyboard = KBD_INPUT1;
      Param();

      LoadSlide(pszMessages);
    }
    else if (enKeyboard == KBD_INPUT1)
    {
      enKeyboard = KBD_POSTENTER;

      iwPrm = 0;
      Show(iwPrm);
    }
    else if (enKeyboard == KBD_POSTINPUT1)
    {
      if ((iwPrm = GetIntLo(10,12) - 1) < wPARAMS)
      {
        enKeyboard = KBD_POSTENTER;
        Show(iwPrm);
      }
      else Beep();
    }
    else if (enKeyboard == KBD_POSTENTER)
    {
      if (++iwPrm >= wPARAMS) iwPrm = 0;

      Show(iwPrm);
    }
    else if ((enKeyboard == KBD_POSTINPUT2) || (enKeyboard == KBD_POSTINPUT3))
    {
      float fl = (float)GetIntLo(0,7) + (float)GetIntLo(9,11)/1000;
      if (fl >= 0)
      {
        enKeyboard = KBD_POSTENTER;

        mpreParamsDiv[iwPrm] = fl;
        SaveCache(&flParamsDiv);
      }
      else Beep();

      if (enKeyboard == KBD_POSTENTER)
      {
        if (++iwPrm >= wPARAMS) iwPrm = 0;

        Show(iwPrm);
      }
      else
      {
        enKeyboard = KBD_INPUT2;
        LongBeep();

        ShowLo(szMask);
      }
    }
  }


  else if (bKey == bKEY_POINT)
  {
    if (enKeyboard == KBD_POSTENTER)
    {
      if (iwPrm > 0) iwPrm--; else iwPrm = wPARAMS-1;

      Show(iwPrm);
    }
    else if ((enKeyboard == KBD_INPUT2) || (enKeyboard == KBD_POSTINPUT2))
    {
      enKeyboard = KBD_POSTINPUT3;
      szLo[8] = '.';
    }
    else Beep();
  }


  else if (bKey < 10)
  {
    if ((enGlobal != GLB_WORK) && (enKeyboard == KBD_POSTENTER))
    {
      enKeyboard = KBD_INPUT2;
      ShowLo(szMask);
    }

    if ((enKeyboard == KBD_INPUT1) || (enKeyboard == KBD_POSTINPUT1))
    {
      enKeyboard = KBD_POSTINPUT1;
      ShiftLo(10,12);
    }
    else
    if ((enKeyboard == KBD_INPUT2) || (enKeyboard == KBD_POSTINPUT2))
    {
      enKeyboard = KBD_POSTINPUT2;
      ShiftLo(0,7);
    }
    else
    if ((enKeyboard == KBD_INPUT3) || (enKeyboard == KBD_POSTINPUT3))
    {
      enKeyboard = KBD_POSTINPUT3;
      ShiftLo(9,11);
    }
  }
  else Beep();
}
Exemple #20
0
// задание списка изломов
void    key_SetGaps(void)
{
  if (bKey == bKEY_ENTER)
  {
    if (enKeyboard == KBD_ENTER)
    {                                  
      if (boGapsFlag == false)
      { BlockProgram2(wSET_GAPS_FLAG, 1); return; }
      else
      {
        enKeyboard = KBD_POSTINPUT1;    // начинаем просмотр списка изломов
        ShowHi(szGaps);       
      }
    }     
    else if (enKeyboard == KBD_POSTINPUT2)              
    {                                   
      tiT.bDay = GetCharLo(0,1);
      if ((tiT.bDay > 0) && (tiT.bDay <= 31))
      {
        enKeyboard = KBD_INPUT3;
        szLo[2] = '.';
      }
      else Beep();
    }      
    else if (enKeyboard == KBD_POSTINPUT3)              
    {                                  
      tiT.bMonth = GetCharLo(3,4);
      tiT.bYear  = 0;

      if ((tiT.bMonth == 0) || (tiT.bMonth > 12))
        Beep();
      else if (tiT.bDay > GetDaysInMonthM(tiT.bMonth))
      {
        enKeyboard = KBD_INPUT2; 
        LongBeep();

        ShowLo(szMaskGap); 
      }     
      else
      {
        enKeyboard = KBD_INPUT4;
        tiT.bSecond = 0;              // тип излома (режим работы)

        ShowGapName(tiT.bSecond);
        szLo[6] = '.';
      }
    }
    else if (enKeyboard == KBD_INPUT4)              
    {
      enKeyboard = KBD_POSTENTER;       // переходим в режим ввода

      if (AddGap() == 1)                // добавляем новый излома в список
      {                               
        if (++ibX == bGAPS)             // если список заполнен
        {
          ibX = 0;                      // переходим на начало
          enKeyboard = KBD_SHOW;        // переходим в режим просмотра
        }
      }
      else Beep();                      // такой излом есть в списке
    }                                                            
    else if (enKeyboard == KBD_SHOW)    // режим проcмотра
    {                                   
      ibX++;                            // переходим на следующий излом
      if (ibX == GetGapSize())          // дошли до конца списка
      {                                 
        if (GetGapSize() == bGAPS) 
          ibX = 0;                      // если список заполнен - продолжаем просмотр с начала
        else 
          enKeyboard = KBD_POSTENTER;   // если в списке есть свободное место - переходим в режим ввода
      }
    }


    if ((enKeyboard == KBD_POSTINPUT1) || (enKeyboard == KBD_INPUT2))
    {                                   // начинаем или продолжаем просмотр списка изломов
      ibX = 0;                          // переходим на начало
      if (GetGapSize() == 0) 
        enKeyboard = KBD_POSTENTER;     // если список пустой - переходим в режим ввода
      else                  
        enKeyboard = KBD_SHOW;          // если список не пустой - переходим в режим просмотра
    }


    if (enKeyboard == KBD_POSTENTER)    // режим ввода
    {
      enKeyboard = KBD_INPUT2;          // подготовка к вводу излома
      ShowLo(szMaskGap);
    }
    else if (enKeyboard == KBD_SHOW)    // режим просмотра
      ShowGap(ibX);                     // просмотр текущего излома
  }


  else if (bKey < 10)
  {
    if ((enKeyboard == KBD_INPUT2) || (enKeyboard == KBD_POSTINPUT2))
    {
      enKeyboard = KBD_POSTINPUT2;
      ShiftLo(0,1);
    }
    else 
    if ((enKeyboard == KBD_INPUT3) || (enKeyboard == KBD_POSTINPUT3))
    {
      enKeyboard = KBD_POSTINPUT3;
      ShiftLo(3,4);
    }
  }


  else if (bKey == bKEY_MINUS)
  {    
    if (enKeyboard == KBD_SHOW)         // в режиме просмотра
    {
      DelGap();                         // удаляем излом из списка
      LongBeep();

      if (GetGapSize() == 0)
      {
        enKeyboard = KBD_INPUT2; 

        ShowHi(szGaps); 
        ShowLo(szMaskGap);
      }
      else ShowGap(ibX);
    }
    else Beep();
  }


  else if (bKey == bKEY_POINT)
  {    
    if (enKeyboard == KBD_POSTINPUT2)              
    {                                   
      tiT.bDay = GetCharLo(0,1);
      if ((tiT.bDay > 0) && (tiT.bDay <= 31))
      {
        enKeyboard = KBD_INPUT3;
        szLo[2] = '.';
      }       
      else Beep();
    }      
    else if (enKeyboard == KBD_INPUT4)   
    {
      if (++tiT.bSecond >= 12) tiT.bSecond = 0;

      ShowGapName(tiT.bSecond);
      szLo[6] = '.';
    }
    else Beep();
  }
  else Beep();
}
Exemple #21
0
void    key_SetGroups(void)
{
  if (bKey == bKEY_ENTER)
  {    
    if (enKeyboard == KBD_ENTER)        
    {                                   // первое нажатие кнопки '¬вод'
      enKeyboard = KBD_INPUT2;          // подготовка к вводу номера группы
      ShowHi(szGroups); 
      Group();

      boSetGroups = true;
      SaveCache(&chSetGroups);
    }
    else if (enKeyboard == KBD_INPUT2)  // номер группы не введЄн
    {                                   // начинаем с первой группы
      enKeyboard = KBD_POSTINPUT3;      
      ibX = 0;                          // индекс группы
      ShowGroupNumber();  
    }
    else if (enKeyboard == KBD_POSTINPUT2)
    {                                   
      if ((ibX = GetCharLo(10,11)-1) < bGROUPS)
      {                                 // получили индекс группы
        enKeyboard = KBD_POSTINPUT3;
        ShowGroupNumber();
      } 
      else Beep();
    }    
    else if (enKeyboard == KBD_POSTINPUT1)              
    {                                   // запись данных после ввода
      if ((noT.ibCanal = GetCharLo(6,8)-1) < bCANALS)
      {
        enKeyboard = KBD_POSTENTER;     

        if (szLo[4] == '-')
          noT.ibCanal |= 0x80;

        if (AddNode() == 1)             // добавление узла в группу
        {                               // нет такого узла
          if (++ibY == bCANALS)      // если группа заполнена полностью
          {
            enKeyboard = KBD_SHOW;      // переходим в режим просмотра
            ibY = 0;
          }
        }
        else Beep();                    // есть такой узел
      }
      else Beep();
    }                                                                
    else if (enKeyboard == KBD_SHOW)
    {                                   // продолжаем просмотр
      ibY++;                            // переходим на следующий узел
      if (ibY == GetGroupsSize(ibX))    // дошли до последнего узла
      {                                 
        if (GetGroupsSize(ibX) == bCANALS) 
          ibY = 0;                      // если полный список - продолжаем просмотр с начала
        else 
          enKeyboard = KBD_POSTENTER;   // иначе ввод нового узла
      }
    }


    if (enKeyboard == KBD_POSTINPUT3)
    {
      // при перепрограммировании разрешаетс¤ редактировать незаданные группы
      if ((enGlobal == GLB_REPROGRAM) && (mpfUsedGroups[ibX] == true))
      {
        Error();
        LongBeep();
        return;
      }
    }


    if ((enKeyboard == KBD_POSTINPUT3) || (enKeyboard == KBD_INPUT1))
    {                                   // начинаем просмотр группы с начала
      ibY = 0;                          // переход на первый узел
      if (GetGroupsSize(ibX) == 0) 
        enKeyboard = KBD_POSTENTER;     // если группа пуста¤ - режим ввода
      else                  
        enKeyboard = KBD_SHOW;          // есть группа не пуста¤ - режим просмотра
    }


    if (enKeyboard == KBD_POSTENTER)    // неповредственно подготовка ввода
    {
      enKeyboard = KBD_INPUT1; 
      ShowLo(szMaskGroups);
    }
    else if (enKeyboard == KBD_SHOW)    // непосредственно просмотр
      ShowGroup();     
  }


  else if (bKey < 10)
  {
    if ((enKeyboard == KBD_INPUT2) || (enKeyboard == KBD_POSTINPUT2))
    {
      enKeyboard = KBD_POSTINPUT2;
      ShiftLo(10,11);
    }
    else 
    if ((enKeyboard == KBD_INPUT1) || (enKeyboard == KBD_POSTINPUT1))
    {
      enKeyboard = KBD_POSTINPUT1;
      ShiftLo(6,8);
    }
  }


  else if (bKey == bKEY_MINUS)
  {    
    if (enKeyboard == KBD_SHOW)         
    {                                   // в режиме просмотра
      DelNode();                        // удалить узел из группы
      LongBeep();

      if (GetGroupsSize(ibX) == 0)
      {
        enKeyboard = KBD_INPUT1; 
        ShowLo(szMaskGroups);
      }
      else ShowGroup();
    }
 

    else if ((enKeyboard == KBD_INPUT1) || (enKeyboard == KBD_POSTINPUT1)) 
    {                                   // в режиме ввода
      if (szLo[4] == '-')               // изменить знак узла на противоположный
        szLo[4] = '+';
      else
        szLo[4] = '-';
    } 
    else Beep();
  }


  else if (bKey == bKEY_POINT)
  {
    if ((enKeyboard == KBD_POSTENTER) || 
        (enKeyboard == KBD_INPUT1)    || (enKeyboard == KBD_SHOW))
    {
      if (++ibX >= bGROUPS)
        ibX = 0;

      ShowGroupNumber();
      ibY = 0;                

      if (GetGroupsSize(ibX) == 0) 
      {
        enKeyboard = KBD_INPUT1;        // если группа пуста¤ - режим ввода
        ShowLo(szMaskGroups);
      }
      else                  
      {
        enKeyboard = KBD_SHOW;          // есть группа не пуста¤ - режим просмотра
        ShowGroup();
      }
    }
    else Beep();
  }
}