Apply clang_format hook
Bug: 227027117
Test: atest NfcNciInstrumentationTests
Change-Id: Ia602ef562304b66e50d65b082c03972c75e84b9b
diff --git a/src/adaptation/CrcChecksum.cc b/src/adaptation/CrcChecksum.cc
index b8d6ecc..d64ea93 100644
--- a/src/adaptation/CrcChecksum.cc
+++ b/src/adaptation/CrcChecksum.cc
@@ -17,12 +17,12 @@
******************************************************************************/
#include "CrcChecksum.h"
-#include <fcntl.h>
-#include <unistd.h>
-#include <string>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <string>
using android::base::StringPrintf;
diff --git a/src/adaptation/libmain.cc b/src/adaptation/libmain.cc
index 6e26347..d698950 100644
--- a/src/adaptation/libmain.cc
+++ b/src/adaptation/libmain.cc
@@ -18,6 +18,7 @@
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include <fcntl.h>
+
#include <vector>
#include "CrcChecksum.h"
diff --git a/src/adaptation/nfc_config.cc b/src/adaptation/nfc_config.cc
index 264968e..f635fd5 100644
--- a/src/adaptation/nfc_config.cc
+++ b/src/adaptation/nfc_config.cc
@@ -14,16 +14,16 @@
* limitations under the License.
*/
#include "nfc_config.h"
-#include "NfcAdaptation.h"
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/parseint.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
-
#include <config.h>
+#include "NfcAdaptation.h"
+
using namespace ::std;
using namespace ::android::base;
diff --git a/src/gki/common/gki.h b/src/gki/common/gki.h
index 5dcafae..9046268 100644
--- a/src/gki/common/gki.h
+++ b/src/gki/common/gki.h
@@ -296,13 +296,11 @@
#define GKI_SHUTDOWN_EVT APPL_EVT_7
#endif
-/* Timer list entry callback type
-*/
+/* Timer list entry callback type */
struct TIMER_LIST_ENT;
typedef void(TIMER_CBACK)(TIMER_LIST_ENT* p_tle);
-/* Define a timer list entry
-*/
+/* Define a timer list entry */
#ifdef NFC_INTEGRATION_FUZZER
struct TIMER_LIST_ENT {
TIMER_CBACK* p_cback;
@@ -323,8 +321,7 @@
};
#endif
-/* Define a timer list queue
-*/
+/* Define a timer list queue */
#ifdef NFC_INTEGRATION_FUZZER
typedef std::list<TIMER_LIST_ENT*> TIMER_LIST_Q;
#else
@@ -344,8 +341,7 @@
uint16_t count;
} BUFFER_Q;
-/* Task constants
-*/
+/* Task constants */
#ifndef TASKPTR
typedef uint32_t (*TASKPTR)(uint32_t);
#endif
@@ -357,8 +353,7 @@
** Function prototypes
*/
-/* Task management
-*/
+/* Task management */
extern uint8_t GKI_create_task(TASKPTR, uint8_t, int8_t*, uint16_t*, uint16_t,
void*, void*);
extern void GKI_exit_task(uint8_t);
@@ -370,21 +365,18 @@
extern void GKI_stop(void);
extern uint8_t GKI_suspend_task(uint8_t);
-/* memory management
-*/
+/* memory management */
extern void GKI_shiftdown(uint8_t* p_mem, uint32_t len, uint32_t shift_amount);
extern void GKI_shiftup(uint8_t* p_dest, uint8_t* p_src, uint32_t len);
-/* To send buffers and events between tasks
-*/
+/* To send buffers and events between tasks */
extern uint8_t GKI_isend_event(uint8_t, uint16_t);
extern void GKI_isend_msg(uint8_t, uint8_t, void*);
extern void* GKI_read_mbox(uint8_t);
extern void GKI_send_msg(uint8_t, uint8_t, void*);
extern uint8_t GKI_send_event(uint8_t, uint16_t);
-/* To get and release buffers, change owner and get size
-*/
+/* To get and release buffers, change owner and get size */
extern void GKI_change_buf_owner(void*, uint8_t);
extern uint8_t GKI_create_pool(uint16_t, uint16_t, uint8_t, void*);
extern void GKI_delete_pool(uint8_t);
@@ -400,8 +392,7 @@
extern void GKI_register_mempool(void* p_mem);
extern uint8_t GKI_set_pool_permission(uint8_t, uint8_t);
-/* User buffer queue management
-*/
+/* User buffer queue management */
extern void* GKI_dequeue(BUFFER_Q*);
extern void GKI_enqueue(BUFFER_Q*, void*);
extern void GKI_enqueue_head(BUFFER_Q*, void*);
@@ -413,8 +404,7 @@
extern void* GKI_remove_from_queue(BUFFER_Q*, void*);
extern uint16_t GKI_get_pool_bufsize(uint8_t);
-/* Timer management
-*/
+/* Timer management */
extern void GKI_add_to_timer_list(TIMER_LIST_Q*, TIMER_LIST_ENT*);
extern void GKI_delay(uint32_t);
extern uint32_t GKI_get_tick_count(void);
@@ -435,31 +425,27 @@
/* Start and Stop system time tick callback
* true for start system tick if time queue is not empty
* false to stop system tick if time queue is empty
-*/
+ */
typedef void(SYSTEM_TICK_CBACK)(bool);
-/* Time queue management for system ticks
-*/
+/* Time queue management for system ticks */
extern bool GKI_timer_queue_empty(void);
extern void GKI_timer_queue_register_callback(SYSTEM_TICK_CBACK*);
-/* Disable Interrupts, Enable Interrupts
-*/
+/* Disable Interrupts, Enable Interrupts */
extern void GKI_enable(void);
extern void GKI_disable(void);
extern void GKI_sched_lock(void);
extern void GKI_sched_unlock(void);
-/* Allocate (Free) memory from an OS
-*/
+/* Allocate (Free) memory from an OS */
extern void* GKI_os_malloc(uint32_t);
extern void GKI_os_free(void*);
/* os timer operation */
extern uint32_t GKI_get_os_tick_count(void);
-/* Exception handling
-*/
+/* Exception handling */
extern void GKI_exception(uint16_t, std::string);
#endif
diff --git a/src/gki/common/gki_buffer.cc b/src/gki/common/gki_buffer.cc
index 858fe90..16f8070 100644
--- a/src/gki/common/gki_buffer.cc
+++ b/src/gki/common/gki_buffer.cc
@@ -18,6 +18,7 @@
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include <log/log.h>
+
#include "gki_int.h"
#if (GKI_NUM_TOTAL_BUF_POOLS > 16)
@@ -432,7 +433,8 @@
Q = &p_cb->freeq[pool_id];
if (Q->cur_cnt < Q->total) {
- if (Q->p_first == nullptr && gki_alloc_free_queue(pool_id) != true) return nullptr;
+ if (Q->p_first == nullptr && gki_alloc_free_queue(pool_id) != true)
+ return nullptr;
if (Q->p_first == nullptr) {
/* gki_alloc_free_queue() failed to alloc memory */
@@ -802,8 +804,7 @@
p_hdr = (BUFFER_HDR_T*)((uint8_t*)p_q->p_first - BUFFER_HDR_SIZE);
- /* Keep buffers such that GKI header is invisible
- */
+ /* Keep buffers such that GKI header is invisible */
if (p_hdr->p_next)
p_q->p_first = ((uint8_t*)p_hdr->p_next + BUFFER_HDR_SIZE);
else {
@@ -974,8 +975,8 @@
}
/********************************************************
-* The following functions are not needed for light stack
-*********************************************************/
+ * The following functions are not needed for light stack
+ *********************************************************/
#ifndef BTU_STACK_LITE_ENABLED
#define BTU_STACK_LITE_ENABLED FALSE
#endif
diff --git a/src/gki/common/gki_common.h b/src/gki/common/gki_common.h
index 701d23b..437ace9 100644
--- a/src/gki/common/gki_common.h
+++ b/src/gki/common/gki_common.h
@@ -21,8 +21,8 @@
#include "gki.h"
/* Task States: (For OSRdyTbl) */
-#define TASK_DEAD 0 /* b0000 */
-#define TASK_READY 1 /* b0001 */
+#define TASK_DEAD 0 /* b0000 */
+#define TASK_READY 1 /* b0001 */
/********************************************************************
** Internal Error codes
@@ -68,8 +68,7 @@
uint16_t max_cnt; /* maximum number of buffers allocated at any time */
} FREE_QUEUE_T;
-/* Buffer related defines
-*/
+/* Buffer related defines */
#define ALIGN_POOL(pl_size) \
((((pl_size) + 3) / sizeof(uint32_t)) * sizeof(uint32_t))
/* Offset past header */
@@ -84,13 +83,10 @@
#define BUF_STATUS_UNLINKED 1
#define BUF_STATUS_QUEUED 2
-/* Put all GKI variables into one control block
-*/
+/* Put all GKI variables into one control block */
typedef struct {
-/* Task management variables
-*/
-/* The stack and stack size are not used on Windows
-*/
+ /* Task management variables */
+ /* The stack and stack size are not used on Windows */
#if (GKI_NUM_FIXED_BUF_POOLS > 0)
uint8_t bufpool0[(ALIGN_POOL(GKI_BUF0_SIZE) + BUFFER_PADDING_SIZE) *
@@ -177,9 +173,9 @@
int8_t* OSTName[GKI_MAX_TASKS]; /* name of the task */
- uint8_t OSRdyTbl[GKI_MAX_TASKS]; /* current state of the task */
- uint16_t OSWaitEvt
- [GKI_MAX_TASKS]; /* events that have to be processed by the task */
+ uint8_t OSRdyTbl[GKI_MAX_TASKS]; /* current state of the task */
+ uint16_t OSWaitEvt[GKI_MAX_TASKS]; /* events that have to be processed by the
+ task */
uint16_t OSWaitForEvt[GKI_MAX_TASKS]; /* events the task is waiting for*/
uint32_t OSTicks; /* system ticks from start */
@@ -189,8 +185,7 @@
int16_t OSLockNesting; /* counter to keep track of sched lock nesting */
int16_t OSIntNesting; /* counter to keep track of interrupt nesting */
- /* Timer related variables
- */
+ /* Timer related variables */
int32_t OSTicksTilExp; /* Number of ticks till next timer expires */
#if (GKI_DELAY_STOP_SYS_TICK > 0)
uint32_t OSTicksTilStop; /* inactivity delay timer; OS Ticks till stopping
@@ -199,8 +194,8 @@
int32_t OSNumOrigTicks; /* Number of ticks between last timer expiration to
the next one */
- int32_t OSWaitTmr
- [GKI_MAX_TASKS]; /* ticks the task has to wait, for specific events */
+ int32_t OSWaitTmr[GKI_MAX_TASKS]; /* ticks the task has to wait, for specific
+ events */
/* Only take up space timers used in the system (GKI_NUM_TIMERS defined in
* target.h) */
@@ -224,8 +219,7 @@
int32_t OSTaskTmr3R[GKI_MAX_TASKS];
#endif
- /* Buffer related variables
- */
+ /* Buffer related variables */
BUFFER_HDR_T* OSTaskQFirst[GKI_MAX_TASKS]
[NUM_TASK_MBOX]; /* array of pointers to the first
event in the task mailbox */
@@ -233,34 +227,29 @@
[NUM_TASK_MBOX]; /* array of pointers to the last
event in the task mailbox */
- /* Define the buffer pool management variables
- */
+ /* Define the buffer pool management variables */
FREE_QUEUE_T freeq[GKI_NUM_TOTAL_BUF_POOLS];
uint16_t pool_buf_size[GKI_NUM_TOTAL_BUF_POOLS];
uint16_t pool_max_count[GKI_NUM_TOTAL_BUF_POOLS];
uint16_t pool_additions[GKI_NUM_TOTAL_BUF_POOLS];
- /* Define the buffer pool start addresses
- */
+ /* Define the buffer pool start addresses */
uint8_t* pool_start[GKI_NUM_TOTAL_BUF_POOLS]; /* array of pointers to the
start of each buffer pool */
- uint8_t*
- pool_end[GKI_NUM_TOTAL_BUF_POOLS]; /* array of pointers to the end of each
- buffer pool */
- uint16_t pool_size
- [GKI_NUM_TOTAL_BUF_POOLS]; /* actual size of the buffers in a pool */
+ uint8_t* pool_end[GKI_NUM_TOTAL_BUF_POOLS]; /* array of pointers to the end of
+ each buffer pool */
+ uint16_t pool_size[GKI_NUM_TOTAL_BUF_POOLS]; /* actual size of the buffers in
+ a pool */
/* Define the buffer pool access control variables */
- void* p_user_mempool; /* User O/S memory pool */
- uint16_t
- pool_access_mask; /* Bits are set if the corresponding buffer pool is a
- restricted pool */
+ void* p_user_mempool; /* User O/S memory pool */
+ uint16_t pool_access_mask; /* Bits are set if the corresponding buffer pool is
+ a restricted pool */
uint8_t pool_list[GKI_NUM_TOTAL_BUF_POOLS]; /* buffer pools arranged in the
order of size */
- uint8_t
- curr_total_no_of_pools; /* number of fixed buf pools + current number of
- dynamic pools */
+ uint8_t curr_total_no_of_pools; /* number of fixed buf pools + current number
+ of dynamic pools */
bool timer_nesting; /* flag to prevent timer interrupt nesting */
@@ -273,8 +262,7 @@
} tGKI_COM_CB;
-/* Internal GKI function prototypes
-*/
+/* Internal GKI function prototypes */
extern bool gki_chk_buf_damage(void*);
extern bool gki_chk_buf_owner(void*);
extern void gki_buffer_init(void);
diff --git a/src/gki/common/gki_time.cc b/src/gki/common/gki_time.cc
index 7dce1d4..5ad61ff 100644
--- a/src/gki/common/gki_time.cc
+++ b/src/gki/common/gki_time.cc
@@ -17,6 +17,7 @@
******************************************************************************/
#include <android-base/stringprintf.h>
#include <base/logging.h>
+
#include "gki_int.h"
/* Make sure that this has been defined in target.h */
@@ -681,9 +682,9 @@
p_timer_listq->last_ticks -= num_units_since_last_update;
/* If the last timer has expired set last_ticks to 0 so that other list
- * update
- * functions will calculate correctly
- */
+ * update
+ * functions will calculate correctly
+ */
if (p_timer_listq->last_ticks < 0) p_timer_listq->last_ticks = 0;
}
@@ -869,19 +870,20 @@
p_timer_listq->last_ticks -= p_tle->ticks;
}
- /* Unlink timer from the list.
- */
+ /* Unlink timer from the list. */
if (p_timer_listq->p_first == p_tle) {
p_timer_listq->p_first = p_tle->p_next;
- if (p_timer_listq->p_first != nullptr) p_timer_listq->p_first->p_prev = nullptr;
+ if (p_timer_listq->p_first != nullptr)
+ p_timer_listq->p_first->p_prev = nullptr;
if (p_timer_listq->p_last == p_tle) p_timer_listq->p_last = nullptr;
} else {
if (p_timer_listq->p_last == p_tle) {
p_timer_listq->p_last = p_tle->p_prev;
- if (p_timer_listq->p_last != nullptr) p_timer_listq->p_last->p_next = nullptr;
+ if (p_timer_listq->p_last != nullptr)
+ p_timer_listq->p_last->p_next = nullptr;
} else {
if (p_tle->p_next != nullptr && p_tle->p_next->p_prev == p_tle)
p_tle->p_next->p_prev = p_tle->p_prev;
diff --git a/src/gki/ulinux/gki_int.h b/src/gki/ulinux/gki_int.h
index 6736b62..f1ac1c5 100644
--- a/src/gki/ulinux/gki_int.h
+++ b/src/gki/ulinux/gki_int.h
@@ -19,6 +19,7 @@
#define GKI_INT_H
#include <pthread.h>
+
#include "gki_common.h"
/**********************************************************************
diff --git a/src/gki/ulinux/gki_ulinux.cc b/src/gki/ulinux/gki_ulinux.cc
index d6d81ed..c7dd7bc 100644
--- a/src/gki/ulinux/gki_ulinux.cc
+++ b/src/gki/ulinux/gki_ulinux.cc
@@ -15,13 +15,12 @@
* limitations under the License.
*
******************************************************************************/
+#include <android-base/stringprintf.h>
+#include <base/logging.h>
#include <errno.h>
#include <malloc.h>
#include <pthread.h> /* must be 1st header defined */
-#include <android-base/stringprintf.h>
-#include <base/logging.h>
-
#include "gki_int.h"
using android::base::StringPrintf;
@@ -43,8 +42,7 @@
#endif
-/* Define the structure that holds the GKI variables
-*/
+/* Define the structure that holds the GKI variables */
tGKI_CB gki_cb;
#define NANOSEC_PER_MILLISEC (1000000)
@@ -152,8 +150,7 @@
**
*******************************************************************************/
uint32_t GKI_get_os_tick_count(void) {
- /* TODO - add any OS specific code here
- **/
+ /* TODO - add any OS specific code here */
return (gki_cb.com.OSTicks);
}
@@ -355,7 +352,7 @@
*/
/* GKI_disable(); */
*p_run_cond = GKI_TIMER_TICK_STOP_COND;
-/* GKI_enable(); */
+ /* GKI_enable(); */
} else {
/* restart GKI_timer_update() loop */
*p_run_cond = GKI_TIMER_TICK_RUN_COND;
@@ -480,7 +477,7 @@
pthread_cond_wait(&gki_cb.os.gki_timer_cond, &gki_cb.os.gki_timer_mutex);
pthread_mutex_unlock(&gki_cb.os.gki_timer_mutex);
}
-/* potentially we need to adjust os gki_cb.com.OSTicks */
+ /* potentially we need to adjust os gki_cb.com.OSTicks */
#ifdef GKI_TICK_TIMER_DEBUG
DLOG_IF(INFO, nfc_debug_enabled)
@@ -1071,9 +1068,10 @@
}
GKI_disable();
if (gki_cb.com.OSRdyTbl[task_id] == TASK_DEAD) {
- GKI_enable();
- LOG(WARNING) << StringPrintf("%s: task_id %d was already stopped.", __func__, task_id);
- return;
+ GKI_enable();
+ LOG(WARNING) << StringPrintf("%s: task_id %d was already stopped.",
+ __func__, task_id);
+ return;
}
gki_cb.com.OSRdyTbl[task_id] = TASK_DEAD;
diff --git a/src/include/NfcAdaptation.h b/src/include/NfcAdaptation.h
index 8bbb9c2..4c63ea3 100644
--- a/src/include/NfcAdaptation.h
+++ b/src/include/NfcAdaptation.h
@@ -32,17 +32,17 @@
namespace V1_0 {
struct INfc;
struct INfcClientCallback;
-}
+} // namespace V1_0
namespace V1_1 {
struct INfc;
struct INfcClientCallback;
-}
+} // namespace V1_1
namespace V1_2 {
struct INfc;
}
-}
-}
-}
+} // namespace nfc
+} // namespace hardware
+} // namespace android
class ThreadMutex {
public:
diff --git a/src/include/buildcfg.h b/src/include/buildcfg.h
index d69ed55..92bfe63 100644
--- a/src/include/buildcfg.h
+++ b/src/include/buildcfg.h
@@ -21,6 +21,7 @@
#include <memory.h>
#include <stdio.h>
#include <string.h>
+
#include "data_types.h"
#ifndef NFC_CONTORLLER_ID
diff --git a/src/include/nci_defs.h b/src/include/nci_defs.h
index 355f095..4908c37 100644
--- a/src/include/nci_defs.h
+++ b/src/include/nci_defs.h
@@ -27,12 +27,11 @@
#include <stdint.h>
-/* Define the message header size for all NCI Commands and Notifications.
-*/
+/* Define the message header size for all NCI Commands and Notifications. */
#define NCI_MSG_HDR_SIZE 3 /* per NCI spec */
#define NCI_DATA_HDR_SIZE 3 /* per NCI spec */
#define NCI_MAX_PAYLOAD_SIZE 0xFE
-#define NCI_CTRL_INIT_SIZE 32 /* initial NFCC control payload size */
+#define NCI_CTRL_INIT_SIZE 32 /* initial NFCC control payload size */
#define NCI_MAX_VSC_SIZE 0xFF
#define APPL_DTA_MODE FALSE
/* NCI header (3) + callback function pointer(8; use 8 to be safe) + HCIT (1
@@ -244,7 +243,7 @@
#define NCI_CON_CREATE_TAG_RF_DISC_ID 0x00
#define NCI_CON_CREATE_TAG_NFCEE_VAL 0x01
-#define NCI_CORE_PARAM_SIZE_CON_CLOSE 0x01 /* Conn ID (1 octet) */
+#define NCI_CORE_PARAM_SIZE_CON_CLOSE 0x01 /* Conn ID (1 octet) */
/* Keep the NCI configuration and perform NCI initialization. */
#define NCI_RESET_TYPE_KEEP_CFG 0x00
@@ -263,12 +262,14 @@
#define NCI_DISCOVER_ACTION_DISABLE 0
#define NCI_DISCOVER_ACTION_ENABLE 1
-#define NCI_RF_PARAM_ID_TECH_N_MODE 0x00 /* RF Technology and Mode */
-#define NCI_RF_PARAM_ID_TX_BIT_RATE 0x01 /* Transmit Bit Rate */
-#define NCI_RF_PARAM_ID_RX_BIT_RATE 0x02 /* Receive Bit Rate */
-#define NCI_RF_PARAM_ID_B_DATA_EX_PARAM \
- 0x03 /* B Data Exchange config param \
- */
+/* RF Technology and Mode */
+#define NCI_RF_PARAM_ID_TECH_N_MODE 0x00
+/* Transmit Bit Rate */
+#define NCI_RF_PARAM_ID_TX_BIT_RATE 0x01
+/* Receive Bit Rate */
+#define NCI_RF_PARAM_ID_RX_BIT_RATE 0x02
+/* B Data Exchange config param */
+#define NCI_RF_PARAM_ID_B_DATA_EX_PARAM 0x03
#define NCI_NFCEE_INTERFACE_APDU 0x00
#define NCI_NFCEE_INTERFACE_HCI_ACCESS 0x01
@@ -322,8 +323,8 @@
typedef uint8_t tNCI_NFCEE_PL_CONFIG;
/**********************************************
-* NCI Interface Mode
-**********************************************/
+ * NCI Interface Mode
+ **********************************************/
#define NCI_INTERFACE_MODE_POLL_N_LISTEN 3
/**********************************************
@@ -342,8 +343,8 @@
* NCI RF Management / DISCOVERY Group Params
**********************************************/
-#define NCI_DISCOVER_PARAM_SIZE_SELECT 0x03 /* ID, protocol, interface */
-#define NCI_DISCOVER_PARAM_SIZE_DEACT 0x01 /* type */
+#define NCI_DISCOVER_PARAM_SIZE_SELECT 0x03 /* ID, protocol, interface */
+#define NCI_DISCOVER_PARAM_SIZE_DEACT 0x01 /* type */
/**********************************************
* Supported Protocols
@@ -381,8 +382,8 @@
#define NCI_EE_TRIG_RF_TECHNOLOGY 0x02
#define NCI_EE_TRIG_APP_INIT 0x10
-#define NCI_EE_ACT_TAG_AID 0xC0 /* AID */
-#define NCI_EE_ACT_TAG_DATA 0xC3 /* hex data for app */
+#define NCI_EE_ACT_TAG_AID 0xC0 /* AID */
+#define NCI_EE_ACT_TAG_DATA 0xC3 /* hex data for app */
/* NFCEE ID (1 octet) PL config (1 octet) */
#define NCI_CORE_PARAM_SIZE_NFCEE_PL_CTRL 0x02
@@ -391,7 +392,7 @@
#define NCI_ROUTE_TAG_TECH 0x00
/* Protocol based routing */
#define NCI_ROUTE_TAG_PROTO 0x01
-#define NCI_ROUTE_TAG_AID 0x02 /* AID routing */
+#define NCI_ROUTE_TAG_AID 0x02 /* AID routing */
#define NCI_ROUTE_TAG_SYSCODE 0x03 /* SystemCode routing */
#define NCI_ROUTE_PWR_STATE_ON 0x01 /* The device is on */
@@ -643,7 +644,9 @@
uint8_t ats_res[NCI_MAX_ATS_LEN]; /* ATS RES defined in [DIGPROT] */
} tNCI_INTF_PA_ISO_DEP;
-typedef struct { uint8_t rats; /* RATS */ } tNCI_INTF_LA_ISO_DEP;
+typedef struct {
+ uint8_t rats; /* RATS */
+} tNCI_INTF_LA_ISO_DEP;
#define NCI_P_GEN_BYTE_INDEX 15
#define NCI_L_GEN_BYTE_INDEX 14
diff --git a/src/include/nfc_brcm_defs.h b/src/include/nfc_brcm_defs.h
index d2a0d30..1cfdb64 100755
--- a/src/include/nfc_brcm_defs.h
+++ b/src/include/nfc_brcm_defs.h
@@ -49,9 +49,9 @@
#define NCI_INTERFACE_VS_MIFARE NCI_PROTOCOL_MIFARE
#define NCI_INTERFACE_VS_T2T_CE 0x82 /* for Card Emulation side */
-#define NFC_SNOOZE_MODE_UART 0x01 /* Snooze mode for UART */
+#define NFC_SNOOZE_MODE_UART 0x01 /* Snooze mode for UART */
-#define NFC_SNOOZE_ACTIVE_LOW 0x00 /* high to low voltage is asserting */
+#define NFC_SNOOZE_ACTIVE_LOW 0x00 /* high to low voltage is asserting */
/**********************************************
* HCI definitions
diff --git a/src/include/nfc_config.h b/src/include/nfc_config.h
index 62e47be..928dd4e 100644
--- a/src/include/nfc_config.h
+++ b/src/include/nfc_config.h
@@ -15,11 +15,11 @@
*/
#pragma once
+#include <config.h>
+
#include <string>
#include <vector>
-#include <config.h>
-
/* Configs from libnfc-nci.conf */
#define NAME_NFC_DEBUG_ENABLED "NFC_DEBUG_ENABLED"
#define NAME_NFA_STORAGE "NFA_STORAGE"
diff --git a/src/include/nfc_hal_int.h b/src/include/nfc_hal_int.h
index 8e6aa2e..18cd22b 100644
--- a/src/include/nfc_hal_int.h
+++ b/src/include/nfc_hal_int.h
@@ -203,7 +203,7 @@
uint8_t hci_netwk_config_block; /* Rsp awaiting for hci network configuration
block */
bool b_wait_hcp_conn_create_rsp; /* Waiting for hcp connection create response
- */
+ */
bool clear_all_pipes_to_uicc1; /* UICC1 was restarted for patch download */
bool update_session_id; /* Next response from NFCC is to Get Session id cmd */
bool hci_fw_workaround; /* HAL HCI Workaround need */
diff --git a/src/include/nfc_target.h b/src/include/nfc_target.h
index 8cf8c61..36b640e 100644
--- a/src/include/nfc_target.h
+++ b/src/include/nfc_target.h
@@ -26,9 +26,8 @@
#endif
/* Include common GKI definitions used by this platform */
-#include "gki_target.h"
-
#include "bt_types.h" /* This must be defined AFTER buildcfg.h */
+#include "gki_target.h"
#ifndef USERIAL_DEBUG
#define USERIAL_DEBUG FALSE
diff --git a/src/include/vendor_cfg.h b/src/include/vendor_cfg.h
index 5ebf0fb..649ed4b 100644
--- a/src/include/vendor_cfg.h
+++ b/src/include/vendor_cfg.h
@@ -41,8 +41,8 @@
extern tNFA_PROPRIETARY_CFG* p_nfa_proprietary_cfg;
/**********************************************
-* Proprietary Protocols
-**********************************************/
+ * Proprietary Protocols
+ **********************************************/
#ifndef NCI_PROTOCOL_18092_ACTIVE
#define NCI_PROTOCOL_18092_ACTIVE \
(p_nfa_proprietary_cfg->pro_protocol_18092_active)
@@ -64,8 +64,8 @@
#endif
/**********************************************
-* Proprietary Discovery technology and mode
-**********************************************/
+ * Proprietary Discovery technology and mode
+ **********************************************/
#ifndef NCI_DISCOVERY_TYPE_POLL_KOVIO
#define NCI_DISCOVERY_TYPE_POLL_KOVIO \
(p_nfa_proprietary_cfg->pro_discovery_kovio_poll)
diff --git a/src/nfa/ce/nfa_ce_act.cc b/src/nfa/ce/nfa_ce_act.cc
index 1efca7d..e508684 100644
--- a/src/nfa/ce/nfa_ce_act.cc
+++ b/src/nfa/ce/nfa_ce_act.cc
@@ -21,11 +21,10 @@
* This file contains the action functions the NFA_CE state machine.
*
******************************************************************************/
-#include <log/log.h>
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
+#include <log/log.h>
+#include <string.h>
#include "ce_api.h"
#include "ndef_utils.h"
@@ -41,8 +40,8 @@
extern bool nfc_debug_enabled;
/*****************************************************************************
-* Protocol-specific event handlers
-*****************************************************************************/
+ * Protocol-specific event handlers
+ *****************************************************************************/
/*******************************************************************************
**
@@ -268,8 +267,8 @@
}
/*****************************************************************************
-* Discovery configuration and discovery event handlers
-*****************************************************************************/
+ * Discovery configuration and discovery event handlers
+ *****************************************************************************/
/*******************************************************************************
**
@@ -522,8 +521,9 @@
/* register discovery callback to NFA DM */
disc_handle = nfa_dm_add_rf_discover(
listen_mask,
- (tNFA_DM_DISC_HOST_ID)(
- p_cb->listen_info[listen_info_idx].ee_handle & 0x00FF),
+ (tNFA_DM_DISC_HOST_ID)(p_cb->listen_info[listen_info_idx]
+ .ee_handle &
+ 0x00FF),
nfa_ce_discovery_cback);
if (disc_handle == NFA_HANDLE_INVALID)
@@ -1263,17 +1263,17 @@
(p_cb->listen_info[i].flags & NFA_CE_LISTEN_INFO_IN_USE) &&
(p_cb->listen_info[i].flags & NFA_CE_LISTEN_INFO_UICC) &&
(p_cb->listen_info[i].ee_handle == p_ce_msg->reg_listen.ee_handle)) {
- if(p_cb->listen_info[i].tech_mask == p_ce_msg->reg_listen.tech_mask) {
+ if (p_cb->listen_info[i].tech_mask == p_ce_msg->reg_listen.tech_mask) {
LOG(ERROR) << StringPrintf("UICC (0x%x) listening already specified",
- p_ce_msg->reg_listen.ee_handle);
+ p_ce_msg->reg_listen.ee_handle);
conn_evt.status = NFA_STATUS_FAILED;
nfa_dm_conn_cback_event_notify(NFA_CE_UICC_LISTEN_CONFIGURED_EVT,
- &conn_evt);
+ &conn_evt);
return true;
} else {
- DLOG_IF(INFO, nfc_debug_enabled)
- << StringPrintf("UICC (0x%x) listening parameter changed to %x",
- p_ce_msg->reg_listen.ee_handle, p_ce_msg->reg_listen.tech_mask);
+ DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
+ "UICC (0x%x) listening parameter changed to %x",
+ p_ce_msg->reg_listen.ee_handle, p_ce_msg->reg_listen.tech_mask);
listen_info_idx = i;
break;
}
diff --git a/src/nfa/ce/nfa_ce_api.cc b/src/nfa/ce/nfa_ce_api.cc
index 55ad70b..697fb8a 100644
--- a/src/nfa/ce/nfa_ce_api.cc
+++ b/src/nfa/ce/nfa_ce_api.cc
@@ -21,10 +21,9 @@
* NFA interface for card emulation
*
******************************************************************************/
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
+#include <string.h>
#include "nfa_api.h"
#include "nfa_ce_int.h"
diff --git a/src/nfa/ce/nfa_ce_main.cc b/src/nfa/ce/nfa_ce_main.cc
index 62f1370..4c3da7f 100644
--- a/src/nfa/ce/nfa_ce_main.cc
+++ b/src/nfa/ce/nfa_ce_main.cc
@@ -21,11 +21,11 @@
* This is the main implementation file for the NFA_CE
*
******************************************************************************/
-#include <string>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
+#include <string>
+
#include "nfa_ce_api.h"
#include "nfa_ce_int.h"
diff --git a/src/nfa/ee/nfa_ee_act.cc b/src/nfa/ee/nfa_ee_act.cc
index 73c224c..0999eaa 100644
--- a/src/nfa/ee/nfa_ee_act.cc
+++ b/src/nfa/ee/nfa_ee_act.cc
@@ -1315,7 +1315,7 @@
/* report NFA_EE_REMOVE_AID_EVT to the callback associated the NFCEE */
p_cback = p_cb->p_ee_cback;
} else {
- LOG(WARNING) << StringPrintf(
+ LOG(WARNING) << StringPrintf(
"nfa_ee_api_remove_aid The AID entry is not in the database");
evt_data.status = NFA_STATUS_INVALID_PARAM;
}
@@ -2097,7 +2097,7 @@
for (xx = 0; xx < nfa_ee_cb.cur_ee; xx++, p_cb++) {
if ((p_cb->ee_status & NFA_EE_STATUS_INT_MASK) ||
- (p_cb->ee_status != NFA_EE_STATUS_ACTIVE) ) {
+ (p_cb->ee_status != NFA_EE_STATUS_ACTIVE)) {
continue;
}
p_info->ee_handle = (tNFA_HANDLE)p_cb->nfcee_id | NFA_HANDLE_GROUP_EE;
@@ -2368,7 +2368,8 @@
evt_data.data.len = p_pkt->len;
evt_data.data.p_buf = (uint8_t*)(p_pkt + 1) + p_pkt->offset;
event = NFA_EE_DATA_EVT;
- p_pkt = nullptr; /* so this function does not free this GKI buffer */
+ p_pkt = nullptr;
+ /* so this function does not free this GKI buffer */
}
}
break;
diff --git a/src/nfa/ee/nfa_ee_api.cc b/src/nfa/ee/nfa_ee_api.cc
index 428ac21..5ad43c1 100644
--- a/src/nfa/ee/nfa_ee_api.cc
+++ b/src/nfa/ee/nfa_ee_api.cc
@@ -21,11 +21,12 @@
* NFA interface to NFCEE - API functions
*
******************************************************************************/
+#include "nfa_ee_api.h"
+
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include "nfa_dm_int.h"
-#include "nfa_ee_api.h"
#include "nfa_ee_int.h"
#include "nfc_int.h"
diff --git a/src/nfa/ee/nfa_ee_main.cc b/src/nfa/ee/nfa_ee_main.cc
index 6331771..77cda48 100644
--- a/src/nfa/ee/nfa_ee_main.cc
+++ b/src/nfa/ee/nfa_ee_main.cc
@@ -21,11 +21,11 @@
* This is the main implementation file for the NFA EE.
*
******************************************************************************/
-#include <string>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
+#include <string>
+
#include "nfa_dm_int.h"
#include "nfa_ee_int.h"
#include "nfc_config.h"
diff --git a/src/nfa/hci/nfa_hci_act.cc b/src/nfa/hci/nfa_hci_act.cc
index ae9c3b1..24844bb 100644
--- a/src/nfa/hci/nfa_hci_act.cc
+++ b/src/nfa/hci/nfa_hci_act.cc
@@ -21,11 +21,10 @@
* This file contains the action functions for the NFA HCI.
*
******************************************************************************/
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include <log/log.h>
+#include <string.h>
#include "nfa_dm_int.h"
#include "nfa_hci_api.h"
@@ -379,7 +378,7 @@
if (p_cback) p_cback(NFA_HCI_DEREGISTER_EVT, &evt_data);
} else {
/* Delete all active pipes created for the application before de registering
- **/
+ **/
nfa_hci_cb.hci_state = NFA_HCI_STATE_APP_DEREGISTER;
nfa_hciu_send_delete_pipe_cmd(p_pipe->pipe_id);
@@ -862,7 +861,8 @@
tNFA_HCI_EVT_DATA evt_data;
tNFA_HANDLE app_handle;
- if ((p_pipe = nfa_hciu_find_pipe_by_pid(p_evt_data->send_cmd.pipe)) != nullptr) {
+ if ((p_pipe = nfa_hciu_find_pipe_by_pid(p_evt_data->send_cmd.pipe)) !=
+ nullptr) {
app_handle = nfa_hciu_get_pipe_owner(p_evt_data->send_cmd.pipe);
if ((nfa_hciu_is_active_host(p_pipe->dest_host)) &&
@@ -918,7 +918,8 @@
tNFA_HCI_EVT_DATA evt_data;
tNFA_HANDLE app_handle;
- if ((p_pipe = nfa_hciu_find_pipe_by_pid(p_evt_data->send_rsp.pipe)) != nullptr) {
+ if ((p_pipe = nfa_hciu_find_pipe_by_pid(p_evt_data->send_rsp.pipe)) !=
+ nullptr) {
app_handle = nfa_hciu_get_pipe_owner(p_evt_data->send_rsp.pipe);
if ((nfa_hciu_is_active_host(p_pipe->dest_host)) &&
@@ -968,7 +969,8 @@
tNFA_HCI_EVT_DATA evt_data;
tNFA_HANDLE app_handle;
- if ((p_pipe = nfa_hciu_find_pipe_by_pid(p_evt_data->send_evt.pipe)) != nullptr) {
+ if ((p_pipe = nfa_hciu_find_pipe_by_pid(p_evt_data->send_evt.pipe)) !=
+ nullptr) {
app_handle = nfa_hciu_get_pipe_owner(p_evt_data->send_evt.pipe);
if ((nfa_hciu_is_active_host(p_pipe->dest_host)) &&
diff --git a/src/nfa/hci/nfa_hci_api.cc b/src/nfa/hci/nfa_hci_api.cc
index 252cae2..e0f15ed 100644
--- a/src/nfa/hci/nfa_hci_api.cc
+++ b/src/nfa/hci/nfa_hci_api.cc
@@ -21,10 +21,11 @@
* NFA interface to HCI
*
******************************************************************************/
+#include "nfa_hci_api.h"
+
#include <android-base/stringprintf.h>
#include <base/logging.h>
-#include "nfa_hci_api.h"
#include "nfa_hci_defs.h"
#include "nfa_hci_int.h"
diff --git a/src/nfa/hci/nfa_hci_ci.cc b/src/nfa/hci/nfa_hci_ci.cc
index 5e5e433..10864d0 100644
--- a/src/nfa/hci/nfa_hci_ci.cc
+++ b/src/nfa/hci/nfa_hci_ci.cc
@@ -22,6 +22,7 @@
*
******************************************************************************/
#include <string.h>
+
#include "nfa_hci_api.h"
#include "nfa_hci_int.h"
#include "nfa_nv_co.h"
diff --git a/src/nfa/hci/nfa_hci_main.cc b/src/nfa/hci/nfa_hci_main.cc
index 2ee1e03..5fbe03e 100644
--- a/src/nfa/hci/nfa_hci_main.cc
+++ b/src/nfa/hci/nfa_hci_main.cc
@@ -21,10 +21,9 @@
* This is the main implementation file for the NFA HCI.
*
******************************************************************************/
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
+#include <string.h>
#include "nfa_dm_int.h"
#include "nfa_ee_api.h"
diff --git a/src/nfa/hci/nfa_hci_utils.cc b/src/nfa/hci/nfa_hci_utils.cc
index 6a8db5d..009cbe5 100644
--- a/src/nfa/hci/nfa_hci_utils.cc
+++ b/src/nfa/hci/nfa_hci_utils.cc
@@ -21,12 +21,12 @@
* This file contains the utility functions for the NFA HCI.
*
******************************************************************************/
-#include <string>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include <log/log.h>
+#include <string>
+
#include "nfa_dm_int.h"
#include "nfa_hci_api.h"
#include "nfa_hci_defs.h"
diff --git a/src/nfa/rw/nfa_rw_act.cc b/src/nfa/rw/nfa_rw_act.cc
index 598944a..af93e1b 100644
--- a/src/nfa/rw/nfa_rw_act.cc
+++ b/src/nfa/rw/nfa_rw_act.cc
@@ -21,11 +21,10 @@
* This file contains the action functions the NFA_RW state machine.
*
******************************************************************************/
-#include <log/log.h>
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
+#include <log/log.h>
+#include <string.h>
#include "ndef_utils.h"
#include "nfa_dm_int.h"
diff --git a/src/nfa/rw/nfa_rw_api.cc b/src/nfa/rw/nfa_rw_api.cc
index cc7c7b6..927513e 100644
--- a/src/nfa/rw/nfa_rw_api.cc
+++ b/src/nfa/rw/nfa_rw_api.cc
@@ -21,11 +21,10 @@
* NFA interface for tag Reader/Writer
*
******************************************************************************/
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include <log/log.h>
+#include <string.h>
#include "nfa_api.h"
#include "nfa_rw_int.h"
@@ -766,8 +765,9 @@
if ((num_blocks == 0) || (t3t_blocks == nullptr))
return (NFA_STATUS_INVALID_PARAM);
- p_msg = (tNFA_RW_OPERATION*)GKI_getbuf((uint16_t)(
- sizeof(tNFA_RW_OPERATION) + (num_blocks * sizeof(tNFA_T3T_BLOCK_DESC))));
+ p_msg = (tNFA_RW_OPERATION*)GKI_getbuf(
+ (uint16_t)(sizeof(tNFA_RW_OPERATION) +
+ (num_blocks * sizeof(tNFA_T3T_BLOCK_DESC))));
if (p_msg != nullptr) {
/* point to area after tNFA_RW_OPERATION */
p_block_desc = (uint8_t*)(p_msg + 1);
diff --git a/src/nfa/rw/nfa_rw_main.cc b/src/nfa/rw/nfa_rw_main.cc
index 3cd7559..8ccbd0d 100644
--- a/src/nfa/rw/nfa_rw_main.cc
+++ b/src/nfa/rw/nfa_rw_main.cc
@@ -21,10 +21,9 @@
* This is the main implementation file for the NFA_RW
*
******************************************************************************/
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
+#include <string.h>
#include "nfa_dm_int.h"
#include "nfa_rw_api.h"
diff --git a/src/nfa/sys/nfa_sys_cfg.cc b/src/nfa/sys/nfa_sys_cfg.cc
index ccf01f2..b184479 100644
--- a/src/nfa/sys/nfa_sys_cfg.cc
+++ b/src/nfa/sys/nfa_sys_cfg.cc
@@ -27,9 +27,9 @@
#include "nfa_sys.h"
const tNFA_SYS_CFG nfa_sys_cfg = {
- NFA_MBOX_EVT_MASK, /* GKI mailbox event */
- NFA_MBOX_ID, /* GKI mailbox id */
- NFA_TIMER_ID, /* GKI timer id */
+ NFA_MBOX_EVT_MASK, /* GKI mailbox event */
+ NFA_MBOX_ID, /* GKI mailbox id */
+ NFA_TIMER_ID, /* GKI timer id */
};
tNFA_SYS_CFG* p_nfa_sys_cfg = (tNFA_SYS_CFG*)&nfa_sys_cfg;
diff --git a/src/nfa/sys/nfa_sys_main.cc b/src/nfa/sys/nfa_sys_main.cc
index 12224ae..5e15a2d 100644
--- a/src/nfa/sys/nfa_sys_main.cc
+++ b/src/nfa/sys/nfa_sys_main.cc
@@ -21,10 +21,9 @@
* This is the main implementation file for the NFA system manager.
*
******************************************************************************/
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
+#include <string.h>
#include "nfa_api.h"
#include "nfa_dm_int.h"
diff --git a/src/nfa/sys/nfa_sys_ptim.cc b/src/nfa/sys/nfa_sys_ptim.cc
index cc85f74..4f7cf88 100644
--- a/src/nfa/sys/nfa_sys_ptim.cc
+++ b/src/nfa/sys/nfa_sys_ptim.cc
@@ -21,10 +21,11 @@
* Protocol timer services (taken from bta ptim)
*
******************************************************************************/
+#include "nfa_sys_ptim.h"
+
#include <android-base/stringprintf.h>
#include <base/logging.h>
-#include "nfa_sys_ptim.h"
#include "nfa_sys.h"
using android::base::StringPrintf;
diff --git a/src/nfc/ndef/ndef_utils.cc b/src/nfc/ndef/ndef_utils.cc
index 6a95ebe..787c562 100644
--- a/src/nfc/ndef/ndef_utils.cc
+++ b/src/nfc/ndef/ndef_utils.cc
@@ -23,6 +23,7 @@
*
******************************************************************************/
#include "ndef_utils.h"
+
#include <log/log.h>
#include <string.h>
@@ -204,8 +205,8 @@
}
p_new = p_rec + (payload_len + type_len + id_len);
if (p_rec > p_new || p_end < p_new) {
- android_errorWriteLog(0x534e4554, "126200054");
- return (NDEF_MSG_LENGTH_MISMATCH);
+ android_errorWriteLog(0x534e4554, "126200054");
+ return (NDEF_MSG_LENGTH_MISMATCH);
}
/* Point to next record */
diff --git a/src/nfc/tags/ce_main.cc b/src/nfc/tags/ce_main.cc
index 1afc848..b211f4d 100644
--- a/src/nfc/tags/ce_main.cc
+++ b/src/nfc/tags/ce_main.cc
@@ -23,17 +23,15 @@
* (callback). On the transmit side, it manages the command transmission.
*
******************************************************************************/
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include <log/log.h>
-
-#include "nfc_target.h"
+#include <string.h>
#include "bt_types.h"
#include "ce_api.h"
#include "ce_int.h"
+#include "nfc_target.h"
using android::base::StringPrintf;
diff --git a/src/nfc/tags/ce_t3t.cc b/src/nfc/tags/ce_t3t.cc
index f2a0229..906339e 100644
--- a/src/nfc/tags/ce_t3t.cc
+++ b/src/nfc/tags/ce_t3t.cc
@@ -22,17 +22,15 @@
* mode.
*
******************************************************************************/
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include <log/log.h>
-
-#include "nfc_target.h"
+#include <string.h>
#include "bt_types.h"
#include "ce_api.h"
#include "ce_int.h"
+#include "nfc_target.h"
using android::base::StringPrintf;
@@ -53,8 +51,8 @@
#define CE_T3T_UPDATE_FL_UPDATE 0x04
/*******************************************************************************
-* Static constant definitions
-*******************************************************************************/
+ * Static constant definitions
+ *******************************************************************************/
/* Default PMm param */
static const uint8_t CE_DEFAULT_LF_PMM[NCI_T3T_PMM_LEN] = {
0x01, /* This PAD0 is used to identify HCE-F on Android */
@@ -478,8 +476,9 @@
T3T_MSG_BLOCKSIZE);
} else {
ARRAY_TO_STREAM(
- p_dst, (&p_cb->ndef_info
- .p_buf[(block_number - 1) * T3T_MSG_BLOCKSIZE]),
+ p_dst,
+ (&p_cb->ndef_info
+ .p_buf[(block_number - 1) * T3T_MSG_BLOCKSIZE]),
T3T_MSG_BLOCKSIZE);
}
}
@@ -691,9 +690,8 @@
0) {
LOG(ERROR) << StringPrintf(
"CE: received invalid T3t message (invalid NFCID2)");
- p_nfcid2 =
- cmd_nfcid2; /* respond with ERROR using the NFCID2 from the
- command message */
+ p_nfcid2 = cmd_nfcid2; /* respond with ERROR using the NFCID2 from
+ the command message */
} else if (p_msg->len < block_list_start_offset) {
/* Does not have minimum (including number_of_blocks field) */
LOG(ERROR) << StringPrintf("CE: incomplete message");
@@ -885,9 +883,10 @@
/* Save ndef attributes */
else {
p_cb->ndef_info.initialized = true;
- p_cb->ndef_info.ln = size_current; /* Current length */
- p_cb->ndef_info.nmaxb = (uint16_t)(
- (size_max + 15) / T3T_MSG_BLOCKSIZE); /* Max length (in blocks) */
+ /* Current length */
+ p_cb->ndef_info.ln = size_current;
+ /* Max length (in blocks) */
+ p_cb->ndef_info.nmaxb = (uint16_t)((size_max + 15) / T3T_MSG_BLOCKSIZE);
p_cb->ndef_info.rwflag =
(read_only) ? T3T_MSG_NDEF_RWFLAG_RO : T3T_MSG_NDEF_RWFLAG_RW;
p_cb->ndef_info.writef = T3T_MSG_NDEF_WRITEF_OFF;
diff --git a/src/nfc/tags/ce_t4t.cc b/src/nfc/tags/ce_t4t.cc
index a4196a2..5d41ead 100644
--- a/src/nfc/tags/ce_t4t.cc
+++ b/src/nfc/tags/ce_t4t.cc
@@ -22,18 +22,16 @@
* mode.
*
******************************************************************************/
-#include <log/log.h>
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
-
-#include "nfc_target.h"
+#include <log/log.h>
+#include <string.h>
#include "bt_types.h"
#include "ce_api.h"
#include "ce_int.h"
#include "nfc_int.h"
+#include "nfc_target.h"
#include "tags_int.h"
using android::base::StringPrintf;
diff --git a/src/nfc/tags/rw_i93.cc b/src/nfc/tags/rw_i93.cc
index 1aa5836..531ae75 100644
--- a/src/nfc/tags/rw_i93.cc
+++ b/src/nfc/tags/rw_i93.cc
@@ -22,17 +22,15 @@
* mode.
*
******************************************************************************/
-#include <log/log.h>
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
-
-#include "nfc_target.h"
+#include <log/log.h>
+#include <string.h>
#include "bt_types.h"
#include "nfc_api.h"
#include "nfc_int.h"
+#include "nfc_target.h"
#include "rw_api.h"
#include "rw_int.h"
@@ -142,32 +140,32 @@
}
} else if ((p_uid[1] == I93_UID_IC_MFG_CODE_ONS) &&
(p_i93->info_flags & I93_INFO_FLAG_IC_REF)) {
- switch (p_i93->ic_reference) {
- case I93_IC_REF_ONS_N36RW02:
- p_i93->product_version = RW_I93_ONS_N36RW02;
- break;
- case I93_IC_REF_ONS_N24RF04:
- p_i93->product_version = RW_I93_ONS_N24RF04;
- break;
- case I93_IC_REF_ONS_N24RF04E:
- p_i93->product_version = RW_I93_ONS_N24RF04E;
- break;
- case I93_IC_REF_ONS_N24RF16:
- p_i93->product_version = RW_I93_ONS_N24RF16;
- break;
- case I93_IC_REF_ONS_N24RF16E:
- p_i93->product_version = RW_I93_ONS_N24RF16E;
- break;
- case I93_IC_REF_ONS_N24RF64:
- p_i93->product_version = RW_I93_ONS_N24RF64;
- break;
- case I93_IC_REF_ONS_N24RF64E:
- p_i93->product_version = RW_I93_ONS_N24RF64E;
- break;
- default:
- p_i93->product_version = RW_I93_UNKNOWN_PRODUCT;
+ switch (p_i93->ic_reference) {
+ case I93_IC_REF_ONS_N36RW02:
+ p_i93->product_version = RW_I93_ONS_N36RW02;
break;
- }
+ case I93_IC_REF_ONS_N24RF04:
+ p_i93->product_version = RW_I93_ONS_N24RF04;
+ break;
+ case I93_IC_REF_ONS_N24RF04E:
+ p_i93->product_version = RW_I93_ONS_N24RF04E;
+ break;
+ case I93_IC_REF_ONS_N24RF16:
+ p_i93->product_version = RW_I93_ONS_N24RF16;
+ break;
+ case I93_IC_REF_ONS_N24RF16E:
+ p_i93->product_version = RW_I93_ONS_N24RF16E;
+ break;
+ case I93_IC_REF_ONS_N24RF64:
+ p_i93->product_version = RW_I93_ONS_N24RF64;
+ break;
+ case I93_IC_REF_ONS_N24RF64E:
+ p_i93->product_version = RW_I93_ONS_N24RF64E;
+ break;
+ default:
+ p_i93->product_version = RW_I93_UNKNOWN_PRODUCT;
+ break;
+ }
} else {
p_i93->product_version = RW_I93_UNKNOWN_PRODUCT;
}
@@ -265,7 +263,8 @@
rw_i93_get_product_version(p_uid);
if (p_i93->uid[0] == I93_UID_FIRST_BYTE) {
- if ((p_i93->uid[1] == I93_UID_IC_MFG_CODE_STM) || (p_i93->uid[1] == I93_UID_IC_MFG_CODE_ONS)){
+ if ((p_i93->uid[1] == I93_UID_IC_MFG_CODE_STM) ||
+ (p_i93->uid[1] == I93_UID_IC_MFG_CODE_ONS)) {
/* STM & ONS supports more than 2040 bytes */
p_i93->intl_flags |= RW_I93_FLAG_EXT_COMMANDS;
}
@@ -411,28 +410,28 @@
** N24RF64: 01101010(b), blockSize: 4, numberBlocks: 0x800
** N24RF64E: 01101110(b), blockSize: 4, numberBlocks: 0x800
*/
- p_i93->block_size = 4;
- switch (p_i93->product_version){
- case RW_I93_ONS_N36RW02:
- p_i93->num_block = 0x40;
- break;
- case RW_I93_ONS_N24RF04:
- case RW_I93_ONS_N24RF04E:
- p_i93->num_block = 0x80;
- break;
- case RW_I93_ONS_N24RF16:
- case RW_I93_ONS_N24RF16E:
- p_i93->num_block = 0x200;
- p_i93->intl_flags |= RW_I93_FLAG_16BIT_NUM_BLOCK;
- break;
- case RW_I93_ONS_N24RF64:
- case RW_I93_ONS_N24RF64E:
- p_i93->num_block = 0x800;
- p_i93->intl_flags |= RW_I93_FLAG_16BIT_NUM_BLOCK;
- break;
- default:
- return false;
- }
+ p_i93->block_size = 4;
+ switch (p_i93->product_version) {
+ case RW_I93_ONS_N36RW02:
+ p_i93->num_block = 0x40;
+ break;
+ case RW_I93_ONS_N24RF04:
+ case RW_I93_ONS_N24RF04E:
+ p_i93->num_block = 0x80;
+ break;
+ case RW_I93_ONS_N24RF16:
+ case RW_I93_ONS_N24RF16E:
+ p_i93->num_block = 0x200;
+ p_i93->intl_flags |= RW_I93_FLAG_16BIT_NUM_BLOCK;
+ break;
+ case RW_I93_ONS_N24RF64:
+ case RW_I93_ONS_N24RF64E:
+ p_i93->num_block = 0x800;
+ p_i93->intl_flags |= RW_I93_FLAG_16BIT_NUM_BLOCK;
+ break;
+ default:
+ return false;
+ }
}
}
}
@@ -455,7 +454,8 @@
DLOG_IF(INFO, nfc_debug_enabled) << __func__;
- if (((p_i93->uid[1] == I93_UID_IC_MFG_CODE_STM) || (p_i93->uid[1] == I93_UID_IC_MFG_CODE_ONS)) &&
+ if (((p_i93->uid[1] == I93_UID_IC_MFG_CODE_STM) ||
+ (p_i93->uid[1] == I93_UID_IC_MFG_CODE_ONS)) &&
(p_i93->sent_cmd == I93_CMD_GET_SYS_INFO) &&
(error_code == I93_ERROR_CODE_OPTION_NOT_SUPPORTED) &&
(rw_i93_send_cmd_get_sys_info(nullptr, I93_FLAG_PROT_EXT_YES) ==
@@ -1720,9 +1720,9 @@
*/
if ((p_i93->product_version == RW_I93_ONS_N36RW02) ||
(p_i93->product_version == RW_I93_ONS_N24RF04) ||
- (p_i93->product_version == RW_I93_ONS_N24RF04E)||
+ (p_i93->product_version == RW_I93_ONS_N24RF04E) ||
(p_i93->product_version == RW_I93_ONS_N24RF16) ||
- (p_i93->product_version == RW_I93_ONS_N24RF16E)||
+ (p_i93->product_version == RW_I93_ONS_N24RF16E) ||
(p_i93->product_version == RW_I93_ONS_N24RF64) ||
(p_i93->product_version == RW_I93_ONS_N24RF64E)) {
if (num_block > I93_ONS_MAX_BLOCKS_PER_READ)
@@ -2288,8 +2288,8 @@
if (p_resp->len > 0) {
(*(rw_cb.p_cback))(RW_I93_NDEF_READ_EVT, &rw_data);
} else {
- // free buffer, if len == 0
- GKI_freebuf(p_resp);
+ // free buffer, if len == 0
+ GKI_freebuf(p_resp);
}
/* this will make read data from next block */
@@ -2849,7 +2849,7 @@
/* Capability Container */
*(p++) = I93_ICODE_CC_MAGIC_NUMER_E1; /* magic number */
- *(p++) = 0x40; /* version 1.0, read/write */
+ *(p++) = 0x40; /* version 1.0, read/write */
/* if memory size is less than 2048 bytes */
if (((p_i93->num_block * p_i93->block_size) / 8) < 0x100)
diff --git a/src/nfc/tags/rw_main.cc b/src/nfc/tags/rw_main.cc
index abd8bbe..6a39ff6 100644
--- a/src/nfc/tags/rw_main.cc
+++ b/src/nfc/tags/rw_main.cc
@@ -22,19 +22,17 @@
* On the receive side, it routes events to the appropriate handler
* (callback). On the transmit side, it manages the command transmission.
*
-******************************************************************************/
-#include <string.h>
-
+ ******************************************************************************/
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include <log/log.h>
-
-#include "nfc_target.h"
+#include <string.h>
#include "bt_types.h"
#include "nci_hmsgs.h"
#include "nfc_api.h"
#include "nfc_int.h"
+#include "nfc_target.h"
#include "rw_api.h"
#include "rw_int.h"
@@ -46,14 +44,12 @@
/*******************************************************************************
*******************************************************************************/
-void rw_init(void) {
- memset(&rw_cb, 0, sizeof(tRW_CB));
-}
+void rw_init(void) { memset(&rw_cb, 0, sizeof(tRW_CB)); }
#if (RW_STATS_INCLUDED == TRUE)
/*******************************************************************************
-* Internal functions for statistics
-*******************************************************************************/
+ * Internal functions for statistics
+ *******************************************************************************/
/*******************************************************************************
**
** Function rw_main_reset_stats
diff --git a/src/nfc/tags/rw_mfc.cc b/src/nfc/tags/rw_mfc.cc
index ed4fda1..73cdc74 100644
--- a/src/nfc/tags/rw_mfc.cc
+++ b/src/nfc/tags/rw_mfc.cc
@@ -24,12 +24,12 @@
#include <base/logging.h>
#include <log/log.h>
#include <string.h>
-#include "bt_types.h"
-#include "nfc_target.h"
+#include "bt_types.h"
#include "gki.h"
#include "nfc_api.h"
#include "nfc_int.h"
+#include "nfc_target.h"
#include "rw_api.h"
#include "rw_int.h"
#include "tags_int.h"
@@ -397,7 +397,7 @@
} else {
UINT8_TO_BE_STREAM(p, 0x03);
UINT8_TO_BE_STREAM(p, 0xFF);
- UINT8_TO_BE_STREAM(p, (uint8_t)(p_mfc->ndef_length >>8));
+ UINT8_TO_BE_STREAM(p, (uint8_t)(p_mfc->ndef_length >> 8));
UINT8_TO_BE_STREAM(p, (uint8_t)(p_mfc->ndef_length & 0xFF));
index = index + 4;
}
diff --git a/src/nfc/tags/rw_t1t.cc b/src/nfc/tags/rw_t1t.cc
index 97c504a..0c36b8d 100644
--- a/src/nfc/tags/rw_t1t.cc
+++ b/src/nfc/tags/rw_t1t.cc
@@ -22,17 +22,16 @@
* mode.
*
******************************************************************************/
-#include <string>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
-#include "nfc_target.h"
+#include <string>
#include "gki.h"
#include "nci_hmsgs.h"
#include "nfc_api.h"
#include "nfc_int.h"
+#include "nfc_target.h"
#include "rw_api.h"
#include "rw_int.h"
@@ -143,7 +142,7 @@
} else {
/* Stop timer as some response to current command is received */
nfc_stop_quick_timer(&p_t1t->timer);
-/* Retrasmit the last sent command if retry-count < max retry */
+ /* Retrasmit the last sent command if retry-count < max retry */
LOG(ERROR) << StringPrintf(
"T1T Frame error. state=%s command (opcode) = 0x%02x",
rw_t1t_get_state_name(p_t1t->state).c_str(), p_cmd_rsp_info->opcode);
@@ -588,9 +587,9 @@
/* allocate a new buffer for message */
p_cmd_buf = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (p_cmd_buf != nullptr) {
- memcpy(p_cmd_buf, p_t1t->p_cur_cmd_buf, sizeof(NFC_HDR) +
- p_t1t->p_cur_cmd_buf->offset +
- p_t1t->p_cur_cmd_buf->len);
+ memcpy(p_cmd_buf, p_t1t->p_cur_cmd_buf,
+ sizeof(NFC_HDR) + p_t1t->p_cur_cmd_buf->offset +
+ p_t1t->p_cur_cmd_buf->len);
#if (RW_STATS_INCLUDED == TRUE)
/* Update stats */
diff --git a/src/nfc/tags/rw_t1t_ndef.cc b/src/nfc/tags/rw_t1t_ndef.cc
index e428bd5..8cfa914 100644
--- a/src/nfc/tags/rw_t1t_ndef.cc
+++ b/src/nfc/tags/rw_t1t_ndef.cc
@@ -22,15 +22,14 @@
* Reader/Writer mode.
*
******************************************************************************/
-#include <string>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
-#include "nfc_target.h"
+#include <string>
#include "nci_hmsgs.h"
#include "nfc_api.h"
+#include "nfc_target.h"
#include "rw_api.h"
#include "rw_int.h"
@@ -264,7 +263,7 @@
}
} else {
/* If NDEF is not yet detected then Tag remains in Initialized state
- * after NDEF Detection the Tag state may be updated */
+ * after NDEF Detection the Tag state may be updated */
p_t1t->tag_attribute = RW_T1_TAG_ATTRB_INITIALIZED;
}
} else {
@@ -1234,8 +1233,9 @@
p_t1t->segment = (p_t1t->block_read * T1T_BLOCK_SIZE) / T1T_SEGMENT_SIZE;
while (index < T1T_BLOCK_SIZE &&
p_t1t->work_offset < p_t1t->ndef_msg_len) {
- if (rw_t1t_is_lock_reserved_otp_byte((uint16_t)(
- (p_t1t->block_read * T1T_BLOCK_SIZE) + index)) == false) {
+ if (rw_t1t_is_lock_reserved_otp_byte(
+ (uint16_t)((p_t1t->block_read * T1T_BLOCK_SIZE) + index)) ==
+ false) {
p_t1t->p_ndef_buffer[p_t1t->work_offset] = p_data[index];
p_t1t->work_offset++;
}
@@ -1268,8 +1268,8 @@
if ((p_t1t->hr[0] & 0x0F) != 1) {
if ((p_t1t->ndef_msg_len - p_t1t->work_offset) <= T1T_BLOCK_SIZE) {
p_t1t->block_read++;
- ndef_status = rw_t1t_send_dyn_cmd(T1T_CMD_READ8,
- (uint8_t)(p_t1t->block_read), nullptr);
+ ndef_status = rw_t1t_send_dyn_cmd(
+ T1T_CMD_READ8, (uint8_t)(p_t1t->block_read), nullptr);
if (ndef_status == NFC_STATUS_OK) {
ndef_status = NFC_STATUS_CONTINUE;
}
@@ -1606,7 +1606,8 @@
if ((p_t1t->hr[0] & 0xF0) == T1T_NDEF_SUPPORTED)
flags |= RW_NDEF_FL_SUPPORTED;
- if (t1t_tag_init_data(p_t1t->hr[0]) != nullptr) flags |= RW_NDEF_FL_FORMATABLE;
+ if (t1t_tag_init_data(p_t1t->hr[0]) != nullptr)
+ flags |= RW_NDEF_FL_FORMATABLE;
if ((p_t1t->mem[T1T_CC_RWA_BYTE] & 0x0F) == T1T_CC_RWA_RO)
flags |= RW_NDEF_FL_READ_ONLY;
diff --git a/src/nfc/tags/rw_t2t.cc b/src/nfc/tags/rw_t2t.cc
index 2f3841e..fa508dd 100644
--- a/src/nfc/tags/rw_t2t.cc
+++ b/src/nfc/tags/rw_t2t.cc
@@ -22,18 +22,17 @@
* mode.
*
******************************************************************************/
-#include <string>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
-#include "nfc_target.h"
+#include <string>
#include "bt_types.h"
#include "gki.h"
#include "nci_hmsgs.h"
#include "nfc_api.h"
#include "nfc_int.h"
+#include "nfc_target.h"
#include "rw_api.h"
#include "rw_int.h"
@@ -498,9 +497,9 @@
/* allocate a new buffer for message */
p_cmd_buf = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (p_cmd_buf != nullptr) {
- memcpy(p_cmd_buf, p_t2t->p_cur_cmd_buf, sizeof(NFC_HDR) +
- p_t2t->p_cur_cmd_buf->offset +
- p_t2t->p_cur_cmd_buf->len);
+ memcpy(p_cmd_buf, p_t2t->p_cur_cmd_buf,
+ sizeof(NFC_HDR) + p_t2t->p_cur_cmd_buf->offset +
+ p_t2t->p_cur_cmd_buf->len);
#if (RW_STATS_INCLUDED == TRUE)
/* Update stats */
rw_main_update_tx_stats(p_cmd_buf->len, true);
@@ -609,9 +608,9 @@
/* allocate a new buffer for message */
p_cmd_buf = (NFC_HDR*)GKI_getpoolbuf(NFC_RW_POOL_ID);
if (p_cmd_buf != nullptr) {
- memcpy(p_cmd_buf, p_t2t->p_sec_cmd_buf, sizeof(NFC_HDR) +
- p_t2t->p_sec_cmd_buf->offset +
- p_t2t->p_sec_cmd_buf->len);
+ memcpy(p_cmd_buf, p_t2t->p_sec_cmd_buf,
+ sizeof(NFC_HDR) + p_t2t->p_sec_cmd_buf->offset +
+ p_t2t->p_sec_cmd_buf->len);
memcpy(p_t2t->p_cur_cmd_buf, p_t2t->p_sec_cmd_buf,
sizeof(NFC_HDR) + p_t2t->p_sec_cmd_buf->offset +
p_t2t->p_sec_cmd_buf->len);
diff --git a/src/nfc/tags/rw_t2t_ndef.cc b/src/nfc/tags/rw_t2t_ndef.cc
index cc620e0..5564c94 100644
--- a/src/nfc/tags/rw_t2t_ndef.cc
+++ b/src/nfc/tags/rw_t2t_ndef.cc
@@ -22,16 +22,14 @@
* Reader/Writer mode.
*
******************************************************************************/
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include <log/log.h>
-
-#include "nfc_target.h"
+#include <string.h>
#include "nci_hmsgs.h"
#include "nfc_api.h"
+#include "nfc_target.h"
#include "rw_api.h"
#include "rw_int.h"
@@ -738,7 +736,8 @@
/* If not found and not failed, read next block and search tlv */
if (!found && !failed) {
if (p_t2t->work_offset >=
- (p_t2t->tag_hdr[T2T_CC2_TMS_BYTE] * T2T_TMS_TAG_FACTOR + T2T_FIRST_DATA_BLOCK * T2T_BLOCK_LEN)) {
+ (p_t2t->tag_hdr[T2T_CC2_TMS_BYTE] * T2T_TMS_TAG_FACTOR +
+ T2T_FIRST_DATA_BLOCK * T2T_BLOCK_LEN)) {
if (((tlvtype == TAG_LOCK_CTRL_TLV) && (p_t2t->num_lockbytes > 0)) ||
((tlvtype == TAG_MEM_CTRL_TLV) && (p_t2t->num_mem_tlvs > 0))) {
found = true;
@@ -746,7 +745,8 @@
failed = true;
}
} else {
- if (rw_t2t_read((uint16_t)(p_t2t->work_offset / T2T_BLOCK_LEN) ) != NFC_STATUS_OK)
+ if (rw_t2t_read((uint16_t)(p_t2t->work_offset / T2T_BLOCK_LEN)) !=
+ NFC_STATUS_OK)
failed = true;
}
}
@@ -967,7 +967,6 @@
return status;
}
-
/*******************************************************************************
**
** Function rw_t2t_read_ndef_next_block
@@ -1902,10 +1901,11 @@
next_block = T2T_FIRST_DATA_BLOCK;
p = p_t2t->ndef_final_block;
} else {
- addr = (uint16_t)(
- ((uint16_t)p_t2t->tag_data[2] << 8 | p_t2t->tag_data[3]) *
- ((uint16_t)p_t2t->tag_data[4] << 8 | p_t2t->tag_data[5]) +
- T2T_STATIC_SIZE);
+ addr = (uint16_t)(((uint16_t)p_t2t->tag_data[2] << 8 |
+ p_t2t->tag_data[3]) *
+ ((uint16_t)p_t2t->tag_data[4] << 8 |
+ p_t2t->tag_data[5]) +
+ T2T_STATIC_SIZE);
locked_area = ((uint16_t)p_t2t->tag_data[2] << 8 | p_t2t->tag_data[3]) *
((uint16_t)p_t2t->tag_data[6]);
@@ -1926,7 +1926,8 @@
UINT8_TO_BE_STREAM(p, TAG_NDEF_TLV);
UINT8_TO_BE_STREAM(p, 0);
- if (((p_ret = t2t_tag_init_data(p_t2t->tag_hdr[0], false, 0)) != nullptr) &&
+ if (((p_ret = t2t_tag_init_data(p_t2t->tag_hdr[0], false, 0)) !=
+ nullptr) &&
(!p_ret->b_otp)) {
UINT8_TO_BE_STREAM(p, TAG_TERMINATOR_TLV);
} else
diff --git a/src/nfc/tags/rw_t3t.cc b/src/nfc/tags/rw_t3t.cc
index 2905e02..b29f100 100644
--- a/src/nfc/tags/rw_t3t.cc
+++ b/src/nfc/tags/rw_t3t.cc
@@ -22,18 +22,16 @@
* mode.
*
******************************************************************************/
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
#include <log/log.h>
-
-#include "nfc_target.h"
+#include <string.h>
#include "bt_types.h"
#include "nci_hmsgs.h"
#include "nfc_api.h"
#include "nfc_int.h"
+#include "nfc_target.h"
#include "rw_api.h"
#include "rw_int.h"
@@ -168,16 +166,17 @@
RW_T3T_DEFAULT_FELICALITE_NBW, /* NBw (max block write per cmd)*/
(RW_T3T_DEFAULT_FELICALITE_NMAXB >> 8), /* Nmaxb (max size in blocks) */
(RW_T3T_DEFAULT_FELICALITE_NMAXB & 0xFF), /* Nmaxb (max size in blocks) */
- 0, 0, 0, 0, /* Unused */
- T3T_MSG_NDEF_WRITEF_OFF, /* WriteF */
- T3T_MSG_NDEF_RWFLAG_RW, /* RW Flag */
- 0, 0, 0, /* Ln (current size in bytes) */
-
- (RW_T3T_DEFAULT_FELICALITE_ATTRIB_INFO_CHECKSUM >>
- 8), /* checksum (high-byte) */
- (RW_T3T_DEFAULT_FELICALITE_ATTRIB_INFO_CHECKSUM &
- 0xFF) /* checksum (low-byte) */
-
+ 0, /* Unused */
+ 0, /* Unused */
+ 0, /* Unused */
+ 0, /* Unused */
+ T3T_MSG_NDEF_WRITEF_OFF, /* WriteF */
+ T3T_MSG_NDEF_RWFLAG_RW, /* RW Flag */
+ 0, /* Byte 11-13 Ln (current size in bytes) */
+ 0, /* Byte 11-13 Ln (current size in bytes) */
+ 0, /* Byte 11-13 Ln (current size in bytes) */
+ (RW_T3T_DEFAULT_FELICALITE_ATTRIB_INFO_CHECKSUM >> 8), /* checksum */
+ (RW_T3T_DEFAULT_FELICALITE_ATTRIB_INFO_CHECKSUM & 0xFF) /* checksum */
};
/* This is (T/t3t * 4^E) , E is the index of the array. The unit is .0001 ms */
@@ -269,9 +268,9 @@
/* allocate a new buffer for message */
p_cmd_buf = rw_t3t_get_cmd_buf();
if (p_cmd_buf != nullptr) {
- memcpy(p_cmd_buf, p_cb->p_cur_cmd_buf, sizeof(NFC_HDR) +
- p_cb->p_cur_cmd_buf->offset +
- p_cb->p_cur_cmd_buf->len);
+ memcpy(p_cmd_buf, p_cb->p_cur_cmd_buf,
+ sizeof(NFC_HDR) + p_cb->p_cur_cmd_buf->offset +
+ p_cb->p_cur_cmd_buf->len);
if (rw_t3t_send_to_lower(p_cmd_buf) == NFC_STATUS_OK) {
/* Start timer for waiting for response */
@@ -504,13 +503,13 @@
/* Check which timer timed out */
if (p_tle == &p_cb->timer) {
-/* UPDATE/CHECK response timeout */
-LOG(ERROR) << StringPrintf("T3T timeout. state=%s cur_cmd=0x%02X (%s)",
- rw_t3t_state_str(rw_cb.tcb.t3t.rw_state).c_str(),
- rw_cb.tcb.t3t.cur_cmd,
- rw_t3t_cmd_str(rw_cb.tcb.t3t.cur_cmd).c_str());
+ /* UPDATE/CHECK response timeout */
+ LOG(ERROR) << StringPrintf("T3T timeout. state=%s cur_cmd=0x%02X (%s)",
+ rw_t3t_state_str(rw_cb.tcb.t3t.rw_state).c_str(),
+ rw_cb.tcb.t3t.cur_cmd,
+ rw_t3t_cmd_str(rw_cb.tcb.t3t.cur_cmd).c_str());
-rw_t3t_process_error(NFC_STATUS_TIMEOUT);
+ rw_t3t_process_error(NFC_STATUS_TIMEOUT);
} else {
LOG(ERROR) << StringPrintf("T3T POLL timeout.");
@@ -1335,23 +1334,18 @@
* compatible with our version. */
/* Update NDEF info */
- STREAM_TO_UINT8(
- p_cb->ndef_attrib.nbr,
- p); /* NBr: number of blocks that can be read using one Check
- command */
- STREAM_TO_UINT8(p_cb->ndef_attrib.nbw,
- p); /* Nbw: number of blocks that can be written using
- one Update command */
- BE_STREAM_TO_UINT16(
- p_cb->ndef_attrib.nmaxb,
- p); /* Nmaxb: maximum number of blocks available for NDEF data */
+ /* NBr: number of blocks that can be read using one Check command */
+ STREAM_TO_UINT8(p_cb->ndef_attrib.nbr, p);
+ /* Nbw: number of blocks that can be written using one Update command */
+ STREAM_TO_UINT8(p_cb->ndef_attrib.nbw, p);
+ /* Nmaxb: maximum number of blocks available for NDEF data */
+ BE_STREAM_TO_UINT16(p_cb->ndef_attrib.nmaxb, p);
BE_STREAM_TO_UINT32(temp, p);
- STREAM_TO_UINT8(p_cb->ndef_attrib.writef,
- p); /* WriteFlag: 00h if writing data finished; 0Fh if
- writing data in progress */
- STREAM_TO_UINT8(
- p_cb->ndef_attrib.rwflag,
- p); /* RWFlag: 00h NDEF is read-only; 01h if read/write available */
+ /* WriteFlag: 00h if writing data finished; 0Fh if writing data in
+ * progress */
+ STREAM_TO_UINT8(p_cb->ndef_attrib.writef, p);
+ /* RWFlag: 00h NDEF is read-only; 01h if read/write available */
+ STREAM_TO_UINT8(p_cb->ndef_attrib.rwflag, p);
/* Get length (3-byte, big-endian) */
STREAM_TO_UINT8(temp, p); /* Ln: high-byte */
@@ -2315,8 +2309,9 @@
break;
case NFC_DATA_CEVT: /* check for status in tNFC_CONN */
- if ((p_data != nullptr) && ((p_data->data.status == NFC_STATUS_OK) ||
- (p_data->data.status == NFC_STATUS_CONTINUE))) {
+ if ((p_data != nullptr) &&
+ ((p_data->data.status == NFC_STATUS_OK) ||
+ (p_data->data.status == NFC_STATUS_CONTINUE))) {
rw_t3t_data_cback(conn_id, &(p_data->data));
break;
} else if (p_data && p_data->data.p_data != nullptr) {
diff --git a/src/nfc/tags/rw_t4t.cc b/src/nfc/tags/rw_t4t.cc
index e5d3ef2..4a4d1f0 100644
--- a/src/nfc/tags/rw_t4t.cc
+++ b/src/nfc/tags/rw_t4t.cc
@@ -22,17 +22,15 @@
* mode.
*
******************************************************************************/
-#include <log/log.h>
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
-
-#include "nfc_target.h"
+#include <log/log.h>
+#include <string.h>
#include "bt_types.h"
#include "nfc_api.h"
#include "nfc_int.h"
+#include "nfc_target.h"
#include "rw_api.h"
#include "rw_int.h"
diff --git a/src/nfc/tags/rw_t5t.cc b/src/nfc/tags/rw_t5t.cc
index 113a3d9..060c44f 100644
--- a/src/nfc/tags/rw_t5t.cc
+++ b/src/nfc/tags/rw_t5t.cc
@@ -23,17 +23,15 @@
*
******************************************************************************/
-#include <log/log.h>
-#include <string.h>
-
#include <android-base/stringprintf.h>
#include <base/logging.h>
-
-#include "nfc_target.h"
+#include <log/log.h>
+#include <string.h>
#include "bt_types.h"
#include "nfc_api.h"
#include "nfc_int.h"
+#include "nfc_target.h"
#include "rw_api.h"
#include "rw_int.h"
diff --git a/src/nfc/tags/tags_int.cc b/src/nfc/tags/tags_int.cc
index edf7a12..673cad8 100644
--- a/src/nfc/tags/tags_int.cc
+++ b/src/nfc/tags/tags_int.cc
@@ -24,7 +24,6 @@
******************************************************************************/
#include "bt_types.h"
#include "nfc_target.h"
-
#include "rw_api.h"
#include "rw_int.h"