briques appli key



Sub WriteParam(replyCode, Buf, Rep, Replylength, RL, Adr, N)
dim CR
dim i
set CR = CreateObject("DiagLibs2.CRC")

Buf.LowIndex = 1
Buf.Count = 8 + N
Buf(1) = &H34
Buf(2) = RL
Buf(3) = (Adr \ &H10000) And &HFF
Buf(4) = (Adr \ &H100) And &HFF
Buf(5) = Adr And &HFF
Buf(6) = N
For i = 7 to N+6
Buf(i) = 0
Next

CR.Clear
CR.Append Buf.Interval(1,N+6)
CR.Send Buf

ReplyLength = 3
Rep.LowIndex = 1
' Rep.Count = 2
Rep.Count = 3
Rep(1) = &H7F
Rep(2) = &H34
Rep(3) = replyCode

End Sub


Sub WriteParamBis(replyCode, Buf, Rep, Replylength, RL, Adr, N, Length)
dim CR
dim i
set CR = CreateObject("DiagLibs2.CRC")

Buf.LowIndex = 1
Buf.Count = 8 + Length
Buf(1) = &H34
Buf(2) = RL
Buf(3) = (Adr \ &H10000) And &HFF
Buf(4) = (Adr \ &H100) And &HFF
Buf(5) = Adr And &HFF
Buf(6) = N
For i = 7 to Length+6
Buf(i) = 0
Next

CR.Clear
CR.Append Buf.Interval(1,Length+6)
CR.Send Buf

ReplyLength = 3
Rep.LowIndex = 1
' Rep.Count = 2
Rep.Count = 3
Rep(1) = &H7F
Rep(2) = &H34
Rep(3) = replyCode

End Sub

function reqWriteAKparLB(replyCode)
dim root
dim Header
dim Buf
dim Rep
dim ReplyLength
dim LB

set Buf = CreateObject("DiagLibs2.ByteArray")
set Rep = CreateObject("DiagLibs2.ByteArray")
Set Header = H.Header

With Header
Set root = .ownerDocument

' For LB = 3 to 240
' WriteParam replyCode, Buf, Rep, ReplyLength, &H88, 0, LB
' H.makeRequest Header, Buf
' H.makeCheck Header, Rep, ReplyLength
' Next

For LB = 3 to &HFF
WriteParamBis replyCode, Buf, Rep, ReplyLength, &H88, 0, LB, 2
H.makeRequest Header, Buf
H.makeCheck Header, Rep, ReplyLength
Next

end with
root.documentElement.appendChild root.createTextNode(vbCrLf)
Set reqWriteAKparLB = root
end function

function reqWriteAK(replyCode,Key, waitErr)
dim root
dim Header
dim Buf
dim Rep
dim ReplyLength
dim CR

set Buf = CreateObject("DiagLibs2.ByteArray")
set Rep = CreateObject("DiagLibs2.ByteArray")
set CR = CreateObject("DiagLibs2.CRC")
Set Header = H.Header

With Header
Set root = .ownerDocument
Buf.LowIndex = 1
Buf.Count = 10
Buf(1) = &H34
Buf(2) = &H88
Buf(3) = &H00
Buf(4) = &H00
Buf(5) = &H00
Buf(6) = &H02
Buf.Interval(7,2).Text = Key
CR.Clear
CR.Append Buf.Interval(1,8)
CR.Send Buf

Rep.LowIndex = 1
if waitErr then
Rep.Count = 3
Rep(1) = &H7F
Rep(2) = &H34
Rep(3) = replyCode
ReplyLength = 3
else Rep.Count = 2
Rep(1) = &H74
Rep(2) = replyCode
ReplyLength = 2
end if

H.makeRequest Header, Buf
H.makeCheck Header, Rep, ReplyLength
end with
root.documentElement.appendChild root.createTextNode(vbCrLf)
Set reqWriteAK = root
end function

function reqWriteAKparRL(replyCode)
dim root
dim Header
dim Buf
dim Rep
dim ReplyLength
dim RL

set Buf = CreateObject("DiagLibs2.ByteArray")
set Rep = CreateObject("DiagLibs2.ByteArray")
Set Header = H.Header

With Header
Set root = .ownerDocument

For RL = 0 to 255
Select Case RL
Case &H81,&H82,&H83,&H88
Case Else
WriteParam replyCode, Buf, Rep, ReplyLength, RL, 0, 2
H.makeRequest Header, Buf
H.makeCheck Header, Rep, ReplyLength
End Select
Next

end with
root.documentElement.appendChild root.createTextNode(vbCrLf)
Set reqWriteAKparRL = root
end function

function reqWriteAKparAdr(replyCode)
dim root
dim Header
dim Buf
dim Rep
dim ReplyLength
dim RL

set Buf = CreateObject("DiagLibs2.ByteArray")
set Rep = CreateObject("DiagLibs2.ByteArray")
Set Header = H.Header


With Header
Set root = .ownerDocument

Adr = &H0F
Do While Adr < &HFFFFFF
WriteParam replyCode, Buf, Rep, ReplyLength, &H88, Adr, 2
H.makeRequest Header, Buf
H.makeCheck Header, Rep, ReplyLength
Adr = Adr * 2
Loop

end with
root.documentElement.appendChild root.createTextNode(vbCrLf)
Set reqWriteAKparAdr = root
end function

function reqWriteAKparCRC()
dim root
dim Header
dim Buf
dim Rep
dim ReplyLength

set Buf = CreateObject("DiagLibs2.ByteArray")
set Rep = CreateObject("DiagLibs2.ByteArray")
Set Header = H.Header

With Header
Set root = .ownerDocument
Buf.LowIndex = 1
Buf.Count = 10
Buf(1) = &H34
Buf(2) = &H88
Buf(3) = &H00
Buf(4) = &H00
Buf(5) = &H00
Buf(6) = &H02
Buf(7) = &H00
Buf(8) = &H00
Buf(9) = &H00
Buf(10) = &H00

Rep.LowIndex = 1
Rep.Count = 2
Rep(1) = &H74
Rep(2) = &H0A
ReplyLength = 2

H.makeRequest Header, Buf
H.makeCheck Header, Rep, ReplyLength
end with
root.documentElement.appendChild root.createTextNode(vbCrLf)
Set reqWriteAKparCRC = root
end function



Wyszukiwarka

Podobne podstrony:
tests appli key
function mcrypt module get algo key size
answer key
action=produkty wyswietl&todo=koszyk&produkt=12&key=
action=produkty wyswietl&todo=koszyk&produkt=71&key=
English for Medical S&D Practical English sentences key
action=produkty wyswietl&todo=koszyk&produkt=61&key=
action=produkty wyswietl&todo=koszyk&produkt=27&key=
Key Skills 3
action=produkty wyswietl&todo=koszyk&produkt=126&key=
42 key
cd key office 2007

więcej podobnych podstron