From 50d98bcff0c3cb0df7f2d266f99bb9bafb16bd26 Mon Sep 17 00:00:00 2001 From: Yann Locatelli Date: Fri, 13 Jan 2023 13:43:05 +0100 Subject: [PATCH] :recycle: (behaviorkit): Separate bleConnection into bleConnectionWithoutVideo and bleConnectionWithVideo --- libs/BehaviorKit/include/BehaviorKit.h | 3 ++- libs/BehaviorKit/source/BehaviorKit.cpp | 11 +++++++---- libs/BehaviorKit/tests/BehaviorKit_test.cpp | 4 ++-- libs/RobotKit/include/RobotController.h | 4 ++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/libs/BehaviorKit/include/BehaviorKit.h b/libs/BehaviorKit/include/BehaviorKit.h index 27e15da8c3..cfb7b82fe7 100644 --- a/libs/BehaviorKit/include/BehaviorKit.h +++ b/libs/BehaviorKit/include/BehaviorKit.h @@ -37,7 +37,8 @@ class BehaviorKit void chargingHigh(); void chargingFull(); - void bleConnection(bool with_video); + void bleConnectionWithoutVideo(); + void bleConnectionWithVideo(); void working(); void fileExchange(); diff --git a/libs/BehaviorKit/source/BehaviorKit.cpp b/libs/BehaviorKit/source/BehaviorKit.cpp index 69a9d27f5d..485ab71f1e 100644 --- a/libs/BehaviorKit/source/BehaviorKit.cpp +++ b/libs/BehaviorKit/source/BehaviorKit.cpp @@ -79,12 +79,15 @@ void BehaviorKit::chargingFull() _videokit.displayImage("/fs/home/img/system/robot-battery-charging-quarter_4-green.jpg"); } -void BehaviorKit::bleConnection(bool with_video) +void BehaviorKit::bleConnectionWithoutVideo() { _ledkit.start(&led::animation::ble_connection); - if (with_video) { - _videokit.playVideoOnce("/fs/home/vid/system/robot-system-ble_connection-wink-no_eyebrows.avi"); - } +} + +void BehaviorKit::bleConnectionWithVideo() +{ + _ledkit.start(&led::animation::ble_connection); + _videokit.playVideoOnce("/fs/home/vid/system/robot-system-ble_connection-wink-no_eyebrows.avi"); } void BehaviorKit::working() diff --git a/libs/BehaviorKit/tests/BehaviorKit_test.cpp b/libs/BehaviorKit/tests/BehaviorKit_test.cpp index 58a4027b9f..002d28a550 100644 --- a/libs/BehaviorKit/tests/BehaviorKit_test.cpp +++ b/libs/BehaviorKit/tests/BehaviorKit_test.cpp @@ -103,7 +103,7 @@ TEST_F(BehaviorKitTest, bleConnectionWithoutVideo) EXPECT_CALL(mock_videokit, playVideoOnce).Times(0); EXPECT_CALL(mock_ledkit, start(isSameAnimation(&led::animation::ble_connection))).Times(1); - behaviorkit.bleConnection(false); + behaviorkit.bleConnectionWithoutVideo(); } TEST_F(BehaviorKitTest, bleConnectionWithVideo) @@ -111,7 +111,7 @@ TEST_F(BehaviorKitTest, bleConnectionWithVideo) EXPECT_CALL(mock_videokit, playVideoOnce); EXPECT_CALL(mock_ledkit, start(isSameAnimation(&led::animation::ble_connection))).Times(1); - behaviorkit.bleConnection(true); + behaviorkit.bleConnectionWithVideo(); } TEST_F(BehaviorKitTest, working) diff --git a/libs/RobotKit/include/RobotController.h b/libs/RobotKit/include/RobotController.h index 395cbc8156..039a723f61 100644 --- a/libs/RobotKit/include/RobotController.h +++ b/libs/RobotKit/include/RobotController.h @@ -189,11 +189,11 @@ class RobotController : public interface::RobotController using namespace std::chrono_literals; stopActuators(); if (_battery.isCharging()) { - _behaviorkit.bleConnection(false); + _behaviorkit.bleConnectionWithoutVideo(); rtos::ThisThread::sleep_for(5s); _behaviorkit.blinkOnCharge(); } else { - _behaviorkit.bleConnection(true); + _behaviorkit.bleConnectionWithVideo(); _lcd.turnOn(); } }