1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

root/Trunk/TestHarness/CreateOI_TestHarness/Mocks/Packets/Mock_Packets.cs @ 158

Revision 158, 3.0 KB (checked in by kevin_gabbert, 4 years ago)

refs #51,

ok, got something together.. At the moment, you can switch the tester by changing what setup it inherits from, either "Hardware_Setup", or "Mock_Setup"

Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5using CreateOI_TestHarness.Mocks.Serial_Port;
6
7namespace CreateOI_TestHarness.Mocks
8{
9    /// <summary>
10    /// A big class of hardcoded packets
11    /// </summary>
12    public static class Mock_Packets
13    {
14        /// <summary>
15        /// 142, 1 ~ 10 bytes
16        /// </summary>
17        public static List<int> Sensors1()
18        {
19            List<int> packet1 = new List<int>();
20
21            //BumpsAndWheelDrops
22            packet1.Add(31);
23
24            //Cliffs
25            packet1.Add(1);
26            packet1.Add(1);
27            packet1.Add(1);
28            packet1.Add(1);
29            packet1.Add(1);
30            packet1.Add(1);
31
32            //Overcurrents
33            packet1.Add(31);
34
35            //Unused
36            packet1.Add(0);
37            packet1.Add(0);
38
39            return packet1;
40        }
41
42        /// <summary>
43        /// 142, 2 ~ 6 bytes
44        /// </summary>
45        public static List<int> Sensors2()
46        {
47            List<int> packet2 = new List<int>();
48
49            //IR
50            packet2.Add(255);
51
52            //Buttons
53            packet2.Add(15);
54
55            //Distance
56            packet2.Add(255);
57            packet2.Add(255);
58
59            //Angle
60            packet2.Add(255);
61            packet2.Add(255);
62
63            return packet2;
64        }
65
66        /// <summary>
67        /// 142, 3 ~ 10 bytes
68        /// </summary>
69        public static List<int> Sensors3()
70        {
71            List<int> packet3 = new List<int>();
72
73            //Charging State
74            packet3.Add(5);
75
76            //Voltage
77            packet3.Add(255);
78            packet3.Add(255);
79
80            //Current
81            packet3.Add(255);
82            packet3.Add(255);
83
84            //Battery Temperature
85            packet3.Add(-127);
86
87            //Battery Charge
88            packet3.Add(255);
89            packet3.Add(0);
90
91            //Battery Capacity
92            packet3.Add(255);
93            packet3.Add(0);
94
95            return packet3;
96        }
97
98        /// <summary>
99        /// 142, 4 ~ 14 bytes
100        /// </summary>
101        public static List<int> Sensors4()
102        {
103            List<int> packet4 = new List<int>();
104
105            //Wall Signal
106            packet4.Add(13);
107            packet4.Add(0);
108
109            //Cliff Left Signal
110            packet4.Add(13);
111            packet4.Add(0);
112
113            //Cliff Front Left Signal
114            packet4.Add(13);
115            packet4.Add(0);
116
117            //Cliff Front Right Signal
118            packet4.Add(13);
119            packet4.Add(0);
120
121            //Cliff Right Signal
122            packet4.Add(13);
123            packet4.Add(0);
124
125            //User Digital Inputs
126            packet4.Add(31);
127
128            //User Analog Input
129            packet4.Add(255);
130            packet4.Add(255);
131
132            //Charging Sources Available
133            packet4.Add(3);
134
135            return packet4;
136        }
137    }
138}
Note: See TracBrowser for help on using the browser.