[FL-1447] NFC application refactoring (#532)
* nfc: add separate nfc_detect * nfc_worker: add callback and context * api-hal-nfc: return busy if rfal worker is running * nfc: introduce nfc_detect, change nfc_worker API, rework main nfc task * nfc_emulate: introduce nfc_emulate module * nfc: introduce nfc_emv module * nfc: introduce nfc_mifare_ul module * nfc: remove unused nfc_views * nfc: separate messages and models * nfc: remove unused nfc message types * nfc: remove message_queue from common api * view_dispatcher: delete internal queue in destructor * api-hal-nfc: fix rfal worker initialization condition Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -52,10 +52,14 @@ static const rfalNfcDiscoverParam api_hal_nfc_emulate_params_emv = {
|
||||
|
||||
ReturnCode api_hal_nfc_init() {
|
||||
// Check if Nfc worker was started
|
||||
if(rfalNfcGetState() > RFAL_NFC_STATE_NOTINIT) {
|
||||
rfalNfcState state = rfalNfcGetState();
|
||||
if(state == RFAL_NFC_STATE_NOTINIT) {
|
||||
return rfalNfcInitialize();
|
||||
} else if(state == RFAL_NFC_STATE_IDLE) {
|
||||
return ERR_NONE;
|
||||
} else {
|
||||
return ERR_BUSY;
|
||||
}
|
||||
return rfalNfcInitialize();
|
||||
}
|
||||
|
||||
bool api_hal_nfc_is_busy() {
|
||||
|
@@ -52,10 +52,14 @@ static const rfalNfcDiscoverParam api_hal_nfc_emulate_params_emv = {
|
||||
|
||||
ReturnCode api_hal_nfc_init() {
|
||||
// Check if Nfc worker was started
|
||||
if(rfalNfcGetState() > RFAL_NFC_STATE_NOTINIT) {
|
||||
rfalNfcState state = rfalNfcGetState();
|
||||
if(state == RFAL_NFC_STATE_NOTINIT) {
|
||||
return rfalNfcInitialize();
|
||||
} else if(state == RFAL_NFC_STATE_IDLE) {
|
||||
return ERR_NONE;
|
||||
} else {
|
||||
return ERR_BUSY;
|
||||
}
|
||||
return rfalNfcInitialize();
|
||||
}
|
||||
|
||||
bool api_hal_nfc_is_busy() {
|
||||
|
Reference in New Issue
Block a user