Example #1
0
int main(int argc, char *argv[])
{
	int n = 8;

	Log_Init("/tmp/httpserver.log", LOGFLAG_FILE);

	LOG_ERRORS("error !\n");
	LOG_WARNS("warn !\n");
	LOG_INFOS("info !\n");
	LOG_DEBUGS("debug !\n");
	LOG_TRACES("trace !\n");

	Log_Close();

	return 0;
}
void SerialConnection::setup(){
    QList<QextPortInfo> portList = QextSerialEnumerator::getPorts();

    this->m_pSerialPort = new QextSerialPort(portList[1].portName, QextSerialPort::EventDriven);
    m_pSerialPort->setBaudRate(BAUD115200);
    m_pSerialPort->setFlowControl(FLOW_OFF);
    m_pSerialPort->setParity(PAR_NONE);
    m_pSerialPort->setDataBits(DATA_8);
    m_pSerialPort->setStopBits(STOP_2);

    if (m_pSerialPort->open(QIODevice::ReadWrite) == true) {
        connect(m_pSerialPort, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
        connect(m_pSerialPort, SIGNAL(dsrChanged(bool)), this, SLOT(onDsrChanged(bool)));

        if (!(m_pSerialPort->lineStatus() & LS_DSR)){
           LOG_WARNS(LOG_FACILTIY_COMMON, "warning: device is not turned on");
        }
        LOG_INFO(LOG_FACILTIY_COMMON, "listening for data on %s", qPrintable(m_pSerialPort->portName()));
    }