У меня есть сканер отпечатков пальцев USB-C (OTG) от Xperix, но я не могу найти SDK для него. Я разрабатываю приложение для Android, и я могу обнаружить USB -устройство, но я не уверен, как запустить сканирование, используя сканер отпечатков пальцев. Данные ... ". < /p>
private fun setupUsbDevice(view: View) {
val usbDevices = usbManager.deviceList
val textView2 = view.findViewById(R.id.fingerprint_reader_wsq_base64_value_textview)
// Check if the USB devices list is empty
if (usbDevices.isEmpty()) {
Log.e("Fingerprint", "No USB devices found!")
textView2.text = "No USB devices found!"
return
}
// Variable to store information about found devices
val s = StringBuilder()
// Iterate over USB devices
usbDevices.forEach { (key, value) ->
s.append("Found USB device: ${value.deviceName}\n")
// If the device matches the given path (here /dev/bus/usb/002/002), open it
if (value.deviceName == "/dev/bus/usb/002/002") { // Check the exact device path
Log.d("Fingerprint", "Found device at path: ${value.deviceName}")
textView2.text = "Found device: ${value.deviceName}"
// Try to open a connection to the device
usbDevice = value
val permissionIntent = PendingIntent.getBroadcast(
context,
0,
Intent(UsbManager.ACTION_USB_DEVICE_ATTACHED),
PendingIntent.FLAG_IMMUTABLE // Depending on your API version
)
usbManager.requestPermission(value, permissionIntent)
Thread.sleep(10000)
usbConnection = usbManager.openDevice(value)
if (usbConnection == null) {
Log.e("Fingerprint", "Failed to open connection to device: ${value.deviceName}")
textView2.text = "Failed to open connection!"
// Check if the device requires special permissions
if (!usbManager.hasPermission(value)) {
Log.e("Fingerprint", "No permission for device: ${value.deviceName}")
textView2.text = "No permission for device!"
} else {
Log.e("Fingerprint", "Unknown error while opening connection to device: ${value.deviceName}")
textView2.text = "Unknown error while opening connection to device: ${value.deviceName}"
}
return
}
// Get the device interface (the first interface)
usbInterface = value.getInterface(0)
usbConnection?.claimInterface(usbInterface, true)
Log.d("Fingerprint", "Interface claimed: ${value.deviceName}")
textView2.text = "Interface claimed"
// Search for device endpoints
for (i in 0 until usbInterface!!.endpointCount) {
val endpoint = usbInterface!!.getEndpoint(i)
Log.d("Fingerprint", "Endpoint #$i, type=${endpoint.type}, direction=${endpoint.direction}")
// Check if the endpoint is of type BULK and if it is an IN endpoint
if (endpoint.type == UsbConstants.USB_ENDPOINT_XFER_BULK) {
if (endpoint.direction == UsbConstants.USB_DIR_IN) {
endpointIn = endpoint
Log.d("Fingerprint", "Found BULK IN endpoint")
textView2.text = "Found BULK IN endpoint"
startReadingFingerprint(view) // Start reading from this endpoint
}
}
}
}
}
// If the device was not found
if (usbDevice == null) {
Log.e("Fingerprint", "No device found with the required path!")
textView2.text = "No device found with the required path!"
}
}
private fun startReadingFingerprint(view: View) {
Log.d("Fingerprint", "startReadingFingerprint: Starting")
val textView = view.findViewById(R.id.fingerprint_reader_wsq_base64_value_textview)
textView.text = "setupUsbDevice: startReadingFingerprint: Starting"
writeLogToFile("startReadingFingerprint: Starting")
Thread {
while (usbDevice != null) {
val buffer = ByteArray(64)
Log.d("Fingerprint", "startReadingFingerprint: Waiting for data...")
textView.text = "setupUsbDevice: startReadingFingerprint: Waiting for data..."
writeLogToFile("startReadingFingerprint: Waiting for data...")
val result = usbConnection?.bulkTransfer(endpointIn, buffer, buffer.size, 5000)
if (result != null && result > 0) {
Log.d("Fingerprint", "startReadingFingerprint: Received $result bytes")
textView.text = "setupUsbDevice: startReadingFingerprint: Received $result bytes"
writeLogToFile("startReadingFingerprint: Received $result bytes")
processFingerprintData(view, buffer)
} else {
Log.e("Fingerprint", "startReadingFingerprint: Failed to read data!")
textView.text = "setupUsbDevice: startReadingFingerprint: Failed to read data!"
writeLogToFile("startReadingFingerprint: Failed to read data!")
}
Thread.sleep(100)
}
Log.e("Fingerprint", "startReadingFingerprint: Scanning finished (device disconnected?)")
textView.text = "setupUsbDevice: startReadingFingerprint: Scanning finished (device disconnected?)"
writeLogToFile("startReadingFingerprint: Scanning finished (device disconnected?)")
}.start()
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... ini-slim-2
Xperix Biomini Slim 2 ⇐ Android
Форум для тех, кто программирует под Android
1743438022
Anonymous
У меня есть сканер отпечатков пальцев USB-C (OTG) от Xperix, но я не могу найти SDK для него. Я разрабатываю приложение для Android, и я могу обнаружить USB -устройство, но я не уверен, как запустить сканирование, используя сканер отпечатков пальцев. Данные ... ". < /p>
private fun setupUsbDevice(view: View) {
val usbDevices = usbManager.deviceList
val textView2 = view.findViewById(R.id.fingerprint_reader_wsq_base64_value_textview)
// Check if the USB devices list is empty
if (usbDevices.isEmpty()) {
Log.e("Fingerprint", "No USB devices found!")
textView2.text = "No USB devices found!"
return
}
// Variable to store information about found devices
val s = StringBuilder()
// Iterate over USB devices
usbDevices.forEach { (key, value) ->
s.append("Found USB device: ${value.deviceName}\n")
// If the device matches the given path (here /dev/bus/usb/002/002), open it
if (value.deviceName == "/dev/bus/usb/002/002") { // Check the exact device path
Log.d("Fingerprint", "Found device at path: ${value.deviceName}")
textView2.text = "Found device: ${value.deviceName}"
// Try to open a connection to the device
usbDevice = value
val permissionIntent = PendingIntent.getBroadcast(
context,
0,
Intent(UsbManager.ACTION_USB_DEVICE_ATTACHED),
PendingIntent.FLAG_IMMUTABLE // Depending on your API version
)
usbManager.requestPermission(value, permissionIntent)
Thread.sleep(10000)
usbConnection = usbManager.openDevice(value)
if (usbConnection == null) {
Log.e("Fingerprint", "Failed to open connection to device: ${value.deviceName}")
textView2.text = "Failed to open connection!"
// Check if the device requires special permissions
if (!usbManager.hasPermission(value)) {
Log.e("Fingerprint", "No permission for device: ${value.deviceName}")
textView2.text = "No permission for device!"
} else {
Log.e("Fingerprint", "Unknown error while opening connection to device: ${value.deviceName}")
textView2.text = "Unknown error while opening connection to device: ${value.deviceName}"
}
return
}
// Get the device interface (the first interface)
usbInterface = value.getInterface(0)
usbConnection?.claimInterface(usbInterface, true)
Log.d("Fingerprint", "Interface claimed: ${value.deviceName}")
textView2.text = "Interface claimed"
// Search for device endpoints
for (i in 0 until usbInterface!!.endpointCount) {
val endpoint = usbInterface!!.getEndpoint(i)
Log.d("Fingerprint", "Endpoint #$i, type=${endpoint.type}, direction=${endpoint.direction}")
// Check if the endpoint is of type BULK and if it is an IN endpoint
if (endpoint.type == UsbConstants.USB_ENDPOINT_XFER_BULK) {
if (endpoint.direction == UsbConstants.USB_DIR_IN) {
endpointIn = endpoint
Log.d("Fingerprint", "Found BULK IN endpoint")
textView2.text = "Found BULK IN endpoint"
startReadingFingerprint(view) // Start reading from this endpoint
}
}
}
}
}
// If the device was not found
if (usbDevice == null) {
Log.e("Fingerprint", "No device found with the required path!")
textView2.text = "No device found with the required path!"
}
}
private fun startReadingFingerprint(view: View) {
Log.d("Fingerprint", "startReadingFingerprint: Starting")
val textView = view.findViewById(R.id.fingerprint_reader_wsq_base64_value_textview)
textView.text = "setupUsbDevice: startReadingFingerprint: Starting"
writeLogToFile("startReadingFingerprint: Starting")
Thread {
while (usbDevice != null) {
val buffer = ByteArray(64)
Log.d("Fingerprint", "startReadingFingerprint: Waiting for data...")
textView.text = "setupUsbDevice: startReadingFingerprint: Waiting for data..."
writeLogToFile("startReadingFingerprint: Waiting for data...")
val result = usbConnection?.bulkTransfer(endpointIn, buffer, buffer.size, 5000)
if (result != null && result > 0) {
Log.d("Fingerprint", "startReadingFingerprint: Received $result bytes")
textView.text = "setupUsbDevice: startReadingFingerprint: Received $result bytes"
writeLogToFile("startReadingFingerprint: Received $result bytes")
processFingerprintData(view, buffer)
} else {
Log.e("Fingerprint", "startReadingFingerprint: Failed to read data!")
textView.text = "setupUsbDevice: startReadingFingerprint: Failed to read data!"
writeLogToFile("startReadingFingerprint: Failed to read data!")
}
Thread.sleep(100)
}
Log.e("Fingerprint", "startReadingFingerprint: Scanning finished (device disconnected?)")
textView.text = "setupUsbDevice: startReadingFingerprint: Scanning finished (device disconnected?)"
writeLogToFile("startReadingFingerprint: Scanning finished (device disconnected?)")
}.start()
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79546749/xperix-biomini-slim-2[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия