[..] Compter des érreurs par adresse MAC

Aide sur les Interfaces Graphique Utilisateurs (GUI).
Règles du forum
.
Répondre
Avatar du membre
Anthony
Niveau 6
Niveau 6
Messages : 204
Enregistré le : lun. 17 janv. 2011 14:08
Localisation : France
Contact :
Status : Hors ligne

[..] Compter des érreurs par adresse MAC

#1

Message par Anthony » jeu. 06 oct. 2016 22:24

Bonjour à tous,

Je souhaiterai associer le nombre d'erreurs par adresse MAC dans la colonne "Erreurs" ("Listbox" dans le code) sauf que là je sèche...
Je pensais que ce serait simple mais faut croire que non :shock: ou alors l'idée n'est pas là et je pars sur une mauvaise voie.
Pouvez vous m'apporter votre expérience, des jours que je sèche ? :cry:
Merci d'avance :wink:

Fichier Log à glisser dans GUICtrlCreateInput 2016-10-05 - 16h30.154 => https://mega.nz/#!HJ9Q3K7Z!76vXpbYMk0_7 ... ZDFZUQSlz8

Image

Code : Tout sélectionner

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         

 Script Function:
	ZigBee Data Request.

#ce ----------------------------------------------------------------------------

#include <File.au3>
#include <Array.au3>
;~ #include <GuiListBox.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#NoTrayIcon
Opt("TrayIconHide", 1)

Local $AddOnsVersion	= "0.0.0.1"
Local $ParentTitle		= "ZigBee Data Request" &" v"& $AddOnsVersion 

Local $ParentHandle		= GUICreate($ParentTitle, 840, 285, Default, Default, -1, $WS_EX_ACCEPTFILES)
Local $Drag			= GUICtrlCreateInput(" [ Déposez le fichier .154 ici ]", 5, 260, 705, 21)
					GUICtrlSetState($Drag, $GUI_DROPACCEPTED)

GUICtrlCreateLabel("Adresse(s) MAC", 10, 8)
GUICtrlCreateLabel("Adresse(s) MAC ZigBee en défaut", 270, 8)

Local $ListBox			= GUICtrlCreateListView("MAC                               |ID   |Erreurs", 5, 30, 240, 225, $LVS_SHOWSELALWAYS)
Local $ZigBee			= GUICtrlCreateListView("ID  |Adresse MAC|Ligne|Ligne complète|nombre d'erreurs", 250, 30, 585, 225, $LVS_SHOWSELALWAYS)


Local $idBtn			= GUICtrlCreateButton("Lancer la recherche", 715, 260, 120, 20)

GUISetState(@SW_SHOW)

Func _Start()
   GUICtrlSetState($idBtn, $GUI_DISABLE)
   Global $Erreur = "", $k = "", $Data_request = ""
   Global $String_ListBox_Mem = "", $Lines_Mem = ""
   Global $String_ZigBee_Mem = ""
   
   _GUICtrlListView_DeleteAllItems($ListBox)
   GUISetState()
   _GUICtrlListView_DeleteAllItems($ZigBee)
   GUISetState()

   $File				= GUICtrlRead($Drag)
   $Read				= FileRead($File)
   $Read				= StringReplace($Read, @CRLF, "|")
   
   $Lines				= StringSplit($Read, "|")
   $FileCountLines		= $Lines[0]
   For $i = 1 To $FileCountLines
;~ 	  If $GUI_EVENT_CLOSE = GUIGetMsg() Then Exit
	  WinSetTitle($ParentHandle, "", $ParentTitle &" - 1/2 Recherche MAC et ID "& $i & "/" & $FileCountLines)
	  _Search_MAC_Adress($i, $Lines[$i])
   Next

   $MACs				= StringSplit($String_ListBox_Mem, "~")
   $MACsCountLines		= $MACs[0]

   For $i = 1 To $FileCountLines
