コード例 #1
0
ファイル: modems2.c プロジェクト: feilongfl/tm4c1294ncpdt
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);
}
コード例 #2
0
ファイル: modems.c プロジェクト: ti-cortex-m4/tm4c1294ncpdt
// соединение с каналом (требует установки 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);
}