1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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};
}
}
}
}
|