• Hallo zusammen!

    Ich möchte euch mein neues Tool vorstellen, den 'Pinger'.
    [Blockierte Grafik: http://s1.directupload.net/images/110621/xxi8i2c3.png]

    Ich habe Ihn für meinen Kellerrechner entwickelt weil mein Router in einer anderen Etage steht und ich häufig Empfangsprobleme habe, außerdem fand ich es äußerst nervig ständig mein WLAN Stick neu auszurichten und anschliessend Manuell die Verbindung zu Checken und Pings durchzuführen, und wieder ausrichten,...
    Also startet man einfach den Pinger und kann jetzt entweder dauerhaft die WLAN-Verbindung checken lassen, oder auch ständige Ping´s durchführen lassen. ABER wenn man sein WLAN-Stick in der Hand hällt, ist meißtens schlecht mit sachen vom Monitor lesen ;) Daher habe ich auch eingebaut das die Verbindungsqualität und auch die Höhe des Pinges auf Knopfdruck von einem Ton wiedergegeben wird, je besser die Verbindung desto höher ist der Ton.

    Verwendete Includes:
    Wifi33b - by MattyD

    Den Source sowie alle benötigten Includes und dll´s findet Ihr im Dateianhang!
    Einen 'Bug' gibt es allerdings, bei PC´s mit 5.1 Sound wird der erstellte Ton iwie nur auf dem Subwoofer Kanal wiedergegeben; und man kann ihn somit nicht höhren...


    Grüsse von
    Techmix!

    Spoiler anzeigen
    [autoit]


    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <Array.au3>
    #include <Sound.au3>
    #include "include/Wifi33b.au3"
    #include "include/Bass.au3"
    #include "include/BassExt.au3"

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)
    #AutoIt3Wrapper_UseX64=n
    #AutoIt3Wrapper_UseUpx=n

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Global $_MakePing=0, $_SwitchWlan=0, $_SwitchSound=0
    Global $tWave, $h_Stream, $hFX_Chorus, $hFX_Echo, $hFX_Flanger
    Global $a_Quality[3], $_QualityTimer=0, $i_Quality=0
    Global $s_Noten = "c,2,200|d,2,200|e,2,200|f,2,200|g,2,200|a,2,200|b,2,200|c,3,200|d,3,200|e,3,200|f,3,200|g,3,200|a,3,200|b,3,200|c,4,200|d,4,200|e,4,200|f,4,200|g,4,200|a,4,200|b,4,200|c,5,200|d,5,200|e,5,200|f,5,200|g,5,200|a,5,200|b,5,200|c,6,200|d,6,200|e,6,200|f,6,200|g,6,200|a,6,200|b,6,200"

    [/autoit] [autoit][/autoit] [autoit]

    _Wlan_StartSession()

    [/autoit] [autoit][/autoit] [autoit]

    $Pinger = GUICreate("Pinger V1.1", 211, 227, 348, 231)
    $Progress1 = GUICtrlCreateProgress(152, 9, 38, 184, BitOR($PBS_SMOOTH,$PBS_VERTICAL,$WS_BORDER))
    $Button1 = GUICtrlCreateButton("Ping Start", 8, 8, 131, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("WLAN Connector Start", 8, 35, 131, 25, $WS_GROUP)
    $Button3 = GUICtrlCreateButton("Sound Aus", 8, 63, 131, 25, $WS_GROUP)
    $Label1 = GUICtrlCreateLabel("", 152, 200, 38, 17, BitOR($SS_CENTER,$WS_BORDER))
    $Edit1 = GUICtrlCreateEdit(" 2012 by Techmix", 8, 92, 131, 125, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUICtrlSetOnEvent($Button1, "_SwitchPing")
    GUICtrlSetOnEvent($Button2, "_SwitchWlan")
    GUICtrlSetOnEvent($Button3, "_SwitchSound")

    [/autoit] [autoit][/autoit] [autoit]

    while 1
    if $_MakePing=1 then _MakePing()

    [/autoit] [autoit][/autoit] [autoit]

    if $_SwitchWlan=1 then _MakeWLAN()

    [/autoit] [autoit][/autoit] [autoit]

    if $_SwitchSound=1 then _MakeSound()

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(10)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _MakePing()
    Local $time = Ping('www.google.de', 1000)
    if $time > 1000 then $time = 1000
    $dat = GUICtrlRead($Edit1)
    GUICtrlSetData($Edit1, $dat&"Ping: "&$time&"ms"&@CRLF)
    GUICtrlSetData($Label1, $time)

    [/autoit] [autoit][/autoit] [autoit]

    $a_Quality[$_QualityTimer] = 100-$time/10
    $_QualityTimer+=1
    if $_QualityTimer = UBound($a_Quality) then $_QualityTimer = 0
    dim $_Count=0, $i_Quality=0
    for $i=0 to UBound($a_Quality)-1
    $i_Quality += $a_Quality[$i]
    if $a_Quality[$i] <> "" or $a_Quality[$i] > 0 then $_Count+=1
    Next
    $i_Quality = int($i_Quality/$_Count)

    [/autoit] [autoit][/autoit] [autoit]

    if $time < 0 then $time = 0
    if $time > 0 then
    GUICtrlSetData($Progress1, $i_Quality)
    Else
    GUICtrlSetData($Progress1, 0)
    EndIf
    EndFunc
    Func _MakeWLAN()
    _Wlan_Scan(-1, -1)
    Local $time, $avNetworks = _Wlan_GetAvailableNetworkList(-1, -1, 0)
    for $i = 0 to UBound($avNetworks)-1
    if $avNetworks[$i][6] = "Connected" then $time = $avNetworks[$i][3]
    next
    $dat = GUICtrlRead($Edit1)
    GUICtrlSetData($Edit1, $dat&"Connectivity: "&$time&"%"&@CRLF)
    GUICtrlSetData($Label1, $time&"%")

    [/autoit] [autoit][/autoit] [autoit]

    $a_Quality[$_QualityTimer] = 100-$time
    $_QualityTimer+=1
    if $_QualityTimer = UBound($a_Quality) then $_QualityTimer = 0
    dim $_Count=0, $i_Quality=0
    for $i=0 to UBound($a_Quality)-1
    $i_Quality += $a_Quality[$i]
    if $a_Quality[$i] <> "" or $a_Quality[$i] > 0 then $_Count+=1
    Next
    $i_Quality = int($i_Quality/$_Count)

    [/autoit] [autoit][/autoit] [autoit]

    if $time < 0 then $time = 0
    if $time > 0 then
    GUICtrlSetData($Progress1, $i_Quality)
    Else
    GUICtrlSetData($Progress1, 0)
    EndIf
    EndFunc
    Func _MakeSound()
    Local $time=GUICtrlRead($Progress1)
    if $time < 1 then $time = 1

    [/autoit] [autoit][/autoit] [autoit]

    Local $aSplit, $iNR, $aRegexp, $sNote, $iOctave, $iDuration, $bData
    $aSplit = StringSplit($s_Noten, "|")
    $iNR = int(($aSplit[0] / 101) * $time)+1
    $aRegexp = StringRegExp($aSplit[$iNR], "([^,]+),([^,]*),(.*)", 3)
    $sNote = $aRegexp[0]
    $iOctave = $aRegexp[1]
    $iDuration = $aRegexp[2]
    $bData = _BASS_EXT_Generator("triangle", _BASS_EXT_Note2Freq($sNote, $iOctave), $iDuration, 0.7)

    [/autoit] [autoit][/autoit] [autoit]

    _BASS_StreamFree($h_Stream)
    $tWave = _BASS_EXT_MakeWave($bData, 44100, 1)
    $h_Stream = _BASS_StreamCreateFile(True, DllStructGetPtr($tWave), 0, DllStructGetData($tWave, "Len"), 0)
    $hFX_Chorus = _BASS_ChannelSetFX($h_Stream, $BASS_FX_DX8_CHORUS, 5)
    $hFX_Echo = _BASS_ChannelSetFX($h_Stream, $BASS_FX_DX8_ECHO, 10)
    _BASS_FXSetParameters($hFX_Echo, "25|30|750|500|True")
    $hFX_Flanger = _BASS_ChannelSetFX($h_Stream, $BASS_FX_DX8_FLANGER, 15)
    _BASS_ChannelPlay($h_Stream, True)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _SwitchPing()
    if $_SwitchSound = 1 then _SwitchSound()
    $_MakePing=1-$_MakePing
    if $_MakePing = 0 then
    for $i=0 to UBound($a_Quality)-1
    $a_Quality[$i] = ""
    Next
    GUICtrlSetData($Button1, "Ping Start")
    GUICtrlSetState($Button2, $GUI_ENABLE)
    Else
    GUICtrlSetData($Edit1, "")
    GUICtrlSetData($Button1, "Ping Stop")
    GUICtrlSetState($Button2, $GUI_DISABLE)
    EndIf
    EndFunc
    Func _SwitchWlan()
    if $_SwitchSound = 1 then _SwitchSound()
    $_SwitchWlan=1-$_SwitchWlan
    if $_SwitchWlan = 0 then
    for $i=0 to UBound($a_Quality)-1
    $a_Quality[$i] = ""
    Next
    GUICtrlSetData($Button2, "WLAN Connector Start")
    GUICtrlSetState($Button1, $GUI_ENABLE)
    Else
    GUICtrlSetData($Edit1, "")
    GUICtrlSetData($Button2, "WLAN Connector Stop")
    GUICtrlSetState($Button1, $GUI_DISABLE)
    EndIf
    EndFunc
    Func _SwitchSound()
    if $_MakePing = 1 or $_SwitchWlan = 1 then
    $_SwitchSound=1-$_SwitchSound
    if $_SwitchSound = 0 then
    _BASS_ChannelStop($h_Stream)
    _BASS_StreamFree($h_Stream)
    _BASS_Free()
    GUICtrlSetData($Button3, "Sound An")
    Else
    _BASS_Startup()
    _BASS_EXT_Startup()
    _BASS_Init(0, -1, 44100, 0, "")
    GUICtrlSetData($Button3, "Sound Aus")
    EndIf
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _SwitchSound()
    _Wlan_EndSession(-1)
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    [Update auf V1.0]
    Der Sound wird jetzt automatisch gestoppt, wenn nichts mehr getestet wird.
    Damit die Tonhöhe nicht allzu Sprunghaft geändert wird, wird ein zwischenwert aus den letzten 3 Ergebnissen errechnet.

    [Update auf V1.1]
    Der Ton ist nicht mehr so Grausamm, habe Ihn jetzt anders erstellt.
    Die 'Ping' Funktion Arbeitet jetzt auch deutlich schneller.