Announcement

Collapse
No announcement yet.

Autoit to get RR info

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Autoit to get RR info

    HI all,

    It's my first program who run with RR .

    I do some test to listen how to program for RR .

    For this program I want just to get some info from RR ,
    like :

    $rr.GetInfo("GPSSPD")
    $rr.getinfo("GPSLAT")
    $rr.getinfo("GPSLON")
    $rr.getinfo("GPSHDG")

    My program is in AutoIt with a GUI for to SEE RR info on this GUI .

    But these info are not updated every second .

    Who can help me please ?

    My code is:

    #include <GUIConstantsEx.au3>

    $tempo = 1000 ; Mets ici la frequence de rafraichissement en Ms


    ;Test if RideRunner
    $rr = "NIL"
    $F = WinExists("RideRunner")
    If $F = 0 Then MsgBox(0, "Error", "Ride Runner doit fonctionner pour que Speedlimit démarre", 5)
    If $F = 1 Then
    $rr = ObjCreate("RideRunner.SDK")
    EndIf

    ;Informations issues de RideRunner
    $MySpd = $rr.GetInfo("GPSSPD")
    $CurrentLat = $rr.getinfo("GPSLAT")
    $CurrentLon = $rr.getinfo("GPSLON")
    $CurrentHDG = $rr.getinfo("GPSHDG")

    ;MsgBox(0, '', $CurrentLat )

    #Region ### START Koda GUI section ###
    $Form1 = GUICreate("RRGetInfo V1.0", 568, 353, -1, -1)
    $label1 = GUICtrlCreateLabel("La vitesse est de :" & $rr.GetInfo("GPSSPD"), 16, 40, 400, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $label2 = GUICtrlCreateLabel("La Latitude de : " & $rr.getinfo("GPSLAT"), 16, 80, 400, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $label3 = GUICtrlCreateLabel("La Longitude est de : " & $rr.getinfo("GPSLON"), 16, 120, 400, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $label4 = GUICtrlCreateLabel("Le nombre de radars est de : " & $rr.getinfo("GPSLON"), 16, 160, 400, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $Annuler = GUICtrlCreateButton("Annuler", 480, 296, 75, 25)
    $MAJ = GUICtrlCreateButton("Get", 480, 200, 75, 25)
    $OK = GUICtrlCreateButton("OK", 392, 296, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    AdlibEnable("GetRide", $tempo)

    While 1 ; Boucle de message (voir la section création d'une GUI pour comprendre le fonctionnement)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE, $Annuler ; Si la fenêtre est fermée ou si le bouton annulé est cliqué.
    Exit
    ; on attribue ca valeur au champ de l'input.

    Case $OK ; Si le bouton OK à été cliqué.
    GUICtrlRead($label1) ; On lit la variable GPSSPD issue de RideRunner

    GUIDelete($Form1) ; Efface la GUI

    Case $MAJ
    GetRide()



    EndSwitch
    WEnd
    AdlibDisable()


    Func GetRide()
    If IsObj($rr) Then
    $MySpd = $rr.GetInfo("GPSSPD")
    $CurrentLat = $rr.getinfo("GPSLAT")
    $CurrentLon = $rr.getinfo("GPSLON")
    $CurrentHDG = $rr.getinfo("GPSHDG")
    EndIf

    EndFunc ;==>GetRide


  • #2
    you could always create a while loop in autoit to refresh the information every minute.
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

    Comment


    • #3
      Originally posted by Sonicxtacy02 View Post
      you could always create a while loop in autoit to refresh the information every minute.
      Hi Sonicxtacy . do you have a little exemple .

      Can you to modify my code please ?

      Thanks

      Pierre

      Comment


      • #4
        Originally posted by Sonicxtacy02 View Post
        you could always create a while loop in autoit to refresh the information every minute.


        Nooooooooooooooooooo!


        If autoit has a timer function, use that.

        Comment


        • #5
          Originally posted by pierrotm777 View Post
          Hi Sonicxtacy . do you have a little exemple .

          Can you to modify my code please ?

          Thanks

          Pierre
          i'm very rusty with auto it but something like

          Code:
          while 1
          	if $rr.GetInfo("GPSSPD") <> $speedStr or $rr.GetInfo("GPSHDG") <> $headingStr or $rr.GetInfo("GPSLAT") <> $latStr or $rr.GetInfo("GPSLON") <> $lonStr Then
          		;perform your function
          		$speedStr = $rr.GetInfo("GPSSPD")
          		$headingStr = $rr.GetInfo("GPSHDG")
          		$latStr = $rr.GetInfo("GPSLAT")
          		$lonStr = $rr.GetInfo("GPSLON")
          	endif
          	sleep(1000)
          wend
          this is a simple method. The only problem lies int he fact that you may tax RR by updating this information every second...even though i added a prevention that will only request info if the info has changed. I'm sure someone else could come up with a more complexed way to handle it


          Originally posted by Enforcer View Post
          Nooooooooooooooooooo!


          If autoit has a timer function, use that.
          no timer function (that i know of) in autoit.. way to simple a "language"
          mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
          Follow Me on Twitter or Facebook
          Live mp3Car Facebook Chat

          Comment


          • #6
            Here try this, I have modified it a little bit...

            [EDIT]

            Revised code posted below.
            RideRunner...The #1 FE, PERIOD.

            Current Project: DFXVoice [v1.0 Released]
            Next in line: RRMedia v2.0

            DFX 5.1.1 Skin
            Appstore Link

            My RideRunner Plugins
            RRMedia
            RRExtended
            DFXVoice

            "There are no bugs - only undocumented features."

            Comment


            • #7
              Originally posted by sonic
              no timer function (that i know of) in autoit.. way to simple a "language"
              Even though I have never used them, there are UDF's that allow creation of timers, but my guess would be that its abit over his current abilities...
              RideRunner...The #1 FE, PERIOD.

              Current Project: DFXVoice [v1.0 Released]
              Next in line: RRMedia v2.0

              DFX 5.1.1 Skin
              Appstore Link

              My RideRunner Plugins
              RRMedia
              RRExtended
              DFXVoice

              "There are no bugs - only undocumented features."

              Comment


              • #8
                sure is over mine.. i struggled to make what i posted
                mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
                Follow Me on Twitter or Facebook
                Live mp3Car Facebook Chat

                Comment


                • #9
                  Dont really need a timer just add a sleep(1000) in between you loop. This will pause your script for 1 second or 1000 milliseconds.
                  New Age Garmin - Skin for RR
                  New Age Slider - RR SKin In Progress
                  "It's called CODE because I don't want you to know"

                  Comment


                  • #10
                    Thanks

                    Thanks all guys for your exemple .

                    Blue Zx3 , I had added If $tmp[0] = 4 Then ,
                    but the program don't run .

                    SonicxTacy02, your code don't run but, it is important to test all variables .
                    if $rr.GetInfo("GPSSPD") <> $speedStr or $rr.GetInfo("GPSHDG") <> $headingStr or $rr.GetInfo("GPSLAT") <> $latStr or $rr.GetInfo("GPSLON") <> $lonStr Then


                    I had tried this code who run well but after 1 minute, the variables are not updated .

                    #include <GUIConstantsEx.au3>

                    Dim $Time
                    $tempo = 1000 ; Mets ici la frequence de rafraichissement en Ms

                    ;Test existance RideRunner
                    $rr = "NIL"
                    $F = WinExists("RideRunner")
                    If $F = 0 Then MsgBox(0, "Error", "Ride Runner doit fonctionner pour que Speedlimit démarre", 5)
                    If $F = 1 Then
                    $rr = ObjCreate("RideRunner.SDK")
                    EndIf


                    #Region ### START Koda GUI section ###
                    $Form1 = GUICreate("RRGetInfo V1.0", 568, 353, -1, -1)
                    $label1 = GUICtrlCreateLabel("La vitesse est de :" & $rr.GetInfo("GPSSPD"), 16, 40, 400, 20)
                    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
                    $label2 = GUICtrlCreateLabel("La Latitude de : " & $rr.getinfo("GPSLAT"), 16, 80, 400, 20)
                    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
                    $label3 = GUICtrlCreateLabel("La Longitude est de : " & $rr.getinfo("GPSLON"), 16, 120, 400, 20)
                    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
                    $label4 = GUICtrlCreateLabel("Le nombre de GPS est de : " & $rr.getinfo("GPSHDG"), 16, 160, 400, 20)
                    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
                    ;$label5 = GUICtrlCreateLabel("Temps passé: " & $rr.getinfo("TIME"), 300, 30, 300, 40)
                    $label5 = GUICtrlCreateLabel("Temps passé: " & $Time&" 0s", 300, 30, 300, 40)
                    GUICtrlSetFont(-1, 20, 800, 0, "MS Sans Serif")
                    $Annuler = GUICtrlCreateButton("Annuler", 480, 296, 75, 25)
                    $MAJ = GUICtrlCreateButton("Get", 480, 200, 75, 25)
                    $OK = GUICtrlCreateButton("OK", 392, 296, 75, 25)
                    GUISetState(@SW_SHOW)
                    #EndRegion ### END Koda GUI section ###
                    AdlibEnable("GetRide", $tempo)

                    While 1 ; Boucle de message (voir la section création d'une GUI pour comprendre le fonctionnement)
                    $nMsg = GUIGetMsg()
                    Switch $nMsg
                    Case $GUI_EVENT_CLOSE, $Annuler ; Si la fenêtre est fermée ou si le bouton annulé est cliqué.
                    Exit
                    ; on attribue ca valeur au champ de l'input.

                    Case $OK ; Si le bouton OK à été cliqué.
                    GUICtrlRead($label1) ; On lit la variable GPSSPD issue de RideRunner
                    GUIDelete($Form1) ; Efface la GUI

                    Case $MAJ
                    GetRide()
                    EndSwitch
                    WEnd
                    AdlibDisable()


                    Func GetRide()

                    If IsObj($rr) Then
                    GuiCtrlSetData($label1, "La vitesse est de :" &$rr.GetInfo("GPSSPD"))
                    GuiCtrlSetData($label2, "La Latitude de : " &$rr.getinfo("GPSLAT"))
                    GuiCtrlSetData($label3, "La Longitude est de : " &$rr.getinfo("GPSLON"))
                    GuiCtrlSetData($label4, "Le nombre de GPS est de : " &$rr.getinfo("GPSHDG"))
                    GuiCtrlSetData($label5, "Temps passé: " & $Time &" s")
                    If $rr.GetInfo("GPSSPD") >= $rr.GetInfo("GPSSPD") Then
                    $Time = $Time + 1
                    EndIf


                    EndIf
                    EndFunc ;==>GetRide

                    That I don't understand is that RR sending Info during one minute .

                    I had doing a test with the carwing skin and added these label :
                    L,322,30,139,26,255,0,0,16,"ARIAL:B","=LATITUDE:", "LEFT"
                    L,462,30,139,26,255,0,0,16,"ARIAL:B","= ||GPSLAT","LEFT"
                    L,321,2,139,26,255,0,0,16,"ARIAL:B","=LONGITUDE:", "LEFT"
                    L,463,2,139,26,255,0,0,16,"ARIAL:B","= ||GPSLON","LEFT"


                    And after one minute too , I have no update for the latitude and the longitude .

                    Is it normal ?

                    Comment


                    • #11
                      Not to discourage new ways/ideas...but Y not just use the skintool and then just fill in the lower section and then just set to auto update? This already works and updates a 1 second intervals?
                      RideRunner...The #1 FE, PERIOD.

                      Current Project: DFXVoice [v1.0 Released]
                      Next in line: RRMedia v2.0

                      DFX 5.1.1 Skin
                      Appstore Link

                      My RideRunner Plugins
                      RRMedia
                      RRExtended
                      DFXVoice

                      "There are no bugs - only undocumented features."

                      Comment


                      • #12
                        Ok...sorry I made some really bad typo's in my above code... this should now work, I have also added an update label to show that its both working and that the currently diplayed info is most current.

                        Code:
                        #include <GUIConstantsEx.au3>
                        
                        $tempo = 1000 ; Mets ici la frequence de rafraichissement en Ms
                        
                        
                        ;Test if RideRunner
                        $rr = "NIL"
                        $F = WinExists("RideRunner")
                        If $F = 0 Then MsgBox(0, "Error", "Ride Runner doit fonctionner pour que Speedlimit démarre", 5)
                        If $F = 1 Then
                        $rr = ObjCreate("RideRunner.SDK")
                        $rr_err = ObjEvent("AutoIt.Error","MyErrFunc")    
                        EndIf
                        
                        ;Informations issues de RideRunner
                        ;~ $MySpd = $rr.GetInfo("GPSSPD")
                        ;~ $CurrentLat = $rr.getinfo("GPSLAT")
                        ;~ $CurrentLon = $rr.getinfo("GPSLON")
                        ;~ $CurrentHDG = $rr.getinfo("GPSHDG")
                        
                        ;MsgBox(0, '', $CurrentLat )
                        
                        #Region ### START Koda GUI section ###
                        $Form1 = GUICreate("RRGetInfo V1.0", 568, 353, -1, -1)
                        $label1 = GUICtrlCreateLabel("La vitesse est de :", 16, 40, 400, 20)
                        GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
                        $label2 = GUICtrlCreateLabel("La Latitude de : ", 16, 80, 400, 20)
                        GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
                        $label3 = GUICtrlCreateLabel("La Longitude est de : ", 16, 120, 400, 20)
                        GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
                        $label4 = GUICtrlCreateLabel("Le nombre de radars est de : " , 16, 160, 400, 20)
                        GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
                        $label5 = GUICtrlCreateLabel( "", 16, 200, 400, 20)
                        GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
                        
                        $Annuler = GUICtrlCreateButton("Annuler", 480, 296, 75, 25)
                        $MAJ = GUICtrlCreateButton("Get", 480, 200, 75, 25)
                        $OK = GUICtrlCreateButton("OK", 392, 296, 75, 25)
                        GUISetState(@SW_SHOW)
                        #EndRegion ### END Koda GUI section ###
                        AdlibEnable("GetRide", $tempo)
                        
                        While 1 ; Boucle de message (voir la section création d'une GUI pour comprendre le fonctionnement)
                        	$nMsg = GUIGetMsg()
                        	Switch $nMsg
                        		Case $GUI_EVENT_CLOSE, $Annuler ; Si la fenêtre est fermée ou si le bouton annulé est cliqué.
                        			Exit
                        			; on attribue ca valeur au champ de l'input.
                        
                        		Case $OK ; Si le bouton OK à été cliqué.
                        			GUICtrlRead($label1) ; On lit la variable GPSSPD issue de RideRunner
                        
                        			GUIDelete($Form1) ; Efface la GUI
                        
                        		Case $MAJ
                        			GetRide()
                        
                        	EndSwitch
                        WEnd
                        AdlibDisable()
                        
                        
                        Func GetRide()
                        	
                        	Local $tmp
                        	if WinExists("RideRunner") then
                        		$tmp = $rr.GetInfo("GPSSPD||=<M>||GPSLAT||=<M>||GPSLON||=<M>||GPSHDG")
                        		$tmp = StringSplit($tmp,"<M>",1)
                        		If $tmp[0] = 4 Then			
                        			GUICtrlSetData($Label1,"La vitesse est de :" & $tmp[1])
                        			GUICtrlSetData($Label2,"La Latitude de : " & $tmp[2])
                        			GUICtrlSetData($Label3,"La Longitude est de : " & $tmp[3])
                        			GUICtrlSetData($Label4,"Le nombre de radars est de : " & $tmp[4])
                        			GUICtrlSetData($Label5,"Updated...")
                        			sleep(350)
                        			GUICtrlSetData($Label5,"")
                        		EndIf
                        	EndIf
                        	
                        EndFunc ;==>GetRide
                        
                        
                        
                        Func MyErrFunc()
                        	;This is here to catch Object errors
                        	MsgBox(0, "Error", "Ride Runner doit fonctionner pour que Speedlimit démarre", 5)
                        	
                        Endfunc
                        RideRunner...The #1 FE, PERIOD.

                        Current Project: DFXVoice [v1.0 Released]
                        Next in line: RRMedia v2.0

                        DFX 5.1.1 Skin
                        Appstore Link

                        My RideRunner Plugins
                        RRMedia
                        RRExtended
                        DFXVoice

                        "There are no bugs - only undocumented features."

                        Comment


                        • #13
                          Originally posted by Blue ZX3 View Post
                          Not to discourage new ways/ideas...but Y not just use the skintool and then just fill in the lower section and then just set to auto update? This already works and updates a 1 second intervals?
                          Yes Blue, I have an update for each second , but after one miniute , the
                          update stop .

                          Comment


                          • #14
                            maybe using the gps sdk,

                            RideRunner.gps instead of RideRunner.sdk

                            you can even close the port and open the port
                            heres what you can do with it.

                            Code:
                            $sdk = ObjCreate("RideRunner.GPS")
                            
                            $lon = $sdk.Lon
                            
                            $lat = $sdk.Lat
                            
                            $alt = $sdk.alt
                            
                            $clients = $sdk.clients
                            
                            $hdg = $sdk.hdg
                            
                            $speed = $sdk.speed
                            
                            $sats = $sdk.sats
                            
                            $valid = $sdk.valid
                            
                             ** to close the port **
                            
                            $sdk.ClosePORT
                            
                             ** to open the port **
                            
                            $sdk.OpenPORT
                            BASSRR ==> [Audio Player/MusicDB/Cd Player/Ripper/Rate/Internet Radio/Audio Capture/Youtube Video]
                            RRTube ==> [View/Download Youtube Videos]
                            WifiMan ==> [Wifi Manager]
                            RRec ==> [Audio Capture]

                            If You Want To Be Given Everything, Give Everything Up ...
                            Bird York -- In The Deep --

                            Comment


                            • #15
                              Yes, that would work too but the way i did my revised version above...I only make one call to RR to get all the info instead of sever which is more efficient, but when only doing simple things like this won't really matter.
                              RideRunner...The #1 FE, PERIOD.

                              Current Project: DFXVoice [v1.0 Released]
                              Next in line: RRMedia v2.0

                              DFX 5.1.1 Skin
                              Appstore Link

                              My RideRunner Plugins
                              RRMedia
                              RRExtended
                              DFXVoice

                              "There are no bugs - only undocumented features."

                              Comment

                              Working...
                              X