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. --- MakeIcon.sh | 12 + R2D2.svg | 18 + .../AppIcon.appiconset/AppIcon-128.png | Bin 8125 -> 1749 bytes .../AppIcon.appiconset/AppIcon-128@2x.png | Bin 20798 -> 3490 bytes .../AppIcon.appiconset/AppIcon-16.png | Bin 711 -> 258 bytes .../AppIcon.appiconset/AppIcon-16@2x.png | Bin 1484 -> 472 bytes .../AppIcon.appiconset/AppIcon-256.png | Bin 20798 -> 3490 bytes .../AppIcon.appiconset/AppIcon-256@2x.png | Bin 59335 -> 7714 bytes .../AppIcon.appiconset/AppIcon-32.png | Bin 1484 -> 472 bytes .../AppIcon.appiconset/AppIcon-32@2x.png | Bin 3428 -> 907 bytes .../AppIcon.appiconset/AppIcon-512.png | Bin 59335 -> 7714 bytes .../AppIcon.appiconset/AppIcon-512@2x.png | Bin 177632 -> 17805 bytes R2D2/Command.cs | 82 +++ R2D2/Info.plist | 5 +- R2D2/Main.storyboard | 740 +++------------------ R2D2/R2D2.csproj | 1 + R2D2/ViewController.cs | 13 +- R2D2/ViewController.designer.cs | 40 +- 18 files changed, 233 insertions(+), 678 deletions(-) create mode 100755 MakeIcon.sh create mode 100644 R2D2.svg create mode 100644 R2D2/Command.cs diff --git a/MakeIcon.sh b/MakeIcon.sh new file mode 100755 index 0000000..04eb953 --- /dev/null +++ b/MakeIcon.sh @@ -0,0 +1,12 @@ +INK=/Applications/Inkscape.app/Contents/MacOS/inkscape + +$INK --export-filename=R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png -w 16 -h 16 R2D2.svg +$INK --export-filename=R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png -w 32 -h 32 R2D2.svg +$INK --export-filename=R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png -w 32 -h 32 R2D2.svg +$INK --export-filename=R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png -w 64 -h 64 R2D2.svg +$INK --export-filename=R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png -w 128 -h 128 R2D2.svg +$INK --export-filename=R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png -w 256 -h 256 R2D2.svg +$INK --export-filename=R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png -w 256 -h 256 R2D2.svg +$INK --export-filename=R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png -w 512 -h 512 R2D2.svg +$INK --export-filename=R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png -w 512 -h 512 R2D2.svg +$INK --export-filename=R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png -w 1024 -h 1024 R2D2.svg diff --git a/R2D2.svg b/R2D2.svg new file mode 100644 index 0000000..5dd3c14 --- /dev/null +++ b/R2D2.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png index d0b5a80..127e167 100644 Binary files a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png and b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png differ diff --git a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png index f4c8d29..004f42c 100644 Binary files a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png and b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png differ diff --git a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png index ebb5a0f..c9a01ca 100644 Binary files a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png and b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png differ diff --git a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png index 0986d31..6e3b25e 100644 Binary files a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png and b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png differ diff --git a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png index f4c8d29..004f42c 100644 Binary files a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png and b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png differ diff --git a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png index a142c83..3b23455 100644 Binary files a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png and b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png differ diff --git a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png index 0986d31..6e3b25e 100644 Binary files a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png and b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png differ diff --git a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png index 412d6ca..5591c78 100644 Binary files a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png and b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png differ diff --git a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png index a142c83..3b23455 100644 Binary files a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png and b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png differ diff --git a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png index e99022a..274a8e9 100644 Binary files a/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png and b/R2D2/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png differ 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}; + } + } + } +} diff --git a/R2D2/Info.plist b/R2D2/Info.plist index 2586d16..56d779c 100644 --- a/R2D2/Info.plist +++ b/R2D2/Info.plist @@ -1,4 +1,4 @@ - + @@ -9,7 +9,7 @@ CFBundleShortVersionString 1.0 CFBundleVersion - 1 + devel LSMinimumSystemVersion 10.15 CFBundleDevelopmentRegion @@ -28,6 +28,5 @@ Main XSAppIconAssets Assets.xcassets/AppIcon.appiconset - diff --git a/R2D2/Main.storyboard b/R2D2/Main.storyboard index 5052149..b1b2957 100644 --- a/R2D2/Main.storyboard +++ b/R2D2/Main.storyboard @@ -1,7 +1,9 @@ - - + + - + + + @@ -11,657 +13,19 @@ - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Default - - - - - - - Left to Right - - - - - - - Right to Left - - - - - - - - - - - Default - - - - - - - Left to Right - - - - - - - Right to Left - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -670,48 +34,94 @@ - + - - - + + + - + - - - - - + + + + + - + - + - + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + diff --git a/R2D2/R2D2.csproj b/R2D2/R2D2.csproj index abe2009..d9aba58 100644 --- a/R2D2/R2D2.csproj +++ b/R2D2/R2D2.csproj @@ -76,6 +76,7 @@ ViewController.cs + diff --git a/R2D2/ViewController.cs b/R2D2/ViewController.cs index de5674f..ff6885c 100644 --- a/R2D2/ViewController.cs +++ b/R2D2/ViewController.cs @@ -31,7 +31,10 @@ namespace R2D2 { base.ViewDidLoad(); - // Do any additional setup after loading the view. + foreach (string name in Command.GetNames()) + { + commandList.Add(new NSString(name)); + } } public override NSObject RepresentedObject @@ -46,5 +49,13 @@ namespace R2D2 // Update the view, if already loaded. } } + + partial void DoScan(NSObject sender) + { + } + + partial void DoSendCommand(NSObject sender) + { + } } } diff --git a/R2D2/ViewController.designer.cs b/R2D2/ViewController.designer.cs index 40a740f..61c2322 100644 --- a/R2D2/ViewController.designer.cs +++ b/R2D2/ViewController.designer.cs @@ -1,18 +1,40 @@ -// WARNING +// WARNING // -// This file has been generated automatically by Xamarin Studio to store outlets and +// This file has been generated automatically by Visual Studio to store outlets and // actions made in the UI designer. If it is removed, they will be lost. // Manual changes to this file may not be handled correctly. // using Foundation; +using System.CodeDom.Compiler; namespace R2D2 { - [Register("ViewController")] - partial class ViewController - { - void ReleaseDesignerOutlets() - { - } - } + [Register ("ViewController")] + partial class ViewController + { + [Outlet] + AppKit.NSComboBox commandList { get; set; } + + [Outlet] + AppKit.NSComboBox scanList { get; set; } + + [Action ("DoScan:")] + partial void DoScan (Foundation.NSObject sender); + + [Action ("DoSendCommand:")] + partial void DoSendCommand (Foundation.NSObject sender); + + void ReleaseDesignerOutlets () + { + if (commandList != null) { + commandList.Dispose (); + commandList = null; + } + + if (scanList != null) { + scanList.Dispose (); + scanList = null; + } + } + } } -- cgit v1.2.3