Esempio n. 1
0
void MainWindow::updateSerialPort()
{
    //Close the current serial port
    _serial_port->close();

    //Open new port for reading and writing
    QSerialPortInfo port_info(ui->availableSerialPortsComboBox->currentText());
    _serial_port->setPort(port_info);
    _serial_port->open(QIODevice::ReadWrite);
    if(_serial_port->isOpen())
    {
        //Set serial port options
        _serial_port->setBaudRate(ui->baudRateComboBox->currentText().toInt());
        _serial_port->setParity(QSerialPort::NoParity);
        _serial_port->setDataBits(QSerialPort::Data8);
        _serial_port->setStopBits(QSerialPort::OneStop);
        //Notify console
        QTextStream(stdout) << "Connected to serial port " << _serial_port->portName()
                            << " at baud rate " << QString::number(_serial_port->baudRate()) << endl;
    }
    else
    {
        QTextStream(stdout) << "Failed to connect" << endl;
    }
}
Esempio n. 2
0
File: break.c Progetto: DeadZen/otp
void
process_info(int to, void *to_arg)
{
    int i;
    for (i = 0; i < erts_max_processes; i++) {
	Process *p = erts_pix2proc(i);
	if (p && p->i != ENULL) {
	    if (!ERTS_PROC_IS_EXITING(p))
		print_process_info(to, to_arg, p);
	}
    }

    port_info(to, to_arg);
}
Esempio n. 3
0
File: break.c Progetto: easemob/otp
void
process_info(int to, void *to_arg)
{
    int i, max = erts_ptab_max(&erts_proc);
    for (i = 0; i < max; i++) {
	Process *p = erts_pix2proc(i);
	if (p && p->i != ENULL) {
	    /* Do not include processes with no heap,
	     * they are most likely just created and has invalid data
	     */
	    if (!ERTS_PROC_IS_EXITING(p) && p->heap != NULL)
		print_process_info(to, to_arg, p);
	}
    }

    port_info(to, to_arg);
}
Esempio n. 4
0
File: break.c Progetto: easemob/otp
void
do_break(void)
{
    int i;
#ifdef __WIN32__
    char *mode; /* enough for storing "window" */

    /* check if we're in console mode and, if so,
       halt immediately if break is called */
    mode = erts_read_env("ERL_CONSOLE_MODE");
    if (mode && strcmp(mode, "window") != 0)
	erl_exit(0, "");
    erts_free_read_env(mode);
#endif /* __WIN32__ */

    erts_printf("\n"
		"BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded\n"
		"       (v)ersion (k)ill (D)b-tables (d)istribution\n");

    while (1) {
	if ((i = sys_get_key(0)) <= 0)
	    erl_exit(0, "");
	switch (i) {
	case 'q':
	case 'a': 
	case '*': /* 
		   * The asterisk is an read error on windows, 
		   * where sys_get_key isn't that great in console mode.
		   * The usual reason for a read error is Ctrl-C. Treat this as
		   * 'a' to avoid infinite loop.
		   */
	    erl_exit(0, "");
	case 'A':		/* Halt generating crash dump */
	    erl_exit(1, "Crash dump requested by user");
	case 'c':
	    return;
	case 'p':
	    process_info(ERTS_PRINT_STDOUT, NULL);
	    return;
	case 'm':
	    return;
	case 'o':
	    port_info(ERTS_PRINT_STDOUT, NULL);
	    return;
	case 'i':
	    info(ERTS_PRINT_STDOUT, NULL);
	    return;
	case 'l':
	    loaded(ERTS_PRINT_STDOUT, NULL);
	    return;
	case 'v':
	    erts_printf("Erlang (%s) emulator version "
		       ERLANG_VERSION "\n",
		       EMULATOR);
	    erts_printf("Compiled on " ERLANG_COMPILE_DATE "\n");
	    return;
	case 'd':
	    distribution_info(ERTS_PRINT_STDOUT, NULL);
	    return;
	case 'D':
	    db_info(ERTS_PRINT_STDOUT, NULL, 1);
	    return; 
	case 'k':
	    process_killer();
	    return;
#ifdef OPPROF
	case 'X':
	    dump_frequencies();
	    return;
	case 'x':
	    {
		int i;
		for (i = 0; i <= HIGHEST_OP; i++) {
		    if (opc[i].name != NULL) {
			erts_printf("%-16s %8d\n", opc[i].name, opc[i].count);
		    }
		}
	    }
	    return;
	case 'z':
	    {
		int i;
		for (i = 0; i <= HIGHEST_OP; i++)
		    opc[i].count = 0;
	    }
	    return;
#endif
#ifdef DEBUG
	case 't':
	    erts_p_slpq();
	    return;
	case 'b':
	    bin_check();
	    return;
	case 'C':
	    abort();
#endif
	case '\n':
	    continue;
	default:
	    erts_printf("Eh?\n\n");
	}
    }

}