Пример #1
0
/*!
   open MicroHam device
 */
void MicroHam::openMicroHam()
{
    if (MicroHamPort->isOpen()) {
        closeMicroHam();
        MicroHamOpen = false;
    }
    MicroHamPort->setPortName(settings.value(s_microham_device,s_microham_device_def).toString());

    // 9600N81
    MicroHamPort->setBaudRate(BAUD9600);
    MicroHamPort->setFlowControl(FLOW_OFF);
    MicroHamPort->setParity(PAR_NONE);
    MicroHamPort->setDataBits(DATA_8);
    MicroHamPort->setStopBits(STOP_1);

    MicroHamPort->setTimeout(500);
    MicroHamPort->open(QIODevice::ReadWrite);
    MicroHamPort->setRts(0);
    MicroHamPort->setDtr(0);
    MicroHamPort->flush();

    if (!MicroHamPort->isOpen()) {
        MicroHamOpen = false;
        emit(microhamError("ERROR: could not open MicroHam device"));
        return;
    }
    MicroHamOpen = true;
}
Пример #2
0
/*!
   open MicroHam device
 */
void MicroHam::openMicroHam()
{
    // in case we are re-starting MicroHam
    if (MicroHamPort->isOpen()) {
        closeMicroHam();
        MicroHamOpen = false;
    }
    MicroHamPort->setPortName(settings.value(s_microham_device,s_microham_device_def).toString());

    // currently only 9600N81
    MicroHamPort->setBaudRate(QSerialPort::Baud9600);
    MicroHamPort->setFlowControl(QSerialPort::NoFlowControl);
    MicroHamPort->setParity(QSerialPort::NoParity);
    MicroHamPort->setDataBits(QSerialPort::Data8);
    MicroHamPort->setStopBits(QSerialPort::OneStop);

    MicroHamPort->open(QIODevice::ReadWrite);

    if (!MicroHamPort->isOpen()) {
        MicroHamOpen = false;
        emit(microhamError("ERROR: could not open MicroHam device"));
        return;
    }
    MicroHamPort->setRequestToSend(false);
    MicroHamPort->setDataTerminalReady(false);
    MicroHamOpen = true;
}
Пример #3
0
MicroHam::~MicroHam()
{
    closeMicroHam();
    delete MicroHamPort;
}