bool ShowModemConnect(void) { bool fAlt = 0; switch ( GetModemAnswer() ) { case 2: ShowLo(szRing); break; case 3: ShowLo(szNoCarrier); break; case 4: ShowLo(szModemError); break; case 6: ShowLo(szNoDialtone); break; case 7: ShowLo(szBusy); break; case 8: ShowLo(szNoAnswer); break; case 0xFF: case 0xFE: case 0xFD: Clear(); sprintf(szLo+3,"ошибка: %u", GetModemAnswer()); break; default: Clear(); sprintf(szLo+1,"соединение: %u", GetModemAnswer()); fAlt = 1; break; } DelayInf(); return(fAlt); }
static void Show(uchar ibVal) { switch (ibVal) { case 0: ShowHi(szTimeGps); break; case 1: ShowHi(szDeltaTimeGps); break; case 2: ShowHi(szTimeDateGps); break; case 3: ShowHi(szVersionGps); break; } time2 tm2 = ReadTimeDateGps(); if (tm2.fValid == false) { Error(); DelayInf(); Clear(); } else { if (ShowStatusGps() == 1) { switch (ibVal) { case 0: ShowTime(tm2.tiValue); break; case 1: ShowDeltaTime(tm2.tiValue); break; case 2: ShowTimeDate(tm2.tiValue); break; case 3: sprintf(szLo+7,"%u.%u",bVersionMaxGps,bVersionMinGps); break; } } } }
bool AutomaticN(void) { uchar i; for (i=0; i<bMINORREPEATS; i++) { InitPush(0); PushChar(0); PushChar(diCurr.bAddress); PushChar(8); PushChar(0); PushChar(0); PushChar(0); PushChar(0); PushChar(0); PushChar(0); PushChar(0); PushChar(0); QueryIO(5+8, 5+8); if (Input() == SER_GOODCHECK) break; if (fKey == true) return(0); } if (i == bMINORREPEATS) return(0); sprintf(szLo+1,"версия:"); szLo[ 9] = InBuff(3); szLo[10] = InBuff(4); szLo[11] = InBuff(5); szLo[12] = InBuff(6); szLo[13] = InBuff(7); DelayInf(); Clear(); for (i=0; i<bMINORREPEATS; i++) { QueryEnergyAbsN(); if (Input() == SER_GOODCHECK) break; if (fKey == true) return(0); } if (i == bMINORREPEATS) return(0); ShowPercent(50); ReadEnergyN(); mpdwBase[ibDig] = mpdwChannelsA[0]; return(1); }
void key_Automatic2(void) { if (bKey == bKEY_ENTER) { if (enKeyboard == KBD_ENTER) { enKeyboard = KBD_INPUT1; ShowHi(szAutomatic); Clear(); DelayInf(); ShowHi(szCana1s); strcpy(szLo+0,szCana1FromMask); } else if (enKeyboard == KBD_POSTINPUT1) { ibXmin = GetCharLo(5,6) - 1; if (ibXmin < bCANALS) { enKeyboard = KBD_INPUT2; strcpy(szLo+8,szCana1ToMask); } else Beep(); } else if (enKeyboard == KBD_POSTINPUT2) { ibXmax = GetCharLo(13,14) - 1; if ((ibXmax < bCANALS) && (ibXmax >= ibXmin)) { Automatic(ibXmin,ibXmax+1); } else Beep(); } else Beep(); } else if (bKey < 10) { if ((enKeyboard == KBD_INPUT1) || (enKeyboard == KBD_POSTINPUT1)) { enKeyboard = KBD_POSTINPUT1; ShiftLo(5,6); } else if ((enKeyboard == KBD_INPUT2) || (enKeyboard == KBD_POSTINPUT2)) { enKeyboard = KBD_POSTINPUT2; ShiftLo(13,14); } else Beep(); } else Beep(); }
static bool MakeDevices(uchar ibMon, uchar ibTrf) { memset(&mpboChannelsA, 0, sizeof(mpboChannelsA)); status bStatus = ReadCntMonCanTariff(ibDig, ibMon, ibTrf); if ((bStatus == ST_BADDIGITAL) || (bStatus == ST_NOTSUPPORTED) || (bStatus == ST_NOTPRESENTED)) { LoadCurrDigital(ibDig); uchar c; for (c=0; c<bCANALS; c++) { LoadPrevDigital(c); if (CompareCurrPrevLines(ibDig, c) == true) { value4t vl = mpCntMonCan4T[c]; vl.bStatus = bStatus; vl.mpdbValuesT[ibTrf] = 0; vl.tiUpdate = *GetCurrTimeDate(); mpCntMonCan4T[c] = vl; } } if (bStatus == ST_BADDIGITAL) { ShowLo(szNoLink); DelayInf(); } return false; } else { LoadCurrDigital(ibDig); uchar c; for (c=0; c<bCANALS; c++) { LoadPrevDigital(c); if (CompareCurrPrevLines(ibDig, c) == true) { if (mpboChannelsA[diPrev.ibLine] == true) { value4t vl = mpCntMonCan4T[c]; vl.bStatus = ST_OK; vl.mpdbValuesT[ibTrf] = mpdbChannelsC[diPrev.ibLine]; vl.tiUpdate = *GetCurrTimeDate(); mpCntMonCan4T[c] = vl; } } } return true; } }
void MakeExtended4T(void) { if ((fExt4TFlag == true) && (mpfExt4EnblCan[ibDig] == true)) { ShowHi(szExtended4T); Clear(); sprintf(szLo+3,"глубина: %u", bExt4TMonths); DelayInf(); ibMonthP = 0xFF; uchar m; for (m=0; m<bExt4TMonths; m++) { if (fKey == true) break; uchar ibMon = (bMONTHS + ibHardMon - m) % bMONTHS; LoadExt4TValues(ibMon); status bStatus = mpCntMonCan4T[ibDig].bStatus; if ((bStatus == ST_OK) || (bStatus == ST_NOTPRESENTED)) continue; uchar t; for (t=0; t<bTARIFFS; t++) { Clear(); sprintf(szLo+3,"мес¤ц: %-2u",ibMon+1); sprintf(szLo+14,"T%u",t+1); DelayInf(); if (MakeDevices(ibMon, t) == 0) break; ibMonthP = ibMon; } SaveExt4TValues(ibMon); } ShowCanalNumber(ibDig); Clear(); } }
void MakeExtended3(void) { if (fExt3Flag == true) { ShowHi(szExtended3); Clear(); sprintf(szLo+14,"%2u",ibDig+1); DelayInf(); switch (diCurr.bDevice) { case 1: ReadEventsAllA(); break; case 2: ReadEventsAllB(); break; } mpfEventStart[ibDig] = false; SaveCache(&chEventStart); } }
// требует установки diCurr bool BreakConnect(void) { bool fAlt = ((diLast.ibPort != diCurr.ibPort) || (diLast.ibPhone != diCurr.ibPhone)); if (fAlt == 1) { SaveDisplay(); ShowPort(diCurr.ibPort); ShowLo(szBreakConnect); DelayInf(); LoadDisplay(); } // QueResult(bRES_BREAKCONNECT, (uchar)fAlt); return(fAlt); }
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(); }
// разъединение с каналом (требует установки 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); }
// соединение с каналом (требует установки 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); }