void checkMode(int *menu){
    if(*menu == MANUAL) 
                {   
                    *menu = FACTORY;
                    GLOBAL_MODE = FACTORY;
                    sendMode();
                }
                else if(*menu == FACTORY) 
                {
                    *menu = ASSIST;
                    GLOBAL_MODE = ASSIST;
                    sendMode();
                }
                else if(*menu == ASSIST) 
                {
                    *menu = AUTO;
                    GLOBAL_MODE = AUTO;
                    sendMode();
                }
                else if(*menu == AUTO) {
                    *menu = MANUAL;
                    GLOBAL_MODE = MANUAL;
                    sendMode();

                }
}
/**
 * Отправка команды FTP-серверу.
 * 
 * @param command FTP-команда.
 * 
 * @return Флаг успешности выполнения (0 - не успешно, другое - успешно).
 */
int ProtocolInterpreter::sendCommand(string command) {
    int success;
    
    if (command == "USER") {
        success = sendUser();
    } else if (command == "PASS") {
        success = sendPass();
    } else if (command == "TYPE") {
        success = sendType();
    } else if (command == "MODE") {
        success = sendMode();
    } else if (command == "STRU") {
        success = sendStru();
    } else if (command == "PORT") {
        success = sendPort();
    } else if (command == "PASV") {
        success = sendPasv();
    } else if (command == "NLST") {
        success = sendNlst();
    } else if (command == "LIST") {
        success = sendList();
    } else if (command == "RETR") {
        success = sendRetr();
    } else if (command == "STOR") {
        success = sendStor();
    } else if (command == "RNTO") {
        success = sendRnto();
    } else if (command == "RNFR") {
        success = sendRnfr();
    } else if (command == "DELE") {
        success = sendDele();
    } else if (command == "MKD") {
        success = sendMkd();
    } else if (command == "RMD") {
        success = sendRmd();
    } else if (command == "CWD") {
        success = sendCwd();
    } else if (command == "CDUP") {
        success = sendCdup();
    } else if (command == "PWD") {
        success = sendPwd();
    } else if (command == "ABOR") {
        success = sendAbor();
    } else if (command == "REIN") {
        success = sendRein();
    } else if (command == "QUIT") {
        success = sendQuit();
    } else if (command == "SYST") {
        success = sendSyst();
    } else if (command == "STAT") {
        success = sendStat();
    } else if (command == "NOOP") {
        success = sendNoop();
    } else {
        service->printMessage(1, "Unknown command!");
    }
    
    return success;
}
Пример #3
0
DpmsInterface::DpmsInterface(OutputInterface *output, wl_resource *parentResource, DpmsManagerInterface *manager)
    : Resource(new Private(this, manager, parentResource, output))
{
    connect(output, &OutputInterface::dpmsSupportedChanged, this,
        [this] {
            sendSupported();
            sendDone();
        }
    );
    connect(output, &OutputInterface::dpmsModeChanged, this,
        [this] {
            sendMode();
            sendDone();
        }
    );
}