Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 500 → Rev 513

/QMK-Groundstation/branches/libMK/libMK/QTSerialCommunication.cpp
44,24 → 44,21
};
 
/**
* received new data from MK
*/
 
 
/**
* send command to Mikrokopter
*/
void QTSerialCommunication::send_cmd(char cmd, int address, char data[150], unsigned int length, bool resend) {
char send_data[150];
if (is_connected()) {
Parser::create_frame(cmd, address, data, length);
Parser::create_frame(send_data, cmd, address, data, length);
if (resend) {
//resend every 2 seconds
resendTimer.start(2000);
resendData = data;
resendData = send_data;
}
//TODO: save outgoing data for debug purpose
std::cout << "send: " << data << std::endl;
QByteArray temp(data);
std::cout << "send: ";
FlightLog::log_data(send_data, length+3);
QByteArray temp(send_data);
serial->sendData(temp);
} else {
//FIXME: Error message: not connected
87,18 → 84,18
* and just give it to the handler.
*/
void QTSerialCommunication::slot_received_data(const QByteArray & data) {
std::cout << "receive something" << std::endl;
received_data((char *)data.data(), data.length());
}
 
/**
* handel received data
* handel received data from MK
*/
void QTSerialCommunication::received_data(char * data, int length) {
//Debug: print oud debug data
//TODO: save data in a file for debug purposes
std::cout << "receive: " << data << std::endl;
std::cout << "receive: ";
FlightLog::log_data(data, length);
//handle incomming data
//FIXME: HIER! Hardware-Id = Mode.id
 
handler->receive_data(data, length);
}