-/*
- for(int i=0; i < data.size(); i++){
- qDebug("%d: %d", i, ((signed char)data.at(i)));
- }
-*/
-
- /*
- * Actually it seems like that the first three bytes are used for
- * identifying the "type" of data sent. However, for now using the
- * first seems to suffice.
- */
- if(data.at(0) == 5){
- // Joystick movement
- emit(stickMoved((int)(signed char) data.at(4), (int)(signed char) data.at(5)));
- }else if(data.at(0) == 8){
- // Button press
- /*
- * A -> 0, B -> 1, C -> 2, D ->3
- * At index 3 to 6 (inclusive)
- */
-
- char buttonMap = 0;
-
- for(int i = 3; i <= 6; i++){
- for(int b = 0; b <= 3; b++){
- if(data.at(i) == b){
- buttonMap ^= (1 << b);
- }
- }
- }
-
- qDebug("Button map: %d", buttonMap);
- emit(buttonsChanged(buttonMap & 0x01, buttonMap & 0x02, buttonMap & 0x04, buttonMap & 0x08));
- }
- }
+ void upChanged(bool val);
+ void downChanged(bool val);
+ void leftChanged(bool val);
+ void rightChanged(bool val);
+
+ void aChanged(bool val);
+ void bChanged(bool val);
+ void cChanged(bool val);
+ void dChanged(bool val);
+
+ void xChanged(int val);
+ void yChanged(int val);
+
+private slots:
+ void readData();