|
@@ -3,8 +3,6 @@
|
|
|
#include <gui/gui.h>
|
|
#include <gui/gui.h>
|
|
|
#include <lib/subghz/devices/cc1101_int/cc1101_int_interconnect.h>
|
|
#include <lib/subghz/devices/cc1101_int/cc1101_int_interconnect.h>
|
|
|
|
|
|
|
|
-#include "esubghz_chat_icons.h"
|
|
|
|
|
-
|
|
|
|
|
#include "esubghz_chat_i.h"
|
|
#include "esubghz_chat_i.h"
|
|
|
|
|
|
|
|
#define CHAT_LEAVE_DELAY 10
|
|
#define CHAT_LEAVE_DELAY 10
|
|
@@ -516,11 +514,27 @@ int32_t esubghz_chat(void)
|
|
|
goto err_alloc_kd;
|
|
goto err_alloc_kd;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ state->nfc_popup = popup_alloc();
|
|
|
|
|
+ if (state->nfc_popup == NULL) {
|
|
|
|
|
+ goto err_alloc_np;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
state->subghz_worker = subghz_tx_rx_worker_alloc();
|
|
state->subghz_worker = subghz_tx_rx_worker_alloc();
|
|
|
if (state->subghz_worker == NULL) {
|
|
if (state->subghz_worker == NULL) {
|
|
|
goto err_alloc_worker;
|
|
goto err_alloc_worker;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ state->nfc_worker = nfc_worker_alloc();
|
|
|
|
|
+ if (state->nfc_worker == NULL) {
|
|
|
|
|
+ goto err_alloc_nworker;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ state->nfc_dev_data = malloc(sizeof(NfcDeviceData));
|
|
|
|
|
+ if (state->nfc_dev_data == NULL) {
|
|
|
|
|
+ goto err_alloc_ndevdata;
|
|
|
|
|
+ }
|
|
|
|
|
+ memset(state->nfc_dev_data, 0, sizeof(NfcDeviceData));
|
|
|
|
|
+
|
|
|
state->crypto_ctx = crypto_ctx_alloc();
|
|
state->crypto_ctx = crypto_ctx_alloc();
|
|
|
if (state->crypto_ctx == NULL) {
|
|
if (state->crypto_ctx == NULL) {
|
|
|
goto err_alloc_crypto;
|
|
goto err_alloc_crypto;
|
|
@@ -579,6 +593,8 @@ int32_t esubghz_chat(void)
|
|
|
text_box_get_view(state->chat_box));
|
|
text_box_get_view(state->chat_box));
|
|
|
view_dispatcher_add_view(state->view_dispatcher, ESubGhzChatView_KeyDisplay,
|
|
view_dispatcher_add_view(state->view_dispatcher, ESubGhzChatView_KeyDisplay,
|
|
|
dialog_ex_get_view(state->key_display));
|
|
dialog_ex_get_view(state->key_display));
|
|
|
|
|
+ view_dispatcher_add_view(state->view_dispatcher, ESubGhzChatView_NfcPopup,
|
|
|
|
|
+ popup_get_view(state->nfc_popup));
|
|
|
|
|
|
|
|
/* get the GUI record and attach the view dispatcher to the GUI */
|
|
/* get the GUI record and attach the view dispatcher to the GUI */
|
|
|
/* no error handling here, don't know how */
|
|
/* no error handling here, don't know how */
|
|
@@ -599,6 +615,9 @@ int32_t esubghz_chat(void)
|
|
|
subghz_tx_rx_worker_stop(state->subghz_worker);
|
|
subghz_tx_rx_worker_stop(state->subghz_worker);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /* if it is running, stop the NFC worker */
|
|
|
|
|
+ nfc_worker_stop(state->nfc_worker);
|
|
|
|
|
+
|
|
|
err = 0;
|
|
err = 0;
|
|
|
|
|
|
|
|
/* close GUI record */
|
|
/* close GUI record */
|
|
@@ -615,6 +634,8 @@ int32_t esubghz_chat(void)
|
|
|
ESubGhzChatView_ChatBox);
|
|
ESubGhzChatView_ChatBox);
|
|
|
view_dispatcher_remove_view(state->view_dispatcher,
|
|
view_dispatcher_remove_view(state->view_dispatcher,
|
|
|
ESubGhzChatView_KeyDisplay);
|
|
ESubGhzChatView_KeyDisplay);
|
|
|
|
|
+ view_dispatcher_remove_view(state->view_dispatcher,
|
|
|
|
|
+ ESubGhzChatView_NfcPopup);
|
|
|
|
|
|
|
|
/* close notification record */
|
|
/* close notification record */
|
|
|
furi_record_close(RECORD_NOTIFICATION);
|
|
furi_record_close(RECORD_NOTIFICATION);
|
|
@@ -638,9 +659,18 @@ int32_t esubghz_chat(void)
|
|
|
crypto_ctx_free(state->crypto_ctx);
|
|
crypto_ctx_free(state->crypto_ctx);
|
|
|
|
|
|
|
|
err_alloc_crypto:
|
|
err_alloc_crypto:
|
|
|
|
|
+ free(state->nfc_dev_data);
|
|
|
|
|
+
|
|
|
|
|
+err_alloc_ndevdata:
|
|
|
|
|
+ nfc_worker_free(state->nfc_worker);
|
|
|
|
|
+
|
|
|
|
|
+err_alloc_nworker:
|
|
|
subghz_tx_rx_worker_free(state->subghz_worker);
|
|
subghz_tx_rx_worker_free(state->subghz_worker);
|
|
|
|
|
|
|
|
err_alloc_worker:
|
|
err_alloc_worker:
|
|
|
|
|
+ popup_free(state->nfc_popup);
|
|
|
|
|
+
|
|
|
|
|
+err_alloc_np:
|
|
|
dialog_ex_free(state->key_display);
|
|
dialog_ex_free(state->key_display);
|
|
|
|
|
|
|
|
err_alloc_kd:
|
|
err_alloc_kd:
|