diff --git a/logic/src/model/Console.cpp b/logic/src/model/Console.cpp index d6889e5..84faa54 100644 --- a/logic/src/model/Console.cpp +++ b/logic/src/model/Console.cpp @@ -35,7 +35,8 @@ void Console::pressDual() //******************************************************************************** void Console::releaseDual() { - + auto arr = _dual.release(); + _dataSender->send(arr); } //******************************************************************************** diff --git a/logic/src/model/RotayButton.cpp b/logic/src/model/RotayButton.cpp index c52ab37..fd27468 100644 --- a/logic/src/model/RotayButton.cpp +++ b/logic/src/model/RotayButton.cpp @@ -23,7 +23,18 @@ Led *RotayButton::getLed() //******************************************************************************** QByteArray RotayButton::rotate(int value) { - + QByteArray arr; + + arr.resize(8); + arr[0] = 0x00; + arr[1] = 0X02; + arr[2] = 0X05; + arr[3] = _functionCode; + arr[4] = 0x01; + arr[5] = 0x00; + arr[6] = 0x00; + arr[7] = 0x00; + return arr; } //******************************************************************************** diff --git a/test/tst_console.cpp b/test/tst_console.cpp index e71aee2..773c56b 100644 --- a/test/tst_console.cpp +++ b/test/tst_console.cpp @@ -13,7 +13,8 @@ public: private slots: void test_case1(); - void dualPress_test_case(); + void pressDual_test_case(); + void releaseDual_test_case(); }; @@ -45,7 +46,7 @@ void ConsoleTest::test_case1() } //******************************************************************************** -void ConsoleTest::dualPress_test_case() +void ConsoleTest::pressDual_test_case() { Console c; auto t = new TestDataSender; @@ -53,7 +54,6 @@ void ConsoleTest::dualPress_test_case() c.pressDual(); QByteArray arr; - arr.resize(8); arr[0] = 0x00; arr[1] = 0x01; @@ -65,7 +65,28 @@ void ConsoleTest::dualPress_test_case() arr[7] = 0x00; QCOMPARE(t->consoleData, arr); +} +//******************************************************************************** +void ConsoleTest::releaseDual_test_case() +{ + Console c; + auto t = new TestDataSender; + c.injectDataSender(t); + c.releaseDual(); + QByteArray arr; + + arr.resize(8); + arr[0] = 0x00; + arr[1] = 0x01; + arr[2] = 0x04; + arr[3] = 0x1D; + arr[4] = 0x00; + arr[5] = 0x00; + arr[6] = 0x00; + arr[7] = 0x00; + + QCOMPARE(t->consoleData, arr); } QTEST_APPLESS_MAIN(ConsoleTest)