From d9e6fe898ac41c0bea5335812173b87e8eac0ada Mon Sep 17 00:00:00 2001 From: Ian C Date: Wed, 6 Jan 2021 22:44:53 +0000 Subject: Added initial UI and commands. Also created initial icon. --- R2D2/Command.cs | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 R2D2/Command.cs (limited to 'R2D2/Command.cs') diff --git a/R2D2/Command.cs b/R2D2/Command.cs new file mode 100644 index 0000000..7a1423e --- /dev/null +++ b/R2D2/Command.cs @@ -0,0 +1,82 @@ +// R2D2 - Simple driver for Sphero R2D2 +// Copyright 2020 Ian Cowburn +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +using System; +using System.Collections.Generic; + +namespace R2D2 +{ + public static class Command + { + static private Dictionary commands; + + static Command() + { + commands = new Dictionary(); + + commands["Laugh"] = new byte[] {0x0A,0x18,0x00,0x1F,0x00,0x32,0x00,0x00,0x00,0x00,0x00}; + commands["Yes"] = new byte[] {0x0A,0x17,0x05,0x41,0x00,0x0F}; + commands["No"] = new byte[] {0x0A,0x17,0x05,0x3F,0x00,0x10}; + commands["Alarm"] = new byte[] {0x0A,0x17,0x05,0x17,0x00,0x07}; + commands["Angry"] = new byte[] {0x0A,0x17,0x05,0x18,0x00,0x08}; + commands["Annoyed"] = new byte[] {0x0A,0x17,0x05,0x19,0x00,0x09}; + commands["IonBlast"] = new byte[] {0x0A,0x17,0x05,0x1A,0x00,0x0E}; + commands["Sad"] = new byte[] {0x0A,0x17,0x05,0x1C,0x00,0x11}; + commands["Scared"] = new byte[] {0x0A,0x17,0x05,0x1D,0x00,0x13}; + commands["Chatty"] = new byte[] {0x0A,0x17,0x05,0x17,0x00,0x0A}; + commands["Confident"] = new byte[] {0x0A,0x17,0x05,0x18,0x00,0x12}; + commands["Excited"] = new byte[] {0x0A,0x17,0x05,0x19,0x00,0x0C}; + commands["Happy"] = new byte[] {0x0A,0x17,0x05,0x1A,0x00,0x0D}; + commands["Laugh"] = new byte[] {0x0A,0x17,0x05,0x1B,0x00,0x0F}; + commands["Surprise"] = new byte[] {0x0A,0x17,0x05,0x1C,0x00,0x18}; + commands["Tripod"] = new byte[] {0x0A,0x17,0x0D,0x1D,0x01}; + commands["Bipod"] = new byte[] {0x0A,0x17,0x0D,0x1C,0x02}; + } + + public static ICollection GetNames() + { + return commands.Keys; + } + + public static byte[] Get(string name) + { + if (commands.ContainsKey(name)) + { + return commands[name]; + } + else + { + return null; + } + } + + public static byte[] ForceCommand + { + get + { + return new byte[] {0x75,0x73,0x65,0x74,0x68,0x65,0x66,0x6F,0x72,0x63,0x65,0x2E,0x2E,0x2E,0x62,0x61,0x6E,0x64}; + } + } + + public static byte[] Wakeup + { + get + { + return new byte[] {0x0A,0x13,0x0D,0x00}; + } + } + } +} -- cgit v1.2.3