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 NewLimits(void) { LoadCurrDigital(ibDig); uchar c; for (c=0; c<bCANALS; c++) { LoadPrevDigital(c); if (CompareCurrPrevLines(ibDig, c) == true) { mpcwStartRelCan[c] = 0; mpcwStartAbs16Can[c] = 0; mpcdwStartAbs32Can[c] = 0; mpboStartCan[c] = false; if (UseBounds() && IsLimitsAux(GetDigitalDevice(c))) { mpcwStopCan[c] = 4 + mpcwStopAuxCan[c]; if (mpcwStopCan[c] > wHOURS-1) mpcwStopCan[c] = wHOURS-1; } else { mpcwStopCan[c] = 4; } } } SaveCache(&chStartRelCan); SaveCache(&chStartAbs16Can); SaveCache(&chStartAbs32Can); SaveCache(&chStartCan); SaveCache(&chStopCan); }
static void ShowModemReadTimeCan(bool fShowTimeDate) { ShowHi(szTimeDate); if (GetDigitalDevice(ibCan) == 0) ShowLo(szNone); else { LoadCurrDigital(ibCan); ibPort = diCurr.ibPort; if (LoadConnect(ibCan) == 0) return; Clear(); if (mpboEnblCan[ibCan] == false) { sprintf(szHi+14,"%2u",ibCan+1); ShowLo(szBlocked); } else { time2 ti2 = ReadTimeCan(ibCan); if (ti2.fValid) { sprintf(szHi+14,"%2u",ibCan+1); Clear(); (fShowTimeDate) ? ShowTimeDate(ti2.tiValue) : ShowDeltaTime(ti2.tiValue); } else Error(); } SaveConnect(); } }
ulong2 ReadSerialCan(uchar ibCan) { LoadCurrDigital(ibCan); ibPort = diCurr.ibPort; switch (diCurr.bDevice) { #ifndef SKIP_B case 8: case 2: case 12: return ReadSerialCanB(ibCan); #endif #ifndef SKIP_C case 3: return ReadSerialCanC(ibCan); #endif #ifndef SKIP_P case 21: return ReadSerialCanP(ibCan); #endif default: return GetLong2Error(); } }
void NewBoundsRel(uint wRel) { LoadCurrDigital(ibDig); uchar c; for (c=0; c<bCANALS; c++) { LoadPrevDigital(c); if (CompareCurrPrevLines(ibDig, c) == true) { mpcwStartRelCan[c] = wRel; } } SaveCache(&chStartRelCan); }
void ResetLimitsAux(uchar ibDig) { LoadCurrDigital(ibDig); uchar c; for (c=0; c<bCANALS; c++) { LoadPrevDigital(c); if (CompareCurrPrevLines(ibDig, c) == true) { mpcwStopAuxCan[c] = 0; } } SaveCache(&chStopAuxCan); }
bool SupportedExtended4T(uchar ibCan) { LoadCurrDigital(ibCan); switch (diCurr.bDevice) { case 2: return true; case 3: return true; // case 13: return true; case 21: return true; default: return false; } }
void NewBoundsAbs32(ulong dwAbs) { LoadCurrDigital(ibDig); uchar c; for (c=0; c<bCANALS; c++) { LoadPrevDigital(c); if (CompareCurrPrevLines(ibDig, c) == true) { mpboStartCan[c] = true; mpcdwStartAbs32Can[c] = dwAbs; } } SaveCache(&chStartCan); SaveCache(&chStartAbs32Can); }
bool ReadCntMonCanF_Buff(uchar ibMon, uchar ibCan) { Clear(); LoadCurrDigital(ibCan); ibPort = diCurr.ibPort; uchar i; for (i=0; i<bMINORREPEATS; i++) { QueryBreakF(); InitPushPck(); PushChar(diCurr.bAddress); PushChar(0); PushChar((5+10+2) % 0x100); PushChar((5+10+2) / 0x100); PushChar(0xFD); PushChar(bEXT_GETEXTENDED40); PushChar(ibMon); PushChar(0xFF); PushChar(0xFF); PushChar(0xFF); PushChar(0xFF); PushChar(0xFF); PushChar(0xFF); PushChar(0xFF); PushChar(0xFF); PckQueryIO(bHEADER+(1+2+2+8+6)*bCANALS+2, 5+10+2); if (Input() == SER_GOODCHECK) break; if (fKey == true) return false; } if (i == bMINORREPEATS) return false; ShowPercent(100); return true; }
bool ReadCntMonCanF_Curr(uchar ibMon, uchar ibCan) { Clear(); LoadCurrDigital(ibCan); ibPort = diCurr.ibPort; uchar i; for (i=0; i<bMINORREPEATS; i++) { QueryBreakF(); InitPushPck(); PushChar(diCurr.bAddress); PushChar(0); PushChar((5+3+2) % 0x100); PushChar((5+3+2) / 0x100); PushChar(0xFD); PushChar(bEXT_GETEXTENDED42); PushChar(ibMon); PushChar(ibCan); PckQueryIO(bHEADER+(1+2+2+8+6)+2, 5+3+2); if (Input() == SER_GOODCHECK) break; if (fKey == true) return false; } if (i == bMINORREPEATS) return false; ShowPercent(100); InitPop(bHEADER); bStatus4 = PopChar(); PopChar(); PopChar(); PopChar(); PopChar(); dbValue4 = PopDouble(); Pop(&tiUpdate4, sizeof(time)); return true; }
status ReadCntMonCanTariff(uchar ibMon, uchar ibCan, uchar ibTrf) { Clear(); LoadCurrDigital(ibCan); ibPort = diCurr.ibPort; switch (diCurr.bDevice) { case 2: return ReadCntMonCanTariffB(ibMon, ibTrf); case 3: return ReadCntMonCanTariffC(ibMon, ibTrf); // case 13: return ReadCntMonCanTariffK(ibMon, ibTrf); case 21: return ReadCntMonCanTariffP(ibMon, ibTrf); default: return ST4_NOTSUPPORTED; } }
static void ShowModemReadCntCurrCan(void) { if (GetDigitalDevice(ibCan) == 0) ShowFloat(GetCntCurrImp(ibCan)); else { LoadCurrDigital(ibCan); ibPort = diCurr.ibPort; if (LoadConnect(ibCan) == 0) return; Clear(); if (mpboEnblCan[ibCan] == false) ShowLo(szBlocked); else { double2 db2 = ReadCntCurrCan(ibCan); (db2.fValid) ? ShowDouble(db2.dbValue) : Error(); } SaveConnect(); } }
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(); }
time2 ReadTimeDate_Short(uchar ibCan) { LoadCurrDigital(ibCan); ibPort = diCurr.ibPort; switch (diCurr.bDevice) { #ifndef SKIP_A case 15: case 1: return ReadTimeDateA_Short(); #endif #ifndef SKIP_B case 8: case 2: return ReadTimeDateB_Short(); case 12: return GetTime2(tiCurr, true); #endif #ifndef SKIP_C case 3: return ReadTimeDateC_Short(); #endif #ifndef SKIP_D case 4: return( ReadTimeDateD_Short() ); break; #endif #ifndef SKIP_E case 7: case 5: return( ReadTimeDateE_Short() ); break; #endif #ifndef SKIP_F case 6: return( ReadTimeDateF_Short() ); break; #endif #ifndef SKIP_G case 9: return( ReadTimeDateG_Short() ); break; #endif #ifndef SKIP_H case 10: return( ReadTimeDateH_Short() ); break; #endif #ifndef SKIP_I case 11: return( ReadTimeDateI_Short() ); break; #endif #ifndef SKIP_K case 14: case 13: return( ReadTimeDateK_Short() ); break; #endif #ifndef SKIP_L case 17: case 16: tiAlt = tiCurr; return(1); break; #endif #ifndef SKIP_M case 18: tiAlt = tiCurr; return(1); break; #endif #ifndef SKIP_N case 19: tiAlt = tiCurr; return(1); break; #endif #ifndef SKIP_O case 20: return( ReadTimeDateO_Short() ); break; #endif #ifndef SKIP_P case 21: return ReadTimeDateP_Short(); #endif #ifndef SKIP_Q case 22: return( ReadTimeDateQ_Short() ); break; #endif #ifndef SKIP_R case 23: tiAlt = tiCurr; return(1); break; #endif #ifndef SKIP_S case 24: return ReadTimeDateS_Short(); #endif #ifndef SKIP_T case 25: return( ReadTimeDateT_Short() ); break; #endif #ifndef SKIP_U case 26: return ReadTimeDateU_Short(); #endif default: return GetTime2Error(); } }