5 #include <QCoreApplication> 9 #include <QtSerialPort/QSerialPort> 22 #define MAX_CONNECTION_TRIES 3 23 #define RECONNECT_SECONDS 5 24 #define SERIAL_OPEN_MODE QIODevice::ReadWrite 28 #define SENSOR_TYPE_BEND 0x1 29 #define SENSOR_TYPE_TOUCH 0x2 30 #define SENSOR_TYPE_ACC 0x3 33 #define SENSOR_ID_FINGER_THUMB 0x1 34 #define SENSOR_ID_FINGER_INDEX 0x2 35 #define SENSOR_ID_FINGER_MIDDLE 0x3 36 #define SENSOR_ID_FINGER_RING 0x4 37 #define SENSOR_ID_FINGER_PINKY 0x5 38 #define SENSOR_ID_ACC_XAXIS 0xA 39 #define SENSOR_ID_ACC_ZAXIS 0xB 42 #define SENSOR_RANGE_BEND_MIN 0x00 43 #define SENSOR_RANGE_BEND_MAX 0xFF 44 #define SENSOR_RANGE_TOUCH_MIN 0x00 45 #define SENSOR_RANGE_TOUCH_MAX 0xFF 46 #define SENSOR_RANGE_ACC_MIN 0x00 47 #define SENSOR_RANGE_ACC_MAX 0xFF 50 #define BAR_PERCENTAGE_MAX 0x64 51 #define BAR_PERCENTAGE_MIN 0x00 54 #define DEVICE_HANDSHAKE "01\n" 55 #define DEVICE_START "02\n" 56 #define DEVICE_STOP "03\n" 58 #define DEVICE_VIBRATE 0x40 61 #define DEVICE_HANDSHAKE_RESPONSE 0x10 62 #define DEVICE_START_RESPONSE 0x20 63 #define DEVICE_STOP_RESPONSE 0x30 64 #define DEVICE_FIRST_WORD 0xF0 67 #define X_RANGE_POINTS 20 68 #define TIMER_TIMEOUT_MS 250 71 #define MAX_SENSORS_BEND 5 72 #define MAX_SENSORS_TOUCH 5 73 #define MAX_AXIS_ACC 2 74 #define MAX_SENSORS MAX_SENSORS_BEND + MAX_SENSORS_TOUCH + MAX_AXIS_ACC 89 QGraphicsScene *scene_visualisation =
new QGraphicsScene;
90 QGraphicsScene *scene_orientation =
new QGraphicsScene;
99 void set_hand_visualisation_scene(
int sensor_type,
int sensor_id,
int sensor_value);
104 void reset_hand_visualisation_scene();
111 explicit MainWindow(QWidget *parent =
nullptr);
120 void parse(
const std::string&);
128 double convert_touch_value(
double touch_value);
134 void action_connect_click();
138 void action_disconnect_click();
142 void action_exit_click();
149 void serial_dataAvailable();
156 void serial_errorOccurred(QSerialPort::SerialPortError error);
168 void handle_data(
const std::string& _data);
177 void vibrate(
const int& sensor_id);
182 void vibrate_thumb();
187 void vibrate_index();
192 void vibrate_middle();
202 void vibrate_pinky();
214 void testrun_timeoutHandler();
220 void disconnect_me();
244 QVector<double> graph_time,
279 #endif // MAINWINDOW_H bool device_finished
Definition: mainwindow.hh:241
double time_now
Definition: mainwindow.hh:266
QVector< QPen > pens
Definition: mainwindow.hh:270
Definition: mainwindow.hh:76
QSerialPort * serial
Definition: mainwindow.hh:234
QVector< QPen > pens_ACC
Definition: mainwindow.hh:271
Klasa definiujaca okno ustawień połączenia.
Definition: connection.hh:13
QVector< QVector< double > * > pointers_accSensor
Definition: mainwindow.hh:264
char * debug_frame
Definition: mainwindow.hh:276
QVector< double > sensor_touch_05
Definition: mainwindow.hh:244
Ui::MainWindow * ui
Definition: mainwindow.hh:228
Connection * connectionWindow
Definition: mainwindow.hh:231
int timeout_counter
Definition: mainwindow.hh:235
QTimer * debugTimer
Definition: mainwindow.hh:274
bool debug_on
Definition: mainwindow.hh:275
Definition: ui_mainwindow.hh:703
QVector< QVector< double > * > pointers_touchSensor
Definition: mainwindow.hh:263
bool device_firstWord
Definition: mainwindow.hh:239
QVector< QVector< double > * > pointers_bendSensor
Definition: mainwindow.hh:262
Klasa definiujaca glowne okno.
Definition: mainwindow.hh:85
bool device_isReady
Definition: mainwindow.hh:240
bool flag_isConnected
Definition: mainwindow.hh:238