MCPcopy Create free account
hub / github.com/Schildkroet/Candle2 / SerialIf_Write

Function SerialIf_Write

src/interface/SerialInterface.cpp:118–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118qint64 SerialIf_Write(const QByteArray &data)
119{
120 if(m_Interface == IF_SERIAL)
121 {
122 return m_serialPort.write(data);
123 }
124 else if(m_Interface == IF_ETHERNET)
125 {
126 /*if(m_tcpSocket.state() != QTcpSocket::ConnectedState)
127 {
128 qDebug() << "Disconnected. Trying to reopen";
129 m_tcpSocket.reset();
130
131 m_tcpSocket.connectToHost(m_ip, m_port);
132 m_SocketOpen = m_tcpSocket.waitForConnected(3000);
133 }*/
134
135 qint64 bytes = m_tcpSocket.write(data);
136 if(bytes < 0)
137 {
138 qDebug() << "Error: " << m_tcpSocket.errorString();
139 }
140 m_tcpSocket.waitForBytesWritten(4);
141
142 return bytes;
143 }
144 qDebug() << "Unknown interface";
145
146 return 0;
147}
148
149qint64 SerialIf_Write(const char *data, qint64 len)
150{

Callers 14

~frmMainMethod · 0.85
GrblResetMethod · 0.85
onSendSerialMethod · 0.85
onTimerStatusQueryMethod · 0.85
on_cmdSpindle_clickedMethod · 0.85
UpdateOverrideMethod · 0.85
on_cmdStop_clickedMethod · 0.85
ProcessGRBL1_1Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected