Subversion Repositories Projects

Rev

Rev 440 | Rev 450 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 440 Rev 449
Line 1... Line 1...
1
#include <QTCommunication.h>
1
#include "QTSerialCommunication.h"
-
 
2
#include "../libMK/Parser.h"
-
 
3
 
-
 
4
/**
-
 
5
 * initiate connection and stuff
-
 
6
 */
-
 
7
QTSerialCommunication::QTSerialCommunication() {
-
 
8
    serial = new ManageSerialPort();
-
 
9
    serial->setBaudRate(BAUD57600);   //BaudRate
-
 
10
    serial->setDataBits(DATA_8);      //DataBits
-
 
11
    serial->setParity(PAR_NONE);      //Parity
-
 
12
    serial->setStopBits(STOP_1);      //StopBits
-
 
13
    serial->setFlowControl(FLOW_OFF); //FlowControl
-
 
14
 
-
 
15
    serial->setTimeout(0, 10);
-
 
16
    serial->enableSending();
-
 
17
    serial->enableReceiving();
-
 
18
}
2
 
19
 
3
/**
20
/**
4
 * connect to Mikrokopter
21
 * connect to Mikrokopter
5
 */
22
 */
6
void QTCommunication::connect_MK(string addr) {
23
void QTSerialCommunication::connect_MK(string addr) {
7
   
24
   
8
};
25
};
9
 
26
 
10
/**
27
/**
11
 * send command to Mikrokopter
28
 * send command to Mikrokopter
12
 */
29
 */
13
bool QTCommunication::send_cmd(char cmd, int address, char data[150], unsigned int length, bool resend) {
30
bool QTSerialCommunication::send_cmd(char cmd, int address, char data[150], unsigned int length, bool resend) {
-
 
31
    if (is_connected()) {
-
 
32
        //a valid command starts
-
 
33
    }
14
    return true;
34
    return true;
15
};
35
};
16
 
36
 
17
/**
37
/**
18
 * stop sending commands to Mikrokopter
38
 * stop sending commands to Mikrokopter
19
 * stop timer
39
 * stop timer
20
 */
40
 */
21
void QTCommunication::stop_resend() {
41
void QTSerialCommunication::stop_resend() {
22
   
42
   
23
};
43
};
24
44