Я разрабатываю приложение для Android для чтения UHF RFID-меток, я использую устройство Chainway C72, телефон со встроенным RFID-датчиком, проблема в том, что при использовании SDK провайдера у меня возникла проблема, и в этом Я не могу запустить датчик, так как получаю ошибку связи в консоли каждый раз, когда пытаюсь активировать его в приложении.
Прикрепляю код, который я сделал только для тестирования датчика:
package com.example.pruebarfid2
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.Toast
import com.rscja.deviceapi.RFIDWithUHFUART
class MainActivity : AppCompatActivity() {
private val rfid = RFIDWithUHFUART.getInstance()
private var isInventory = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val button = findViewById(R.id.button)
button.setOnClickListener {
Toast.makeText(this, "Hola!", Toast.LENGTH_SHORT).show()
uhf()
}
}
private fun uhf() {
val result = rfid.init(this)
if (!result) {
Toast.makeText(this, "Conexión fallida", Toast.LENGTH_SHORT).show()
return
}
Toast.makeText(this, "Conexión exitosa", Toast.LENGTH_SHORT).show()
// Configuración de parámetros
// rfid.setFrequencyMode(xx)
// rfid.setPower(30)
if (rfid.startInventoryTag()) {
Toast.makeText(this, "Lectura iniciada", Toast.LENGTH_SHORT).show()
isInventory = true
ThreadInventory().start()
} else {
rfid.stopInventory()
Toast.makeText(this, "Error al iniciar la lectura", Toast.LENGTH_SHORT).show()
}
// ..............
rfid.stopInventory()
isInventory = false
// .................
// Desconectar UHF
rfid.free()
Toast.makeText(this, "UHF desconectado", Toast.LENGTH_SHORT).show()
}
private inner class ThreadInventory : Thread() {
override fun run() {
while (isInventory) {
val uhftagInfo = rfid.readTagFromBuffer()
if (uhftagInfo == null) {
Thread.sleep(20)
continue
}
val epc = uhftagInfo.epc
val rssi = uhftagInfo.rssi
// .....
}
}
}
}
и я оставляю вам сообщение об ошибке в консоли каждый раз, когда я нажимаю кнопку, чтобы прочитать тег:
D/DeviceAPI: [MTK] load DeviceAPIM.so
I/DeviceAPI: UHF device = C72_6765
I/DeviceAPI: UHF_Init----------->DEVICE_C72_6765
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 165 0111000100, gpiolen=18
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
W/ple.pruebarfid2: type=1400 audit(0.0:1334): avc: denied { read write } for name="mt_gpio" dev="sysfs" ino=34038 scontext=u:r:untrusted_app:s0:c170,c256,c512,c768 tcontext=u:object_r:mt_gpio:s0 tclass=file permissive=0 app=com.example.pruebarfid2
W/ple.pruebarfid2: type=1400 audit(0.0:1335): avc: denied { read write } for name="mt_gpio" dev="sysfs" ino=34038 scontext=u:r:untrusted_app:s0:c170,c256,c512,c768 tcontext=u:object_r:mt_gpio:s0 tclass=file permissive=0 app=com.example.pruebarfid2
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 158 0111000100, gpiolen=18
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 155 0111000100, gpiolen=18
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 165 0111000100, gpiolen=18
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 24 0111000100, gpiolen=17
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 21 0111000100, gpiolen=17
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
W/ple.pruebarfid2: type=1400 audit(0.0:1336): avc: denied { read write } for name="mt_gpio" dev="sysfs" ino=34038 scontext=u:r:untrusted_app:s0:c170,c256,c512,c768 tcontext=u:object_r:mt_gpio:s0 tclass=file permissive=0 app=com.example.pruebarfid2
I/chatty: uid=10170(com.example.pruebarfid2) identical 2 lines
W/ple.pruebarfid2: type=1400 audit(0.0:1339): avc: denied { read write } for name="mt_gpio" dev="sysfs" ino=34038 scontext=u:r:untrusted_app:s0:c170,c256,c512,c768 tcontext=u:object_r:mt_gpio:s0 tclass=file permissive=0 app=com.example.pruebarfid2
I/DeviceAPI: UHF_Init----------->DevIsOpen = 1
I/DeviceAPI: UHF_OpenAndConnect: uart = /dev/ttyS1
D/DeviceAPI_SerialPort: [SerialPort_Open] [13]: Permission denied
I/DeviceAPI: UHF uhf_uart_fd = -1
I/DeviceAPI_UHF: init() Uart = /dev/ttyS1
E/DeviceAPI_UHF: init() err UHFOpenAndConnect result:-1
W/ple.pruebarfid2: type=1400 audit(0.0:1340): avc: denied { read write } for name="ttyS1" dev="tmpfs" ino=12322 scontext=u:r:untrusted_app:s0:c170,c256,c512,c768 tcontext=u:object_r:ttyS_device:s0 tclass=chr_file permissive=0 app=com.example.pruebarfid2```
I enable all the configuration to read/write files and usb services but nothing.
Подробнее здесь: https://stackoverflow.com/questions/764 ... in-android
Как я могу настроить RFID-датчик UHF в Android ⇐ Android
Форум для тех, кто программирует под Android
-
Anonymous
1716239895
Anonymous
Я разрабатываю приложение для Android для чтения UHF RFID-меток, я использую устройство Chainway C72, телефон со встроенным RFID-датчиком, проблема в том, что при использовании SDK провайдера у меня возникла проблема, и в этом Я не могу запустить датчик, так как получаю ошибку связи в консоли каждый раз, когда пытаюсь активировать его в приложении.
Прикрепляю код, который я сделал только для тестирования датчика:
package com.example.pruebarfid2
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.Toast
import com.rscja.deviceapi.RFIDWithUHFUART
class MainActivity : AppCompatActivity() {
private val rfid = RFIDWithUHFUART.getInstance()
private var isInventory = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val button = findViewById(R.id.button)
button.setOnClickListener {
Toast.makeText(this, "Hola!", Toast.LENGTH_SHORT).show()
uhf()
}
}
private fun uhf() {
val result = rfid.init(this)
if (!result) {
Toast.makeText(this, "Conexión fallida", Toast.LENGTH_SHORT).show()
return
}
Toast.makeText(this, "Conexión exitosa", Toast.LENGTH_SHORT).show()
// Configuración de parámetros
// rfid.setFrequencyMode(xx)
// rfid.setPower(30)
if (rfid.startInventoryTag()) {
Toast.makeText(this, "Lectura iniciada", Toast.LENGTH_SHORT).show()
isInventory = true
ThreadInventory().start()
} else {
rfid.stopInventory()
Toast.makeText(this, "Error al iniciar la lectura", Toast.LENGTH_SHORT).show()
}
// ..............
rfid.stopInventory()
isInventory = false
// .................
// Desconectar UHF
rfid.free()
Toast.makeText(this, "UHF desconectado", Toast.LENGTH_SHORT).show()
}
private inner class ThreadInventory : Thread() {
override fun run() {
while (isInventory) {
val uhftagInfo = rfid.readTagFromBuffer()
if (uhftagInfo == null) {
Thread.sleep(20)
continue
}
val epc = uhftagInfo.epc
val rssi = uhftagInfo.rssi
// .....
}
}
}
}
и я оставляю вам сообщение об ошибке в консоли каждый раз, когда я нажимаю кнопку, чтобы прочитать тег:
D/DeviceAPI: [MTK] load DeviceAPIM.so
I/DeviceAPI: UHF device = C72_6765
I/DeviceAPI: UHF_Init----------->DEVICE_C72_6765
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 165 0111000100, gpiolen=18
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
W/ple.pruebarfid2: type=1400 audit(0.0:1334): avc: denied { read write } for name="mt_gpio" dev="sysfs" ino=34038 scontext=u:r:untrusted_app:s0:c170,c256,c512,c768 tcontext=u:object_r:mt_gpio:s0 tclass=file permissive=0 app=com.example.pruebarfid2
W/ple.pruebarfid2: type=1400 audit(0.0:1335): avc: denied { read write } for name="mt_gpio" dev="sysfs" ino=34038 scontext=u:r:untrusted_app:s0:c170,c256,c512,c768 tcontext=u:object_r:mt_gpio:s0 tclass=file permissive=0 app=com.example.pruebarfid2
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 158 0111000100, gpiolen=18
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 155 0111000100, gpiolen=18
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 165 0111000100, gpiolen=18
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 24 0111000100, gpiolen=17
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
D/DeviceAPI: [mt_gpio_ioctl] platform=6765, gpio=set 21 0111000100, gpiolen=17
E/DeviceAPI: [mt_gpio_ioctl] open error: [13]: Permission denied
W/ple.pruebarfid2: type=1400 audit(0.0:1336): avc: denied { read write } for name="mt_gpio" dev="sysfs" ino=34038 scontext=u:r:untrusted_app:s0:c170,c256,c512,c768 tcontext=u:object_r:mt_gpio:s0 tclass=file permissive=0 app=com.example.pruebarfid2
I/chatty: uid=10170(com.example.pruebarfid2) identical 2 lines
W/ple.pruebarfid2: type=1400 audit(0.0:1339): avc: denied { read write } for name="mt_gpio" dev="sysfs" ino=34038 scontext=u:r:untrusted_app:s0:c170,c256,c512,c768 tcontext=u:object_r:mt_gpio:s0 tclass=file permissive=0 app=com.example.pruebarfid2
I/DeviceAPI: UHF_Init----------->DevIsOpen = 1
I/DeviceAPI: UHF_OpenAndConnect: uart = /dev/ttyS1
D/DeviceAPI_SerialPort: [SerialPort_Open] [13]: Permission denied
I/DeviceAPI: UHF uhf_uart_fd = -1
I/DeviceAPI_UHF: init() Uart = /dev/ttyS1
E/DeviceAPI_UHF: init() err UHFOpenAndConnect result:-1
W/ple.pruebarfid2: type=1400 audit(0.0:1340): avc: denied { read write } for name="ttyS1" dev="tmpfs" ino=12322 scontext=u:r:untrusted_app:s0:c170,c256,c512,c768 tcontext=u:object_r:ttyS_device:s0 tclass=chr_file permissive=0 app=com.example.pruebarfid2```
I enable all the configuration to read/write files and usb services but nothing.
Подробнее здесь: [url]https://stackoverflow.com/questions/76476533/how-can-i-configurate-a-rfid-uhf-sensor-in-android[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия