Warning: Can't use blame annotator:
svn blame failed on trunk/desktop/ICSSerialPort.rbbas: ("Can't find a temporary directory: Internal error", 20014)

source: trunk/desktop/ICSSerialPort.rbbas @ 6

Revision 6, 3.5 KB checked in by pinwc4, 16 years ago (diff)

Updated ICS serial class

RevLine 
1#tag Class
2Protected Class ICSSerialPort
3Inherits serial
4        #tag Method, Flags = &h0
5                Sub resetCar()
6                  //This sends the command to reset the car back to a default configuration
7                  //Defaults are different for each car type
8                 
9                  dim sendstring as string
10                 
11                  select case carType
12                   
13                  case "MR-03"
14                   
15                   
16                  case "dNaNo"
17                   
18                   
19                  case "ASF"
20                   
21                   
22                  case "AD"
23                   
24                   
25                  else
26                    //default thing to do
27                    MsgBox "Error invalid car type"
28                    Return
29                   
30                  end select
31                 
32                  me.Write(sendstring)
33                End Sub
34        #tag EndMethod
35
36        #tag Method, Flags = &h0
37                Sub setDefaultValues()
38                  //Set the defaults for the bytes sent to a car
39                 
40                  dim sendstring as string
41                 
42                  select case carType
43                   
44                  case "MR-03"
45                   
46                   
47                  case "dNaNo"
48                   
49                   
50                  case "ASF"
51                   
52                   
53                  case "AD"
54                   
55                   
56                  else
57                    //default thing to do
58                    MsgBox "Error invalid car type"
59                    return
60                  end select
61                 
62                  //trigger the event definition so main program knows the values changed
63                  valuesChanged()
64                End Sub
65        #tag EndMethod
66
67        #tag Method, Flags = &h0
68                Sub setCarType(value as string)
69                  //When setting car type we must reconfigure the serial port
70                  //Some car types have a different baud rate
71                 
72                  select case value
73                   
74                  case "MR-03"
75                    carType = value
76                  case "dNaNo"
77                    carType = value
78                  case "AD"
79                    carType = value
80                  case "ASF"
81                    carType = value
82                  else
83                    MsgBox "Error setting Car Type"
84                  end select
85                End Sub
86        #tag EndMethod
87
88        #tag Method, Flags = &h0
89                Sub writeCar()
90                  //Send set bytes to the car
91                 
92                  dim sendstring as string
93                 
94                  calculateChecksum()
95                 
96                  sendstring = byte01 + byte02 + byte03 + byte04 + byte05 + byte06 + byte07 + byte08 + byte09 + byte10 + byte11 + byte12 + byte13 + byte14 + byte15 + byte16 + byte17 + byte18
97                 
98                  me.Write(sendstring)
99                End Sub
100        #tag EndMethod
101
102        #tag Method, Flags = &h0
103                Sub calculateChecksum()
104                  //Use this to calculate byte 18, the checksum
105                End Sub
106        #tag EndMethod
107
108
109        #tag Hook, Flags = &h0
110                Event valuesChanged()
111        #tag EndHook
112
113
114        #tag Note, Name = General
115                Car type must be set for this to operate
116                Car types supported by this application are
117                MR-03
118                dNaNo
119                ASF
120                AD
121               
122               
123               
124        #tag EndNote
125
126
127        #tag Property, Flags = &h0
128                byte01 As String = "&hFF"
129        #tag EndProperty
130
131        #tag Property, Flags = &h0
132                byte11 As String
133        #tag EndProperty
134
135        #tag Property, Flags = &h0
136                byte12 As String
137        #tag EndProperty
138
139        #tag Property, Flags = &h0
140                byte13 As String
141        #tag EndProperty
142
143        #tag Property, Flags = &h0
144                byte14 As String
145        #tag EndProperty
146
147        #tag Property, Flags = &h0
148                byte15 As String
149        #tag EndProperty
150
151        #tag Property, Flags = &h0
152                byte16 As String
153        #tag EndProperty
154
155        #tag Property, Flags = &h0
156                byte17 As String
157        #tag EndProperty
158
159        #tag Property, Flags = &h0
160                byte18 As String
161        #tag EndProperty
162
163        #tag Property, Flags = &h0
164                byte02 As String
165        #tag EndProperty
166
167        #tag Property, Flags = &h0
168                byte03 As String
169        #tag EndProperty
170
171        #tag Property, Flags = &h0
172                byte04 As String
173        #tag EndProperty
174
175        #tag Property, Flags = &h0
176                byte05 As String
177        #tag EndProperty
178
179        #tag Property, Flags = &h0
180                byte06 As String
181        #tag EndProperty
182
183        #tag Property, Flags = &h0
184                byte07 As String
185        #tag EndProperty
186
187        #tag Property, Flags = &h0
188                byte08 As String
189        #tag EndProperty
190
191        #tag Property, Flags = &h0
192                byte09 As String
193        #tag EndProperty
194
195        #tag Property, Flags = &h0
196                byte10 As String
197        #tag EndProperty
198
199        #tag Property, Flags = &h21
200                Private carType As String = "MR-03"
201        #tag EndProperty
202
203
204End Class
205#tag EndClass
Note: See TracBrowser for help on using the repository browser.