CommQSocketClient::CommQSocketClient(const char *hostname, unsigned int port, CommSocketServer::ClientType type) : CommBase(hostname), QObject() { CommSocketServer::RegisterMessage msg; clientSocket.connectToHost(hostname, port); if(!clientSocket.connected()) throw EConnectError(); msg.data.msg=CommBase::msg_msg; msg.data.type=type; sendMsg(&msg, false); connect(this, SIGNAL(readyRead()), this, SLOT(dataWaiting())); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Reads a byte of data from the UART. int Uart::read(void) { if (NULL == _uart_rx_buff) { // wait for data return dataWaiting() ? UDR0 : -1; } // read data from RX buffer char data = _uart_rx_buff->Get(); return (int) data; }