#tag Class Protected Class ICSSerialPort Inherits serial #tag Method, Flags = &h0 Sub resetCar() //This sends the command to reset the car back to a default configuration //Defaults are different for each car type dim sendstring as string select case carType case "MR-03" case "dNaNo" case "ASF" case "AD" else //default thing to do MsgBox "Error invalid car type" Return end select me.Write(sendstring) End Sub #tag EndMethod #tag Method, Flags = &h0 Sub setDefaultValues() //Set the defaults for the bytes sent to a car dim sendstring as string select case carType case "MR-03" case "dNaNo" case "ASF" case "AD" else //default thing to do MsgBox "Error invalid car type" return end select //trigger the event definition so main program knows the values changed valuesChanged() End Sub #tag EndMethod #tag Method, Flags = &h0 Sub setCarType(value as string) //When setting car type we must reconfigure the serial port //Some car types have a different baud rate select case value case "MR-03" carType = value case "dNaNo" carType = value case "AD" carType = value case "ASF" carType = value else MsgBox "Error setting Car Type" end select End Sub #tag EndMethod #tag Method, Flags = &h0 Sub writeCar() //Send set bytes to the car dim sendstring as string calculateChecksum() sendstring = byte01 + byte02 + byte03 + byte04 + byte05 + byte06 + byte07 + byte08 + byte09 + byte10 + byte11 + byte12 + byte13 + byte14 + byte15 + byte16 + byte17 + byte18 me.Write(sendstring) End Sub #tag EndMethod #tag Method, Flags = &h0 Sub calculateChecksum() //Use this to calculate byte 18, the checksum End Sub #tag EndMethod #tag Hook, Flags = &h0 Event valuesChanged() #tag EndHook #tag Note, Name = General Car type must be set for this to operate Car types supported by this application are MR-03 dNaNo ASF AD #tag EndNote #tag Property, Flags = &h0 byte01 As String = "&hFF" #tag EndProperty #tag Property, Flags = &h0 byte11 As String #tag EndProperty #tag Property, Flags = &h0 byte12 As String #tag EndProperty #tag Property, Flags = &h0 byte13 As String #tag EndProperty #tag Property, Flags = &h0 byte14 As String #tag EndProperty #tag Property, Flags = &h0 byte15 As String #tag EndProperty #tag Property, Flags = &h0 byte16 As String #tag EndProperty #tag Property, Flags = &h0 byte17 As String #tag EndProperty #tag Property, Flags = &h0 byte18 As String #tag EndProperty #tag Property, Flags = &h0 byte02 As String #tag EndProperty #tag Property, Flags = &h0 byte03 As String #tag EndProperty #tag Property, Flags = &h0 byte04 As String #tag EndProperty #tag Property, Flags = &h0 byte05 As String #tag EndProperty #tag Property, Flags = &h0 byte06 As String #tag EndProperty #tag Property, Flags = &h0 byte07 As String #tag EndProperty #tag Property, Flags = &h0 byte08 As String #tag EndProperty #tag Property, Flags = &h0 byte09 As String #tag EndProperty #tag Property, Flags = &h0 byte10 As String #tag EndProperty #tag Property, Flags = &h21 Private carType As String = "MR-03" #tag EndProperty End Class #tag EndClass