;~ 	  If $GUI_EVENT_CLOSE = GUIGetMsg() Then Exit
	  WinSetTitle($ParentHandle, "", $ParentTitle &" - 2/2 Associe ID et MAC "& $i & "/" & $FileCountLines)
	  $Lines_Mem			= $Lines_Mem & $Lines[$i] & "~"
	  If $i > 3 Then
		 $Lines_Mem_Array	= StringSplit($Lines_Mem, "~")
		 $Lines_Mem			= StringTrimLeft($Lines_Mem, StringInStr($Lines_Mem , "~"))
		 
		 $Line				= $Lines_Mem_Array[1]
		 $Line1				= StringMid($Line, 20, 2)					; $Line1 0C
		 $Line2				= StringMid($Lines_Mem_Array[2], 20, 2)		; $Line2 05
		 $Line3				= StringMid($Lines_Mem_Array[3], 20, 2)		; $Line3 0C
		 $Line4				= StringMid($Lines_Mem_Array[4], 20, 2)		; $Line4 05
		 
		 $ID1				= StringMid($Line, 44, 5)					; ex: 34,14
		 $ID2				= StringMid($Lines_Mem_Array[2], 44, 5)		; ex: 34,14
		 $ID3				= StringMid($Lines_Mem_Array[3], 44, 5)		; ex: 34,14
		 $ID4				= StringMid($Lines_Mem_Array[4], 44, 5)		; ex: 34,14

		 If $Line1 = "0C" And $Line2 = "05" And $Line3 = "0C" And $Line4 = "05" And $Line1 = $Line3 And $Line2 = $Line4 And $ID1 = $ID3 And $ID2 = $ID4 Then
;~ 			ConsoleWrite($i-2 &" IDs "&$ID1&"="&$ID3&" Lines "&$Line1&"="&$Line3 &@CRLF)
			_Associate_ID_With_MAC_Adress($i-2, $Line, $MACsCountLines, $MACs)
		 EndIf
	  EndIf
   Next
   WinSetTitle($ParentHandle, "", $ParentTitle &" - terminé, "&$FileCountLines&" traitements éffectués")
   GUICtrlSetState($idBtn, $GUI_ENABLE)
EndFunc

Func _Search_MAC_Adress($i, $line)
   If StringMid($line, 20, 8) = "1B,63,CC" And StringMid($line, 53, 8) = "4F,15,00" Then	; Cherche l'adresse MAC
	  $MAC				= 0
	  $MAC				= StringSplit(StringMid($line, 38, 23), ",")
	  _ArrayReverse($MAC)
	  $MAC_Adress		= ""
	  For $j			= 0 To 7
		 $MAC_Adress	= $MAC_Adress & $MAC[$j]
	  Next
	  $ID = 0
	  $ID = StringSplit(StringMid($line, 89, 5), ",")
	  _ArrayReverse($ID)
	  $ID_Src			= ""
	  For $j			= 0 To 1
		 $ID_Src		= $ID_Src & $ID[$j]
	  Next

	  $MAC_Adress		= StringRegExpReplace($MAC_Adress, "..\K(?!$)", ":")
	  $ID_Src			= StringRegExpReplace($ID_Src, "..\K(?!$)", ":")	;	& " ("&StringMid($line, 44, 5)&") "
	  $String			= $MAC_Adress & "|" & $ID_Src

	  If Not StringInStr($String_ListBox_Mem, $String) Then
		 $String_ListBox_Mem	= $String_ListBox_Mem & $String & "|~"
		 GUICtrlCreateListViewItem($String, $ListBox)
	  $k				= $k+1
;~ 	  ConsoleWrite("$k "& $k & @CRLF)
	  EndIf
   EndIf	; Cherche l'adresse MAC
EndFunc

Func _Associate_ID_With_MAC_Adress($i, $Line, $MACsCountLines, $MACs)
;~ 	  0x01       Association request(Tx)
;~ 	  0x02       Association response(Rx)
;~ 	  0x03       Disassociation notification(Tx,Rx)
;~ 	  0x04       Data request(Tx)
;~ 	  0x05       PAN ID conflict notification(Tx)
;~ 	  0x06       Orphan notification(Tx)
;~ 	  0x07       Beacon request(Tx)
;~ 	  0x08       coordinator realignment(Rx)
;~ 	  0x09       GTS Request
;~ 	  0x0a-0xFF  Reserved

;~    If StringMid($line, 50, 2) = "04" And StringLen($line) = "57" Then	; Cherche l'ID : 0x04       Data request(Tx)
;~ 	  ConsoleWrite(StringLen($line) &" "& $Erreur &" Data request" & $Line & @CRLF)	; StringLen = 36

		 $ID				= 0
		 $ID				= StringSplit(StringMid($line, 44, 5), ",")			;	31/14
		 _ArrayReverse($ID)														;	14/31
		 $ID_Src			= ""
		 For $j				= 0 To 1
			$ID_Src			= $ID_Src & $ID[$j]									;	1431
		 Next
		 $ID_Src			= StringRegExpReplace($ID_Src, "..\K(?!$)", ":")	;	14:31

		 For $j			= 1 To $MACsCountLines-1

			$Split			= StringSplit($MACs[$j], "|")
