summaryrefslogtreecommitdiff
path: root/R2D2/Command.cs
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2021-01-06 22:44:53 +0000
committerIan C <ianc@noddybox.co.uk>2021-01-06 22:44:53 +0000
commitd9e6fe898ac41c0bea5335812173b87e8eac0ada (patch)
tree08b903013da9782ed3010f27aa2679c7aca073f7 /R2D2/Command.cs
parent014ffb08be328f3325272f764c6e40dc4305f0cd (diff)
Added initial UI and commands. Also created initial icon.HEADmaster
Diffstat (limited to 'R2D2/Command.cs')
-rw-r--r--R2D2/Command.cs82
1 files changed, 82 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
+//
+using System;
+using System.Collections.Generic;
+
+namespace R2D2
+{
+ public static class Command
+ {
+ static private Dictionary<string, byte[]> commands;
+
+ static Command()
+ {
+ commands = new Dictionary<string, byte[]>();
+
+ 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<string> 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};
+ }
+ }
+ }
+}