nfc: NCI 2.0: Add CORE_INIT_CMD for NCI 2.0

am: c901276e60

Change-Id: Ia846b4a158889cd236e5e8b1b6e128b71266abf3
This commit is contained in:
Ruchi Kandoi 2017-08-03 16:28:31 +00:00 committed by android-build-merger
commit 90c456f82e

View file

@ -44,6 +44,8 @@ using ::android::sp;
{ 0x20, 0x04, 0x02, 0x01, 0x00 } { 0x20, 0x04, 0x02, 0x01, 0x00 }
#define CORE_INIT_CMD \ #define CORE_INIT_CMD \
{ 0x20, 0x01, 0x00 } { 0x20, 0x01, 0x00 }
#define CORE_INIT_CMD_NCI20 \
{ 0x20, 0x01, 0x02, 0x00, 0x00 }
#define INVALID_COMMAND \ #define INVALID_COMMAND \
{ 0x20, 0x00, 0x00 } { 0x20, 0x00, 0x00 }
@ -290,16 +292,23 @@ TEST_F(NfcHidlTest, WriteInvalidAndThenValidCommand) {
// Wait for CORE_RESET_NTF // Wait for CORE_RESET_NTF
res = nfc_cb_->WaitForCallback(kCallbackNameSendData); res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
EXPECT_TRUE(res.no_timeout); EXPECT_TRUE(res.no_timeout);
cmd = CORE_INIT_CMD_NCI20;
} else {
cmd = CORE_INIT_CMD;
} }
cmd = CORE_INIT_CMD;
data = cmd; data = cmd;
EXPECT_EQ(data.size(), nfc_->write(data)); EXPECT_EQ(data.size(), nfc_->write(data));
// Wait for CORE_INIT_RSP // Wait for CORE_INIT_RSP
res = nfc_cb_->WaitForCallback(kCallbackNameSendData); res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
EXPECT_TRUE(res.no_timeout); EXPECT_TRUE(res.no_timeout);
EXPECT_EQ((int)NfcStatus::OK, res.args->last_data_[3]); EXPECT_EQ((int)NfcStatus::OK, res.args->last_data_[3]);
if (nci_version == NCI_VERSION_2 && res.args->last_data_.size() > 13 &&
res.args->last_data_[13] == 0x00) {
// Wait for CORE_CONN_CREDITS_NTF
res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
EXPECT_TRUE(res.no_timeout);
}
// Send an Error Data Packet // Send an Error Data Packet
cmd = INVALID_COMMAND; cmd = INVALID_COMMAND;
data = cmd; data = cmd;
@ -347,15 +356,23 @@ TEST_F(NfcHidlTest, Bandwidth) {
// Wait for CORE_RESET_NTF // Wait for CORE_RESET_NTF
res = nfc_cb_->WaitForCallback(kCallbackNameSendData); res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
EXPECT_TRUE(res.no_timeout); EXPECT_TRUE(res.no_timeout);
cmd = CORE_INIT_CMD_NCI20;
} else {
cmd = CORE_INIT_CMD;
} }
cmd = CORE_INIT_CMD;
data = cmd; data = cmd;
EXPECT_EQ(data.size(), nfc_->write(data)); EXPECT_EQ(data.size(), nfc_->write(data));
// Wait for CORE_INIT_RSP // Wait for CORE_INIT_RSP
res = nfc_cb_->WaitForCallback(kCallbackNameSendData); res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
EXPECT_TRUE(res.no_timeout); EXPECT_TRUE(res.no_timeout);
EXPECT_EQ((int)NfcStatus::OK, res.args->last_data_[3]); EXPECT_EQ((int)NfcStatus::OK, res.args->last_data_[3]);
if (nci_version == NCI_VERSION_2 && res.args->last_data_.size() > 13 &&
res.args->last_data_[13] == 0x00) {
// Wait for CORE_CONN_CREDITS_NTF
res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
EXPECT_TRUE(res.no_timeout);
}
cmd = CORE_CONN_CREATE_CMD; cmd = CORE_CONN_CREATE_CMD;
data = cmd; data = cmd;