diff --git a/Modules/RobotKit/Sources/Robot+Lights.swift b/Modules/RobotKit/Sources/Robot+Lights.swift new file mode 100644 index 0000000000..899cd9dc42 --- /dev/null +++ b/Modules/RobotKit/Sources/Robot+Lights.swift @@ -0,0 +1,48 @@ +// Leka - iOS Monorepo +// Copyright 2023 APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +// swiftlint:disable identifier_name + +extension Robot { + + public enum Lights { + case full + case halfLeft + case halfRight + case quarterFrontLeft + case quarterFrontRight + case quarterBackLeft + case quarterBackRight + + case range(start: Int, end: Int) + case spot(ids: [Int]) + + } + + public struct Color { + + public var data: [UInt8] + + public var red: UInt8 { + data[0] + } + + public var green: UInt8 { + data[1] + } + + public var blue: UInt8 { + data[2] + } + + // TODO(@hugo): Add all colors decided w/ Lucie, Hortense + public static let red: Color = Color(data: [255, 0, 0]) + public static let green: Color = Color(data: [0, 255, 0]) + public static let blue: Color = Color(data: [0, 0, 255]) + + } + +} + +// swiftlint:enable identifier_name diff --git a/Modules/RobotKit/Sources/Robot+Motion.swift b/Modules/RobotKit/Sources/Robot+Motion.swift new file mode 100644 index 0000000000..18d21a884d --- /dev/null +++ b/Modules/RobotKit/Sources/Robot+Motion.swift @@ -0,0 +1,21 @@ +// Leka - iOS Monorepo +// Copyright 2023 APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +extension Robot { + + public enum Direction { + case forward + case forwardLeft + case forwardRight + case backward + case backwardLeft + case backwardRight + } + + public enum Rotation { + case clockwise + case counterclockwise + } + +} diff --git a/Modules/RobotKit/Sources/Robot+Reinforcers.swift b/Modules/RobotKit/Sources/Robot+Reinforcers.swift new file mode 100644 index 0000000000..2be2ff1477 --- /dev/null +++ b/Modules/RobotKit/Sources/Robot+Reinforcers.swift @@ -0,0 +1,15 @@ +// Leka - iOS Monorepo +// Copyright 2023 APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +extension Robot { + + public enum Reinforcer { + case spinBlinkGreenOff + case spinBlinkBlueViolet + case fire + case sprinkles + case rainbow + } + +} diff --git a/Modules/RobotKit/Sources/Robot.swift b/Modules/RobotKit/Sources/Robot.swift index 45d2db6d57..dc2cb58a02 100644 --- a/Modules/RobotKit/Sources/Robot.swift +++ b/Modules/RobotKit/Sources/Robot.swift @@ -2,14 +2,55 @@ // Copyright 2023 APF France handicap // SPDX-License-Identifier: Apache-2.0 -import CombineCoreBluetooth +import Combine public class Robot { - // MARK: - Public variables + // MARK: - General - // MARK: - Private variables + public func stop() { + print("🤖 STOP 🛑 - Everything") + } - // MARK: - Public functions + public func reboot() { + print("🤖 REBOOT 💫") + } + + // MARK: - Motion + + public func move(_ direction: Direction, speed: Float) { + print("🤖 MOVE \(direction) at \(speed)") + } + + public func spin(_ rotation: Rotation, speed: Float) { + print("🤖 SPIN \(rotation) at \(speed)") + } + + public func stopMotion() { + print("🤖 STOP 🛑 - Motion") + } + + // MARK: - Lights + + public func shine(_ lights: Lights, color: Color) { + print("🤖 SHINE \(lights) in \(color)") + } + + public func stopLights() { + print("🤖 STOP 🛑 - Lights") + } + + // MARK: - Reinforcers + + public func run(_ reinforcer: Reinforcer) { + print("🤖 RUN reinforcer \(reinforcer)") + } + + // MARK: - Magic Cards + + public func onMagicCard() -> AnyPublisher { + Just(MagicCard.dice_roll) + .eraseToAnyPublisher() + } }