;~ 		 	ConsoleWrite($Split[2] & @CRLF)
			If $Split[2]	= $ID_Src Then
			   $Erreur		= $Erreur +1
			   $MAC_Adress	= $Split[1]
			   $ID			= $Split[2]
			   $String		= $ID & "|" & $MAC_Adress & "|" & $i & "|" & $Line & "|" & $Erreur
;~ 				ConsoleWrite($String & @CRLF)
			   GUICtrlCreateListViewItem($String, $ZigBee)
			EndIf
		 Next
EndFunc



;~    ConsoleWrite($file)
While 1
   $msg  = GUIGetMsg()
;~    ConsoleWrite($msg)
   Select
	  Case $msg = $GUI_EVENT_CLOSE
		 GUIDelete()
		 Exit
	  Case $msg = $idBtn or $msg = -13	;	_Start
		 _Start()
   EndSelect
   Sleep(25)
WEnd
Modifié en dernier par Anthony le dim. 09 oct. 2016 20:49, modifié 1 fois.
J'ai été diagnostiqué pour trouble de la concentration, soyez indulgent
Merci à tous pour votre aide.
http://webfreesoftware.net Les Logiciels Gratuits

Avatar du membre
Anthony
Niveau 6
Niveau 6
Messages : 204
Enregistré le : lun. 17 janv. 2011 14:08
Localisation : France
Contact :
Status : Hors ligne

Re: [..] Compter des érreurs par adresse MAC

#2

Message par Anthony » dim. 09 oct. 2016 20:47

