mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-30 21:58:55 -07:00
NFC: Test revert 0902fd49e1
This commit is contained in:
@@ -65,8 +65,10 @@ static NfcCommand iso14443_4a_listener_run(NfcGenericEvent event, void* context)
|
||||
if(instance->state == Iso14443_4aListenerStateIdle) {
|
||||
if(bit_buffer_get_size_bytes(rx_buffer) == 2 &&
|
||||
bit_buffer_get_byte(rx_buffer, 0) == ISO14443_4A_CMD_READ_ATS) {
|
||||
if(iso14443_4a_listener_send_ats(instance, &instance->data->ats_data) ==
|
||||
if(iso14443_4a_listener_send_ats(instance, &instance->data->ats_data) !=
|
||||
Iso14443_4aErrorNone) {
|
||||
command = NfcCommandContinue;
|
||||
} else {
|
||||
instance->state = Iso14443_4aListenerStateActive;
|
||||
}
|
||||
}
|
||||
@@ -82,15 +84,7 @@ static NfcCommand iso14443_4a_listener_run(NfcGenericEvent event, void* context)
|
||||
iso14443_3a_event->type == Iso14443_3aListenerEventTypeHalted ||
|
||||
iso14443_3a_event->type == Iso14443_3aListenerEventTypeFieldOff) {
|
||||
instance->state = Iso14443_4aListenerStateIdle;
|
||||
|
||||
instance->iso14443_4a_event.type = iso14443_3a_event->type ==
|
||||
Iso14443_3aListenerEventTypeHalted ?
|
||||
Iso14443_4aListenerEventTypeHalted :
|
||||
Iso14443_4aListenerEventTypeFieldOff;
|
||||
|
||||
if(instance->callback) {
|
||||
command = instance->callback(instance->generic_event, instance->context);
|
||||
}
|
||||
command = NfcCommandContinue;
|
||||
}
|
||||
|
||||
return command;
|
||||
|
||||
@@ -12,7 +12,6 @@ typedef struct Iso14443_4aListener Iso14443_4aListener;
|
||||
|
||||
typedef enum {
|
||||
Iso14443_4aListenerEventTypeHalted,
|
||||
Iso14443_4aListenerEventTypeFieldOff,
|
||||
Iso14443_4aListenerEventTypeReceivedData,
|
||||
} Iso14443_4aListenerEventType;
|
||||
|
||||
|
||||
@@ -61,69 +61,6 @@ Iso14443_4aError iso14443_4a_poller_send_block_pwt_ext(
|
||||
const BitBuffer* tx_buffer,
|
||||
BitBuffer* rx_buffer);
|
||||
|
||||
/**
|
||||
* @brief Transmit and receive Iso14443_4a chained block in poller mode. Also it
|
||||
* automatically modifies PCB packet byte with appropriate bits then resets them back
|
||||
*
|
||||
* Must ONLY be used inside the callback function.
|
||||
*
|
||||
* The rx_buffer will be filled with any data received as a response to data
|
||||
* sent from tx_buffer. The fwt parameter is calculated during activation procedure.
|
||||
*
|
||||
* @param[in, out] instance pointer to the instance to be used in the transaction.
|
||||
* @param[in] tx_buffer pointer to the buffer containing the data to be transmitted.
|
||||
* @param[out] rx_buffer pointer to the buffer to be filled with received data.
|
||||
* @return Iso14443_4aErrorNone on success, an error code on failure.
|
||||
*/
|
||||
Iso14443_4aError iso14443_4a_poller_send_chain_block(
|
||||
Iso14443_4aPoller* instance,
|
||||
const BitBuffer* tx_buffer,
|
||||
BitBuffer* rx_buffer);
|
||||
|
||||
/**
|
||||
* @brief Transmit Iso14443_4a R-block in poller mode. This block never contains
|
||||
* data, but can contain CID and NAD, therefore in tx_buffer only two bytes can be added.
|
||||
* The first one will represent CID, the second one will represent NAD.
|
||||
*
|
||||
* Must ONLY be used inside the callback function.
|
||||
*
|
||||
* The rx_buffer will be filled with R-block repsonse
|
||||
*
|
||||
* @param[in, out] instance pointer to the instance to be used in the transaction.
|
||||
* @param[in] acknowledged Sets appropriate bit in PCB byte. True - ACK, false - NAK
|
||||
* @param[in] tx_buffer pointer to the buffer containing the data to be transmitted.
|
||||
* @param[out] rx_buffer pointer to the buffer to be filled with received data.
|
||||
* @return Iso14443_4aErrorNone on success, an error code on failure.
|
||||
*/
|
||||
Iso14443_4aError iso14443_4a_poller_send_receive_ready_block(
|
||||
Iso14443_4aPoller* instance,
|
||||
bool acknowledged,
|
||||
const BitBuffer* tx_buffer,
|
||||
BitBuffer* rx_buffer);
|
||||
|
||||
/**
|
||||
* @brief Transmit Iso14443_4a S-block in poller mode. S-block used to exchange control
|
||||
* information between the card and the reader. Two different types of S-blocks
|
||||
* are defined:
|
||||
* - Waiting time extension containing a 1 byte long INF field and (deselect = false)
|
||||
* - DESELECT containing no INF field (deselect = true)
|
||||
*
|
||||
* Must ONLY be used inside the callback function.
|
||||
*
|
||||
* The rx_buffer will be filled with R-block repsonse
|
||||
*
|
||||
* @param[in, out] instance pointer to the instance to be used in the transaction.
|
||||
* @param[in] deselect Sets appropriate bit in PCB byte.
|
||||
* @param[in] tx_buffer pointer to the buffer containing the data to be transmitted.
|
||||
* @param[out] rx_buffer pointer to the buffer to be filled with received data.
|
||||
* @return Iso14443_4aErrorNone on success, an error code on failure.
|
||||
*/
|
||||
Iso14443_4aError iso14443_4a_poller_send_supervisory_block(
|
||||
Iso14443_4aPoller* instance,
|
||||
bool deselect,
|
||||
const BitBuffer* tx_buffer,
|
||||
BitBuffer* rx_buffer);
|
||||
|
||||
/**
|
||||
* @brief Send HALT command to the card.
|
||||
*
|
||||
|
||||
@@ -116,37 +116,6 @@ Iso14443_4aError iso14443_4a_poller_send_block(
|
||||
return error;
|
||||
}
|
||||
|
||||
Iso14443_4aError iso14443_4a_poller_send_chain_block(
|
||||
Iso14443_4aPoller* instance,
|
||||
const BitBuffer* tx_buffer,
|
||||
BitBuffer* rx_buffer) {
|
||||
iso14443_4_layer_set_i_block(instance->iso14443_4_layer, true, false);
|
||||
Iso14443_4aError error = iso14443_4a_poller_send_block(instance, tx_buffer, rx_buffer);
|
||||
return error;
|
||||
}
|
||||
|
||||
Iso14443_4aError iso14443_4a_poller_send_receive_ready_block(
|
||||
Iso14443_4aPoller* instance,
|
||||
bool acknowledged,
|
||||
const BitBuffer* tx_buffer,
|
||||
BitBuffer* rx_buffer) {
|
||||
bool CID_present = bit_buffer_get_size_bytes(tx_buffer) != 0;
|
||||
iso14443_4_layer_set_r_block(instance->iso14443_4_layer, acknowledged, CID_present);
|
||||
Iso14443_4aError error = iso14443_4a_poller_send_block(instance, tx_buffer, rx_buffer);
|
||||
return error;
|
||||
}
|
||||
|
||||
Iso14443_4aError iso14443_4a_poller_send_supervisory_block(
|
||||
Iso14443_4aPoller* instance,
|
||||
bool deselect,
|
||||
const BitBuffer* tx_buffer,
|
||||
BitBuffer* rx_buffer) {
|
||||
bool CID_present = bit_buffer_get_size_bytes(tx_buffer) != 0;
|
||||
iso14443_4_layer_set_s_block(instance->iso14443_4_layer, deselect, CID_present);
|
||||
Iso14443_4aError error = iso14443_4a_poller_send_block(instance, tx_buffer, rx_buffer);
|
||||
return error;
|
||||
}
|
||||
|
||||
Iso14443_4aError iso14443_4a_poller_send_block_pwt_ext(
|
||||
Iso14443_4aPoller* instance,
|
||||
const BitBuffer* tx_buffer,
|
||||
|
||||
Reference in New Issue
Block a user