diff --git a/lib/worker/nfc_playlist_worker.c b/lib/worker/nfc_playlist_worker.c index 39ad29546c2..d23a8a0faa9 100644 --- a/lib/worker/nfc_playlist_worker.c +++ b/lib/worker/nfc_playlist_worker.c @@ -2,23 +2,19 @@ NfcPlaylistWorker* nfc_playlist_worker_alloc() { NfcPlaylistWorker* nfc_playlist_worker = malloc(sizeof(NfcPlaylistWorker)); - nfc_playlist_worker->thread = furi_thread_alloc_ex("NfcPlaylistWorker", 8192, nfc_playlist_worker_task, nfc_playlist_worker); nfc_playlist_worker->state = NfcPlaylistWorkerState_Stopped; - nfc_playlist_worker->nfc = nfc_alloc(); nfc_playlist_worker->nfc_device = nfc_device_alloc(); - return nfc_playlist_worker; } void nfc_playlist_worker_free(NfcPlaylistWorker* nfc_playlist_worker) { furi_assert(nfc_playlist_worker); furi_thread_free(nfc_playlist_worker->thread); - nfc_free(nfc_playlist_worker->nfc); nfc_device_free(nfc_playlist_worker->nfc_device); - + nfc_listener_free(nfc_playlist_worker->nfc_listener); free(nfc_playlist_worker); } @@ -62,22 +58,17 @@ int32_t nfc_playlist_worker_task(void* context) { } bool nfc_playlist_worker_is_emulating(NfcPlaylistWorker* nfc_playlist_worker) { - if (nfc_playlist_worker->state == NfcPlaylistWorkerState_Emulating) { - return true; - } - return false; + furi_assert(nfc_playlist_worker); + return nfc_playlist_worker->state == NfcPlaylistWorkerState_Emulating; } void nfc_playlist_worker_set_nfc_data(NfcPlaylistWorker* nfc_playlist_worker, char* file_path) { - nfc_device_clear(nfc_playlist_worker->nfc_device); + furi_assert(nfc_playlist_worker); nfc_device_load(nfc_playlist_worker->nfc_device, file_path); nfc_playlist_worker->nfc_protocol = nfc_device_get_protocol(nfc_playlist_worker->nfc_device); } void nfc_playlist_worker_clear_nfc_data(NfcPlaylistWorker* nfc_playlist_worker) { + furi_assert(nfc_playlist_worker); nfc_device_clear(nfc_playlist_worker->nfc_device); -} - -NfcDeviceData* nfc_playlist_worker_get_nfc_data(NfcPlaylistWorker* nfc_playlist_worker) { - return nfc_playlist_worker->nfc_data; } \ No newline at end of file diff --git a/lib/worker/nfc_playlist_worker.h b/lib/worker/nfc_playlist_worker.h index ed1fe49f9cc..511ea7d2991 100644 --- a/lib/worker/nfc_playlist_worker.h +++ b/lib/worker/nfc_playlist_worker.h @@ -16,7 +16,6 @@ typedef struct NfcPlaylistWorker { NfcListener* nfc_listener; NfcDevice* nfc_device; NfcProtocol nfc_protocol; - NfcDeviceData* nfc_data; Nfc* nfc; } NfcPlaylistWorker; @@ -29,5 +28,4 @@ int32_t nfc_playlist_worker_task(void* context); bool nfc_playlist_worker_is_emulating(NfcPlaylistWorker* nfc_playlist_worker); void nfc_playlist_worker_set_nfc_data(NfcPlaylistWorker* nfc_playlist_worker, char* file_path); -void nfc_playlist_worker_clear_nfc_data(NfcPlaylistWorker* nfc_playlist_worker); -NfcDeviceData* nfc_playlist_worker_get_nfc_data(NfcPlaylistWorker* nfc_playlist_worker); \ No newline at end of file +void nfc_playlist_worker_clear_nfc_data(NfcPlaylistWorker* nfc_playlist_worker); \ No newline at end of file