Une idée :(

Mon code actuel :|

Code : Tout sélectionner

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         

 Script Function:
	ZigBee Data Request.

#ce ----------------------------------------------------------------------------

;~ #RequireAdmin

#include <Date.au3>
#include <File.au3>
#include <Array.au3>
;~ #include <GuiListBox.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#NoTrayIcon
Opt("TrayIconHide", 1)

Local $AddOnsVersion	= "0.0.0.1"
Local $ParentTitle		= "ZigBee Data Request" &" v"& $AddOnsVersion

Local $ParentHandle		= GUICreate($ParentTitle, 840, 285, Default, Default, -1, $WS_EX_ACCEPTFILES)
Local $Drag				= GUICtrlCreateInput(" [ Déposez le fichier .154 ici ]", 5, 260, 705, 21)
						GUICtrlSetState($Drag, $GUI_DROPACCEPTED)

GUICtrlCreateLabel("Adresse(s) MAC", 10, 8)
GUICtrlCreateLabel("Adresse(s) MAC ZigBee en Data Request", 270, 8)

Local $ListBox			= GUICtrlCreateListView("MAC                               |ID   |Erreurs", 5, 30, 240, 225, $LVS_SHOWSELALWAYS)
Local $ZigBee			= GUICtrlCreateListView("ID  |Adresse MAC|Ligne|Ligne complète|nombre d'erreurs", 250, 30, 585, 225, $LVS_SHOWSELALWAYS)


Local $idBtn			= GUICtrlCreateButton("Lancer la recherche", 715, 260, 120, 20)

GUISetState(@SW_SHOW)

Func _Start()
   $_NowCalc = _NowCalc()

   GUICtrlSetState($idBtn, $GUI_DISABLE)
   Global $Erreur = "", $k = "", $Data_request = ""
   Global $String_ListBox_Mem = "", $Lines_Mem = ""
   Global $String_ZigBee_Mem = "", $SetColumnWidth = ""
   
   _GUICtrlListView_DeleteAllItems($ListBox)
   GUISetState()
   _GUICtrlListView_DeleteAllItems($ZigBee)
   GUISetState()

   $File				= GUICtrlRead($Drag)
   $Read				= FileRead($File)
   $Read				= StringReplace($Read, @CRLF, "|")
   
   $Lines				= StringSplit($Read, "|")
   $FileCountLines		= $Lines[0]
   ; ===========================================
   For $i = 1 To $FileCountLines
;~ 	  If $GUI_EVENT_CLOSE = GUIGetMsg() Then Exit
	  WinSetTitle($ParentHandle, "", $ParentTitle &" - 1/2 Recherche MAC et ID "& $i & "/" & $FileCountLines)
	  _Search_MAC_Adress($i, $Lines[$i])
   Next
   ; ===========================================
   $MACs				= StringSplit($String_ListBox_Mem, "~")
   $MACsCountLines		= $MACs[0]
;~    ConsoleWrite($MACs[0]&@CRLF)

   For $i = 1 To $FileCountLines
;~ 	  If $GUI_EVENT_CLOSE = GUIGetMsg() Then Exit
	  WinSetTitle($ParentHandle, "", $ParentTitle &" - 2/2 Associe ID et MAC "& $i & "/" & $FileCountLines)
	  $Lines_Mem			= $Lines_Mem & $Lines[$i] & "~"
	  If $i > 3 Then
		 $Lines_Mem_Array	= StringSplit($Lines_Mem, "~")
		 $Lines_Mem			= StringTrimLeft($Lines_Mem, StringInStr($Lines_Mem , "~"))
		 
		 $Line				= $Lines_Mem_Array[1]
		 $Line1				= StringMid($Line, 20, 2)																; $Line1 0C
		 $Line2				= StringMid($Lines_Mem_Array[2], 20, 2)													; $Line2 05
		 $Line3				= StringMid($Lines_Mem_Array[3], 20, 2)													; $Line3 0C
		 $Line4				= StringMid($Lines_Mem_Array[4], 20, 2)													; $Line4 05

		 $ID1				= StringMid($line, 47, 2) &":"& StringMid($line, 44, 2)
		 $ID2				= StringMid($Lines_Mem_Array[2], 47, 2) &":"& StringMid($Lines_Mem_Array[2], 44, 2)		; ex: 34,14
		 $ID3				= StringMid($Lines_Mem_Array[3], 47, 2) &":"& StringMid($Lines_Mem_Array[3], 44, 2)		; ex: 34,14
		 $ID4				= StringMid($Lines_Mem_Array[4], 47, 2) &":"& StringMid($Lines_Mem_Array[4], 44, 2)		; ex: 34,14

;~ 		 If $MAC_Adress And $Line1 = "0C" And $Line2 = "05" And $Line1 = $Line3 And $Line2 = $Line4 And $ID1 = $ID3 And $ID2 = $ID4 Then
		 If $Line1 = "0C" And $Line2 = "05" And $Line1 = $Line3 And $Line2 = $Line4 And $ID1 = $ID3 And $ID2 = $ID4 Then
			
			_Associate_ID_With_MAC_Adress($i-2, $Line, $MACsCountLines, $MACs)
			If Not $SetColumnWidth Then
			   $SetColumnWidth = 1
			   _GUICtrlListView_SetColumnWidth($ZigBee, 3, $LVSCW_AUTOSIZE_USEHEADER)
			EndIf
			
;~ 		 ElseIf $MAC_Adress Then
			
;~ 			$String			= $ID1 & "|" & "??:??:??:??:??:??:??:??" & "|" & $i-2 & "|" & $Line & "|" & $Erreur
;~ 			GUICtrlCreateListViewItem($String, $ZigBee)
			
		 EndIf
		 
	  EndIf
	  
   Next
   $DateDiff		= _DateDiff('s', $_NowCalc, _NowCalc())
   $TimeDiff		= StringFormat("%02ih%02im%02isec", Floor($DateDiff / 60 ^ 2), Mod($DateDiff / 60, 60), Mod($DateDiff, 60))
   WinSetTitle($ParentHandle, "", $ParentTitle &" - terminé, "&$FileCountLines&" traitements en "&$TimeDiff)
   GUICtrlSetState($idBtn, $GUI_ENABLE)
EndFunc

Func _Search_MAC_Adress($i, $line)
   If StringMid($line, 20, 8) = "1B,63,CC" And StringMid($line, 53, 8) = "4F,15,00" Then	; Cherche l'adresse MAC
	  
	  $MAC_Adress		= StringMid($line, 59, 2)&":"&StringMid($line, 56, 2)&":"&StringMid($line, 53, 2)&":"&StringMid($line, 50, 2)&":"&StringMid($line, 47, 2)&":"&StringMid($line, 44, 2)&":"&StringMid($line, 41, 2)&":"&StringMid($line, 38, 2)
	  $ID_Src			= StringMid($line, 92, 2) &":"& StringMid($line, 89, 2)
	  $String			= $MAC_Adress & "|" & $ID_Src

	  If Not StringInStr($String_ListBox_Mem, $String) Then
		 $String_ListBox_Mem	= $String_ListBox_Mem & $String & "|~"
		 GUICtrlCreateListViewItem($String, $ListBox)
	  EndIf
	  
   EndIf	; Cherche l'adresse MAC
EndFunc

Func _Associate_ID_With_MAC_Adress($i, $Line, $MACsCountLines, $MACs)
;~ 	  0x01       Association request(Tx)
;~ 	  0x02       Association response(Rx)
;~ 	  0x03       Disassociation notification(Tx,Rx)
;~ 	  0x04       Data request(Tx)
;~ 	  0x05       PAN ID conflict notification(Tx)
;~ 	  0x06       Orphan notification(Tx)
;~ 	  0x07       Beacon request(Tx)
;~ 	  0x08       coordinator realignment(Rx)
;~ 	  0x09       GTS Request
;~ 	  0x0a-0xFF  Reserved

;~    If StringMid($line, 50, 2) = "04" And StringLen($line) = "57" Then	; Cherche l'ID : 0x04       Data request(Tx)
;~ 	  ConsoleWrite(StringLen($line) &" "& $Erreur &" Data request" & $Line & @CRLF)	; StringLen = 36

		 $ID_Src			= StringMid($line, 47, 2) &":"& StringMid($line, 44, 2)
		 ConsoleWrite($ID_Src & @CRLF)

		 For $j				= 1 To $MACsCountLines-1

			$Split			= StringSplit($MACs[$j], "|")
;~ 		 	ConsoleWrite($Split[2] & @CRLF)
			If $Split[2]	= $ID_Src Then
			   $Erreur		= $Erreur +1	; Nombre d'érreurs
			   $MAC_Adress	= $Split[1]
			   $ID			= $Split[2]
			   $String		= $ID & "|" & $MAC_Adress & "|" & $i & "|" & $Line & "|" & $Erreur
;~ 				ConsoleWrite($String & @CRLF)
			   GUICtrlCreateListViewItem($String, $ZigBee)
			EndIf
		 Next
EndFunc



;~    ConsoleWrite($file)
While 1
   $msg  = GUIGetMsg()
;~    ConsoleWrite($msg)
   Select
	  Case $msg = $GUI_EVENT_CLOSE
		 GUIDelete()
		 Exit
	  Case $msg = $idBtn or $msg = -13	;	_Start
		 _Start()
   EndSelect
   Sleep(25)
WEnd
Merci à tous...
J'ai été diagnostiqué pour trouble de la concentration, soyez indulgent
Merci à tous pour votre aide.
http://webfreesoftware.net Les Logiciels Gratuits

Avatar du membre
Anthony
Niveau 6
Niveau 6
Messages : 204
Enregistré le : lun. 17 janv. 2011 14:08
Localisation : France
Contact :
Status : Hors ligne

Re: [..] Compter des érreurs par adresse MAC

#3

Message par Anthony » lun. 10 oct. 2016 01:58

Bon j'y suis arrivé... :D
Maintenant je vais dodo :shock:
Si çà peut aider quelqu'un voilà... moi :mrgreen:

Code : Tout sélectionner

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         

 Script Function:
	ZigBee Data Request.

#ce ----------------------------------------------------------------------------

;~ #RequireAdmin

#include <Date.au3>
#include <File.au3>
#include <Array.au3>
;~ #include <GuiListBox.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#NoTrayIcon
Opt("TrayIconHide", 1)

Local $AddOnsVersion	= "0.0.0.1"
Local $ParentTitle		= "ZigBee Data Request" &" v"& $AddOnsVersion 

Local $ParentHandle		= GUICreate($ParentTitle, 840, 285, Default, Default, -1, $WS_EX_ACCEPTFILES)
Local $Drag				= GUICtrlCreateInput(" [ Déposez le fichier .154 ici ]", 5, 260, 705, 21)
						GUICtrlSetState($Drag, $GUI_DROPACCEPTED)

Local $ListBox			= GUICtrlCreateListView("Erreurs|MAC                               |ID   ", 5, 5, 240, 250, $LVS_SHOWSELALWAYS)
Local $ZigBee			= GUICtrlCreateListView("ID  |Adresse MAC|Ligne|Ligne complète|nombre d'erreurs", 250, 5, 585, 250, $LVS_SHOWSELALWAYS)


Local $idBtn			= GUICtrlCreateButton("Lancer la recherche", 715, 260, 120, 20)

GUISetState(@SW_SHOW)

Func _Start()
   $_NowCalc = _NowCalc()

   GUICtrlSetState($idBtn, $GUI_DISABLE)
   GUICtrlSetState($Drag, $GUI_DISABLE)
   Global $Erreur = "", $k = "", $Data_request = ""
   Global $String_ListBox_Mem = "", $Lines_Mem = ""
   Global $String_ZigBee_Mem = "", $SetColumnWidth = "", $iCount
   
   _GUICtrlListView_DeleteAllItems($ListBox)
   GUISetState()
   _GUICtrlListView_DeleteAllItems($ZigBee)
   GUISetState()

   $File				= GUICtrlRead($Drag)
   $Read				= FileRead($File)
   $Read				= StringReplace($Read, @CRLF, "|")
   
   $Lines				= StringSplit($Read, "|")
   $FileCountLines		= $Lines[0]
   ; ===========================================
   For $i = 1 To $FileCountLines
;~ 	  If $GUI_EVENT_CLOSE = GUIGetMsg() Then Exit
	  WinSetTitle($ParentHandle, "", $ParentTitle &" - 1/2 Recherche MAC et ID "& $i & "/" & $FileCountLines)
	  _Search_MAC_Adress($i, $Lines[$i])
   Next
   ; ===========================================
   $MACs				= StringSplit($String_ListBox_Mem, "~")
   $MACsCountLines		= $MACs[0]
;~    ConsoleWrite($MACs[0]&@CRLF)

   For $i = 1 To $FileCountLines
;~ 	  $GUIGetMsg			= GUIGetMsg()
;~ 	  Sleep(1)
;~ 	  If $GUIGetMsg = $GUI_EVENT_CLOSE Then Exit
	  WinSetTitle($ParentHandle, "", $ParentTitle &" - 2/2 Associe ID et MAC "& $i & "/" & $FileCountLines)
	  $Lines_Mem			= $Lines_Mem & $Lines[$i] & "~"
	  If $i > 3 Then
		 $Lines_Mem_Array	= StringSplit($Lines_Mem, "~")
		 $Lines_Mem			= StringTrimLeft($Lines_Mem, StringInStr($Lines_Mem , "~"))
		 
		 $Line				= $Lines_Mem_Array[1]
		 $Line1				= StringMid($Line, 20, 2)																; $Line1 0C
		 $Line2				= StringMid($Lines_Mem_Array[2], 20, 2)													; $Line2 05
		 $Line3				= StringMid($Lines_Mem_Array[3], 20, 2)													; $Line3 0C
		 $Line4				= StringMid($Lines_Mem_Array[4], 20, 2)													; $Line4 05

		 $ID1				= StringMid($line, 47, 2) &":"& StringMid($line, 44, 2)
		 $ID2				= StringMid($Lines_Mem_Array[2], 47, 2) &":"& StringMid($Lines_Mem_Array[2], 44, 2)		; ex: 34,14
		 $ID3				= StringMid($Lines_Mem_Array[3], 47, 2) &":"& StringMid($Lines_Mem_Array[3], 44, 2)		; ex: 34,14
		 $ID4				= StringMid($Lines_Mem_Array[4], 47, 2) &":"& StringMid($Lines_Mem_Array[4], 44, 2)		; ex: 34,14

;~ 		 If $MAC_Adress And $Line1 = "0C" And $Line2 = "05" And $Line1 = $Line3 And $Line2 = $Line4 And $ID1 = $ID3 And $ID2 = $ID4 Then
		 If $Line1 = "0C" And $Line2 = "05" And $Line1 = $Line3 And $Line2 = $Line4 And $ID1 = $ID3 And $ID2 = $ID4 Then
			
			_Associate_ID_With_MAC_Adress($i-2, $Line, $MACsCountLines, $MACs)
			If Not $SetColumnWidth Then
			   $SetColumnWidth = 1
			   _GUICtrlListView_SetColumnWidth($ZigBee, 3, $LVSCW_AUTOSIZE_USEHEADER)
			EndIf
			
;~ 		 ElseIf $MAC_Adress Then
			
;~ 			$String			= $ID1 & "|" & "??:??:??:??:??:??:??:??" & "|" & $i-2 & "|" & $Line & "|" & $Erreur
;~ 			GUICtrlCreateListViewItem($String, $ZigBee)
			
		 EndIf
		 
	  EndIf
	  
   Next
   $DateDiff		= _DateDiff('s', $_NowCalc, _NowCalc())
   $TimeDiff		= StringFormat("%02ih%02im%02isec", Floor($DateDiff / 60 ^ 2), Mod($DateDiff / 60, 60), Mod($DateDiff, 60))
   WinSetTitle($ParentHandle, "", $ParentTitle &" - terminé, "&$FileCountLines&" traitements en "&$TimeDiff)
   GUICtrlSetState($idBtn, $GUI_ENABLE)
   GUICtrlSetState($Drag, $GUI_ENABLE)
EndFunc



Func _Search_MAC_Adress($i, $line)
   If StringMid($line, 20, 8) = "1B,63,CC" And StringMid($line, 53, 8) = "4F,15,00" Then	; Cherche l'adresse MAC
	  
	  $MAC_Adress		= StringMid($line, 59, 2)&":"&StringMid($line, 56, 2)&":"&StringMid($line, 53, 2)&":"&StringMid($line, 50, 2)&":"&StringMid($line, 47, 2)&":"&StringMid($line, 44, 2)&":"&StringMid($line, 41, 2)&":"&StringMid($line, 38, 2)
	  $ID_Src			= StringMid($line, 92, 2) &":"& StringMid($line, 89, 2)
	  $String			= $MAC_Adress & "|" & $ID_Src

	  If Not StringInStr($String_ListBox_Mem, $String) Then
		 $String_ListBox_Mem	= $String_ListBox_Mem & $String & "|~"
		 GUICtrlCreateListViewItem("|" & $String, $ListBox)
	  EndIf
	  
   EndIf	; Cherche l'adresse MAC
EndFunc



Func _Associate_ID_With_MAC_Adress($i, $Line, $MACsCountLines, $MACs)
;~ 	  0x01       Association request(Tx)
;~ 	  0x02       Association response(Rx)
;~ 	  0x03       Disassociation notification(Tx,Rx)
;~ 	  0x04       Data request(Tx)
;~ 	  0x05       PAN ID conflict notification(Tx)
;~ 	  0x06       Orphan notification(Tx)
;~ 	  0x07       Beacon request(Tx)
;~ 	  0x08       coordinator realignment(Rx)
;~ 	  0x09       GTS Request
;~ 	  0x0a-0xFF  Reserved

;~    If StringMid($line, 50, 2) = "04" And StringLen($line) = "57" Then	; Cherche l'ID : 0x04       Data request(Tx)
;~ 	  ConsoleWrite(StringLen($line) &" "& $Erreur &" Data request" & $Line & @CRLF)	; StringLen = 36

		 $ID_Src			= StringMid($line, 47, 2) &":"& StringMid($line, 44, 2)
;~ 		 ConsoleWrite($ID_Src & @CRLF)

		 For $j				= 1 To $MACsCountLines-1

			$Split			= StringSplit($MACs[$j], "|")

			If $Split[2]	= $ID_Src Then
		 	ConsoleWrite($Split[2] & @CRLF)
			   $Erreur		+= 1	; Nombre d'érreurs
			   $MAC_Adress	= $Split[1]
			   $ID			= $Split[2]
			   $String		= $ID & "|" & $MAC_Adress & "|" & $i & "|" & $Line & "|" & $Erreur
			   GUICtrlCreateListViewItem($String, $ZigBee)
			   _GUICtrlListView_SetItemText( $ListBox, $j-1,  _GUICtrlListView_GetItemText($ListBox , $j-1, 0) +1, 0)
			EndIf
		 Next
EndFunc



;~    ConsoleWrite($file)
While 1
   $msg  = GUIGetMsg()
;~    ConsoleWrite($msg)
   Select
	  Case $msg = $GUI_EVENT_CLOSE
		 GUIDelete()
		 Exit
	  Case $msg = $idBtn or $msg = -13	;	_Start
		 _Start()
   EndSelect
   Sleep(25)
WEnd
J'ai été diagnostiqué pour trouble de la concentration, soyez indulgent
Merci à tous pour votre aide.
http://webfreesoftware.net Les Logiciels Gratuits

Répondre