Datalogic Star Manuel d'installation Page 49

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 128
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 48
MAIN CONTROL OBJECT
39
3
EXAMPLE
...
Public Const MODE_TEXT = 0
Public Const MODE_BINARY = 1
...
Private Sub RFNCCTL_DataEvent(ByVal SatID As Integer, ByVal
DevID As Integer, ByVal Kind As Boolean)
On Error Resume Next
Dim item As ListItem
Dim sDevice As Device
Dim strAnswer As String
Dim vaData As Variant
Dim strData As String
Dim byteData As Byte
Dim i As Integer
Set sDevice = OCX.Devices.Devices(DevID)
vaData = sDevice.DeviceData
'
'Data interpretation
'
strData = ""
If OCX.Mode <> MODE_BINARY Then
strData = CStr(vaData)
Else
For i = 0 To sDevice.DataLen - 1
byteData = vaData(i)
strData = strData & Right("000" + CStr(byteData),3) +""
Next i
End if
Set item = ListData.ListItems.Add(, ,CStr(nItem))
item.ListSubItems.Add , , CStr(DevID)
item.ListSubItems.Add , , strData
'
'Answer manager
'
If CBool(Kind) = True Then
item.ListSubItems.Add , , "Two Way"
If Not TheSameAnswer Then
strAnswer = AnswerData
Else
'Send back the same data packet
strAnswer = strData
End If
If Not sDevice.DataWrite(strAnswer, Len(strAnswer)) = True Then ListData.ListItems.Add
, , "Error Send Data"
Else
item.ListSubItems.Add , , "One Way"
End If
End Sub
Vue de la page 48
1 2 ... 44 45 46 47 48 49 50 51 52 53 54 ... 127 128

Commentaires sur ces manuels

Pas de commentaire