Example #1
0
bool    ReadModemQuality(void)
{
  uchar i;
  for (i=0; i<bMINORREPEATS; i++)
  {
    DelayOff();
    QueryModemBaud(0);

    if (ModInputOK(1) == 1) break;
    if (fKey == true) return(0);
  }

  if (i == bMINORREPEATS) ;

  for (i=0; i<bMINORREPEATS; i++)
  {
    DelayOff();
    QueryModemCommon(0);

    if (ModInputOK(1) == 1) break;
    if (fKey == true) return(0);
    sprintf(szLo+15, "%1u", i+1);
  }

  if (i == bMINORREPEATS) return(0);

  for (i=0; i<bMINORREPEATS; i++)
  {
    DelayOff();
    QueryModemQuality();

    if (ModQualityOK(1) == 1) break;
    if (fKey == true) return(0);
    sprintf(szLo+15, "%1u", i+1);
  }

  return(1);
}
Example #2
0
// разъединение с каналом (требует установки diCurr)
bool    Disconnect(void)
{
uchar   i;
bool    fResult;

  fResult = 0;

  ibPort = diCurr.ibPort;

  ShowPort(diCurr.ibPort);
  ShowLo(szDisconnect); DelayInf();

  for (i=0; i<MaxRepeatsFixed(); i++)
  {
    // переход из состояния hook on
//    QueResult(bRES_MODEMESCAPE, i);

    DelayOff();
    QueryModemEscape();

    if (ModInputOK(3) == 1) break;
    if (fKey == true) return(0);

    // переход из состояния hook off
//    QueResult(bRES_MODEMHOOKOFF, i);

    DelayOff();
    QueryModemHookOff();

    if (ModInputOK(1) == 1) break;
    if (fKey == true) return(0);
  }

  if (i == MaxRepeatsFixed()) ;
  else
    { ShowLo(szEscapeOK); DelayInf(); mpcwEscape[diCurr.ibPort]++; }


  for (i=0; i<MaxRepeatsFixed(); i++)
  {
//    QueResult(bRES_MODEMHOOKOFF, i);

    DelayOff();
    QueryModemHookOff();

    if (ModInputOK(1) == 1) break;
    if (fKey == true) return(0);
  }

  if (i == MaxRepeatsFixed()) ;
  else
  {
    fResult = 1;
    ShowLo(szHookOffOK); DelayInf(); mpcwHookOff[diCurr.ibPort]++;
  }


  ModemDTROff();
  mpcwDTROff[diCurr.ibPort]++;

  fConnect = 0;

  return(fResult);
}
Example #3
0
// соединение с каналом (требует установки diCurr)
bool    Connect(void)
{
uchar   i;

  fConnect = 0;

  ibPort = diCurr.ibPort;

  if (StreamPort(diCurr.ibPort) == 0) return(0);
  if (diCurr.ibPhone == 0) return(1);

  if (mpboEnblCan[ibDig] == false) { ShowLo(szBlockingAll); DelayInf(); return(1); }

  ShowPort(diCurr.ibPort);
  ShowLo(szConnect); DelayInf();

  for (i=0; i<MaxRepeatsFixed(); i++)
  {
//    QueResult(bRES_MODEMBAUD, i);

    DelayOff();
    QueryModemBaud(1);

    if (ModInputOK(1) == 1) break;
    if (fKey == true) return(0);
  }

  if (i == MaxRepeatsFixed()) ;
  else
    { ShowLo(szBaudOK); DelayInf(); mpcwBaud[diCurr.ibPort]++; }


  for (i=0; i<MaxRepeatsFixed(); i++)
  {
//    QueResult(bRES_MODEMCOMMON, i);

    DelayOff();
    QueryModemCommon(1);

    if (ModInputOK(1) == 1) break;
    if (fKey == true) return(0);

    if (i > 0)                          // переход из состояния hook on
    {
      DelayOff();
      QueryModemEscape();

      if (ModInputOK(3) == 1) ;
      if (fKey == true) return(0);

      DelayOff();
      QueryModemHookOff();

      if (ModInputOK(1) == 1) ;
      if (fKey == true) return(0);
    }
  }

  if (i == MaxRepeatsFixed()) return(0);
  ShowLo(szCommonOK); DelayInf(); mpcwCommon[diCurr.ibPort]++;


  if (boCustomModem == true)
  {
    for (i=0; i<MaxRepeatsFixed(); i++)
    {
//      QueResult(bRES_MODEMCUSTOM, i);

      DelayOff();
      QueryModemCustom();

      if (ModInputOK(1) == 1) break;
      if (fKey == true) return(0);
    }

    if (i == MaxRepeatsFixed()) return(0);
    ShowLo(szCustomOK); DelayInf(); mpcwCustom[diCurr.ibPort]++;
  }


  for (i=0; i<MaxRepeatsFixed(); i++)
  {
//    QueResult(bRES_MODEMCONNECT, i);

    DelayOff();

    fConnect = 1;
    QueryModemConnect();

    if ((ModInput(bMaxConnect,1) == SER_POSTANSWER_MODEM) && (ShowModemConnect() == 1)) break;
    if (fKey == true) return(0);
  }

  if (i == MaxRepeatsFixed()) return(0);


  cbWaitOnline = 0;

  mpcwConnect[diCurr.ibPort]++;
  return(1);
}