#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 valuesChanged() End Sub #tag EndMethod #tag Method, Flags = &h0 Sub readCar() //Read values from the currently attached car 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 = &h0 carType As String = "MR-03" #tag EndProperty #tag ViewBehavior #tag ViewProperty Name="Name" Visible=true Group="ID" InheritedFrom="serial" #tag EndViewProperty #tag ViewProperty Name="Index" Visible=true Group="ID" Type="Integer" InheritedFrom="serial" #tag EndViewProperty #tag ViewProperty Name="Super" Visible=true Group="ID" InheritedFrom="serial" #tag EndViewProperty #tag ViewProperty Name="Left" Visible=true Group="Position" InheritedFrom="serial" #tag EndViewProperty #tag ViewProperty Name="Top" Visible=true Group="Position" InheritedFrom="serial" #tag EndViewProperty #tag ViewProperty Name="Baud" Visible=true Group="Behavior" InitialValue="13" Type="Integer" EditorType="Enum" InheritedFrom="serial" #tag EnumValues "0 - 300" "1 - 600" "2 - 1200" "3 - 1800" "4 - 2400" "5 - 3600" "6 - 4800" "7 - 7200" "8 - 9600" "9 - 14400" "10 - 19200" "11 - 28800" "12 - 38400" "13 - 57600" "14 - 115200" "15 - 230400" #tag EndEnumValues #tag EndViewProperty #tag ViewProperty Name="Bits" Visible=true Group="Behavior" InitialValue="3" Type="Integer" EditorType="Enum" InheritedFrom="serial" #tag EnumValues "0 - 5 Data Bits" "1 - 6 Data Bits" "2 - 7 Data Bits" "3 - 8 Data bits" #tag EndEnumValues #tag EndViewProperty #tag ViewProperty Name="Parity" Visible=true Group="Behavior" InitialValue="0" Type="Integer" EditorType="Enum" InheritedFrom="serial" #tag EnumValues "0 - No Parity" "1 - Odd Parity" "2 - EvenParity" #tag EndEnumValues #tag EndViewProperty #tag ViewProperty Name="Stop" Visible=true Group="Behavior" InitialValue="0" Type="Integer" EditorType="Enum" InheritedFrom="serial" #tag EnumValues "0 - 1 Stop Bit" "1 - 1.5 Stop Bits" "2 - 2 Stop Bits" #tag EndEnumValues #tag EndViewProperty #tag ViewProperty Name="XON" Visible=true Group="Behavior" Type="Boolean" InheritedFrom="serial" #tag EndViewProperty #tag ViewProperty Name="CTS" Visible=true Group="Behavior" Type="Boolean" InheritedFrom="serial" #tag EndViewProperty #tag ViewProperty Name="DTR" Visible=true Group="Behavior" Type="Boolean" InheritedFrom="serial" #tag EndViewProperty #tag ViewProperty Name="byte01" Group="Behavior" InitialValue="&hFF" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte11" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte12" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte13" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte14" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte15" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte16" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte17" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte18" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte02" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte03" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte04" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte05" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte06" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte07" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte08" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte09" Group="Behavior" Type="String" #tag EndViewProperty #tag ViewProperty Name="byte10" Group="Behavior" Type="String" #tag EndViewProperty #tag EndViewBehavior End Class #tag EndClass