static QTAILQ_HEAD(MsgInfoRecvHead , MsgInfo) nfc_recv_msg_queue =
QTAILQ_HEAD_INITIALIZER(nfc_recv_msg_queue);
-
-static QTAILQ_HEAD(MsgInfoSendHead , MsgInfo) nfc_send_msg_queue =
-QTAILQ_HEAD_INITIALIZER(nfc_send_msg_queue);
-
-
-//
-
typedef struct NFCBuf {
VirtQueueElement elem;
QTAILQ_ENTRY(NFCBuf) next;
} NFCBuf;
-static QTAILQ_HEAD(NFCMsgHead , NFCBuf) nfc_in_queue =
-QTAILQ_HEAD_INITIALIZER(nfc_in_queue);
-
static pthread_mutex_t recv_buf_mutex = PTHREAD_MUTEX_INITIALIZER;
bool send_to_nfc(unsigned char id, unsigned char type, const char* data, const uint32_t len)
return false;
}
+ if(len > MAX_BUF_SIZE) {
+ ERR("the length of data is longer than max buffer size");
+ return false;
+ }
+
memset(&_msg->info, 0, sizeof(nfc_msg_info));
memcpy(_msg->info.buf, data, len);