Do() public method

public Do ( int currentCp, Chronopic, &myCp, SerialPort &mySp, Chronopic, myPS, string myPort, string &returnString, bool &success ) : bool
currentCp int
myCp Chronopic,
mySp SerialPort
myPS Chronopic,
myPort string
returnString string
success bool
return bool
示例#1
0
    private void connectContactsRealDo()
    {
        ChronopicRegisterPort crp = crpConnectContactsRealThread;

        string message   = "";
        bool   success   = false;
        bool   connected = false;

        if (cpDoing == 1)
        {
            LogB.Information("connectContactsRealDo() 1");
            sp            = new SerialPort(crp.Port);
            chronopicInit = new ChronopicInit();
            connected     = chronopicInit.Do(1, out cp, out sp,
                                             platformState, crp.Port, out message, out success);
        }
        else           //(cpDoing == 2)
        {
            LogB.Information("connectContactsRealDo() 2");
            sp2           = new SerialPort(crp.Port);
            chronopicInit = new ChronopicInit();
            connected     = chronopicInit.Do(2, out cp2, out sp2,
                                             platformState, crp.Port, out message, out success);
        }

        LogB.Information("Ended chronopicInit.Do()");

        if (connected)
        {
            assignLastConnectedVariables(crp);
        }

        SuccededConnectContactsRealThread = connected;
    }
示例#2
0
    private static Chronopic.Plataforma platformState;          //on (in platform), off (jumping), or unknow

    private void connectNormal(string myPort)
    {
        LogB.Debug("connectNormal start");

        chronopicInit = new ChronopicInit();

        string message = "";
        bool   success = false;

        connectedNormalChronopic = chronopicInit.Do(1, out cpDoing, out sp, platformState, myPort, out message, out success);
        LogB.Information(message);
        LogB.Debug("connectNormal end");
    }
示例#3
0
    private void connectContactsRealDo()
    {
        ChronopicRegisterPort crp = crpConnectContactsRealThread;

        string message = "";
        bool success = false;
        bool connected = false;

        if(cpDoing == 1)
        {
            sp = new SerialPort(crp.Port);
            chronopicInit = new ChronopicInit();
            connected = chronopicInit.Do(1, out cp, out sp,
                    platformState, crp.Port, out message, out success);
        } else //(cpDoing == 2)
        {
            sp2 = new SerialPort(crp.Port);
            chronopicInit = new ChronopicInit();
            connected = chronopicInit.Do(2, out cp2, out sp2,
                    platformState, crp.Port, out message, out success);
        }

        LogB.Information("Ended chronopicInit.Do()");

        if(connected) {
            lastConnectedRealPort = crp.Port;
            lastConnectedRealSerialNumber = crp.SerialNumber;
            lastConnectedRealType = ChronopicRegisterPort.Types.CONTACTS;
        }

        SuccededConnectContactsRealThread = connected;
    }
示例#4
0
    protected void waitChronopicStart()
    {
        if (currentCp == 1)
        {
            //	simulated = false;
            //	SqlitePreferences.Update("simulated", simulated.ToString(), false);
            if (connected)
            {
                return;
            }
        }

        SerialPort sp2;
        SerialPort sp3;
        SerialPort sp4;

        string message = "";
        string myPort  = "";
        bool   success = false;

        if (currentCp == 1)
        {
            myPort    = ((ChronopicPortData)cpd[0]).Port;
            cpDoing   = cp;
            connected = chronopicInit.Do(currentCp, out cpDoing, out sp, platformState, myPort, out message, out success);
            cp        = cpDoing;
            if (success)
            {
                connectionSucceded(1, true);
            }
        }
        else if (currentCp == 2)
        {
            myPort    = ((ChronopicPortData)cpd[1]).Port;
            cpDoing   = cp2;
            connected = chronopicInit.Do(currentCp, out cpDoing, out sp2, platformState2, myPort, out message, out success);
            cp2       = cpDoing;
            if (success)
            {
                connectionSucceded(2, true);
            }
        }
        else if (currentCp == 3)
        {
            myPort    = ((ChronopicPortData)cpd[2]).Port;
            cpDoing   = cp3;
            connected = chronopicInit.Do(currentCp, out cpDoing, out sp3, platformState3, myPort, out message, out success);
            cp3       = cpDoing;
            if (success)
            {
                connectionSucceded(3, true);
            }
        }
        else if (currentCp == 4)
        {
            myPort    = ((ChronopicPortData)cpd[3]).Port;
            cpDoing   = cp4;
            connected = chronopicInit.Do(currentCp, out cpDoing, out sp4, platformState4, myPort, out message, out success);
            cp4       = cpDoing;
            if (success)
            {
                connectionSucceded(4, true);
            }
        }


        LogB.Information(string.Format("wait_chronopic_start {0}", message));

        if (success)
        {
            Util.PlaySound(Constants.SoundTypes.GOOD, volumeOn);
            updateChronopicWinValuesState   = true;          //connected
            updateChronopicWinValuesMessage = message;
        }
        else
        {
            Util.PlaySound(Constants.SoundTypes.BAD, volumeOn);
            updateChronopicWinValuesState   = false;          //disconnected
            updateChronopicWinValuesMessage = message;
        }

        foreach (ChronopicPortData a in cpd)
        {
            LogB.Information(a.Num + ", " + a.Port + ", " + a.Connected);
        }

        needUpdateChronopicWin = true;
    }