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 | } |
|
Line 2... | Line 19... | ||
2 | 19 | ||
3 | /** |
20 | /** |
4 | * connect to Mikrokopter |
21 | * connect to Mikrokopter |
5 | */ |
22 | */ |
Line 6... | Line 23... | ||
6 | void QTCommunication::connect_MK(string addr) { |
23 | void QTSerialCommunication::connect_MK(string addr) { |
Line 7... | Line 24... | ||
7 | 24 | ||
8 | }; |
25 | }; |
9 | 26 | ||
10 | /** |
27 | /** |
- | 28 | * send command to Mikrokopter |
|
- | 29 | */ |
|
- | 30 | bool QTSerialCommunication::send_cmd(char cmd, int address, char data[150], unsigned int length, bool resend) { |
|
11 | * send command to Mikrokopter |
31 | if (is_connected()) { |
12 | */ |
32 | //a valid command starts |
Line 13... | Line 33... | ||
13 | bool QTCommunication::send_cmd(char cmd, int address, char data[150], unsigned int length, bool resend) { |
33 | } |
14 | return true; |
34 | return true; |
15 | }; |
35 | }; |
16 | 36 | ||
17 | /** |
37 | /** |
Line 18... | Line 38... | ||
18 | * stop sending commands to Mikrokopter |
38 | * stop sending commands to Mikrokopter |
19 | * stop timer |
39 | * stop timer |