Sub ImprimirUSB
If usb.UsbPresent = usb.USB_NONE Then
Log("Msgbox - no device")
Msgbox("No USB device or accessory detected!", "Error")
Log("Msgbox - returned")
Return
End If
Log("Checking permission")
If (usb.HasPermission) Then
Msgbox(usb.DeviceInfo, "Device Information")
Dim dev As Int
Dim rFicheroParametros As TextReader
rFicheroParametros.Initialize(File.OpenInput(File.DirAssets, "prnusb.cfg"))
listaParamPRNUSB.Initialize
listaParamPRNUSB = rFicheroParametros.ReadList
rFicheroParametros.Close
dev = usb.Open(9600) ' I have tried various values
If dev <> usb.USB_DEVICE Then
MsgboxAsync("Error conncect USB ", "ERROR")
Return
End If
If dev <> usb.USB_NONE Then
Log("Connected successfully!")
'btnOpen.Enabled = False
'btnClose.Enabled = True
'btnSend.Enabled = True
astreams.Initialize(usb.GetInputStream, usb.GetOutputStream, "astreams")
Else
Log("Error opening USB port")
End If
Else
usb.RequestPermission
End If
End Sub