라즈베리파이 Qt에서 한글은 UTF-8(유니코드)을 사용하고 있는데 프린트를 하기 위해 펌웨어를 사용하고 있는 인터페이스 보드로 전송하여 인쇄를 하니까 한글이 깨져서 나왔다. 그래서 char를 hex로 변환시켜 '가'를 로그에 표시해 해봤더니 UTF-8(유니코드) - 0xEAB080 (3byte) eucKR - 0xB0A1 (2byte) 가 나왔다. 보드쪽은 eucKR(KSC5601)를 사용하고 있기 때문이다. 그래서 Qt에 있는 코덱 변환 함수를 이용해 봤지만 여전히 깨져 나왔다. 그러던 iconv 함수를 이용한 C소스를 찾았고 성공했다^^ 아~ 묵혔던 체증이 싹 풀리는거 같다 ㅋㅋ // 한글 인코딩 UTF-8 -> eucKR int utf82euckr(char *source, char *dest, i..
1. .pro 파일 QT += serialport 2. 통신 세팅 m_Serial = new QSerialPort(this); m_Serial->setPortName("/dev/ttyUSB0"); m_Serial->setBaudRate(QSerialPort::Baud115200); m_Serial->setDataBits(QSerialPort::Data8); m_Serial->setParity(QSerialPort::NoParity); m_Serial->setStopBits(QSerialPort::OneStop); m_Serial->setFlowControl(QSerialPort::NoFlowControl); m_Serial->open(QIODevice::ReadWrite); if(m_Serial->isO..
// thread.h #include class Control_Thread : public QThread { Q_OBJECT private: bool bActive; public: explicit Control_Thread(QObject *parent = 0); void run(); void ThreadStop(); signals: void FormControl(); // 폼에서 호출할 함수 }; // thread.cpp Control_Thread::Control_Thread(QObject *parent) : QThread(parent) { bActive = true; } void Control_Thread::run() { QMutex mutex; while(bActive) { mutex.lock(); ..
// 에디트로 이동 void Network_Dlg::on_BtmSetfocus_clicked() { ui->EdtIp->setFocus(); } // 왼쪽으로 커서 한칸 이동 void Network_Dlg::on_BtnLeft_clicked() { ui->EdtIp->cursorBackward(false); } // 커서 위치에 값 넣기 void Network_Dlg::on_BtnValue_clicked() { QString Str, Left, Mid, Last = ""; Str = ui->EdtIp->text(); Left = Str.left(ui->EdtIp->cursorPosition()); Mid = Str.mid(ui->EdtIp->cursorPosition()); Last += Left; La..
int i = 100; QString::number(i);
// .pro QT += network #include #include #include #include #include #include #include #include // 사용 부분 char gateway[20]; memset(gateway, 0, sizeof(gateway)); get_gatewayip(gateway, 20); memcpy(g_ODT.ENV.ODT_NETWORK.Gateway, gateway, 15); int readNlSock(int sockFd, char *bufPtr, int seqNum, int pId) { struct nlmsghdr *nlHdr; int readLen = 0, msgLen = 0; do { /* Recieve response from the kernel */..
// 파일 권한을 내리고 chmod 777 /etc/network/interfaces void Network_Dlg::on_BtnOk_clicked() { // 네트워크 파일 수정 QFile NetFile("/etc/network/interfaces"); if(NetFile.open(QIODevice::ReadWrite | QIODevice::Text)) { QString Data; Data.sprintf("auto lo\r\n" "iface lo inet loopback\r\n" "\r\n" "auto eth0\r\n" "allow-hotplug eth0\r\n" "iface eth0 inet static\r\n" "address %s\r\n" "netmask %s\r\n" "gateway %s\r\n..
- Total
- Today
- Yesterday