From 89fa29016f90f8aa111f6ee8dbfe11e6c2db5e80 Mon Sep 17 00:00:00 2001 From: Yoshi Huang Date: Thu, 15 Jan 2015 15:43:21 +0800 Subject: [PATCH] Bug 1093517 - remove impl for connect and close of Tag. r=dimi --- src/MessageHandler.cpp | 26 +------------------------- src/MessageHandler.h | 2 -- src/NfcGonkMessage.h | 36 ++++++------------------------------ src/NfcService.cpp | 32 -------------------------------- src/NfcService.h | 2 -- 5 files changed, 7 insertions(+), 91 deletions(-) diff --git a/src/MessageHandler.cpp b/src/MessageHandler.cpp index 0c86946..8b574b3 100644 --- a/src/MessageHandler.cpp +++ b/src/MessageHandler.cpp @@ -25,7 +25,7 @@ #include "NfcDebug.h" #define MAJOR_VERSION (1) -#define MINOR_VERSION (19) +#define MINOR_VERSION (20) using android::Parcel; @@ -105,12 +105,6 @@ void MessageHandler::processRequest(const uint8_t* data, size_t dataLen) case NFC_REQUEST_WRITE_NDEF: handleWriteNdefRequest(parcel); break; - case NFC_REQUEST_CONNECT: - handleConnectRequest(parcel); - break; - case NFC_REQUEST_CLOSE: - handleCloseRequest(parcel); - break; case NFC_REQUEST_MAKE_NDEF_READ_ONLY: handleMakeNdefReadonlyRequest(parcel); break; @@ -263,24 +257,6 @@ bool MessageHandler::handleWriteNdefRequest(Parcel& parcel) return mService->handleWriteNdefRequest(ndefMessage, isP2P); } -bool MessageHandler::handleConnectRequest(Parcel& parcel) -{ - int sessionId = parcel.readInt32(); - //TODO check SessionId - - //TODO should only read 1 octet here. - int32_t techType = parcel.readInt32(); - ALOGD("%s techType=%d", FUNC, techType); - mService->handleConnect(techType); - return true; -} - -bool MessageHandler::handleCloseRequest(Parcel& parcel) -{ - mService->handleCloseRequest(); - return true; -} - bool MessageHandler::handleMakeNdefReadonlyRequest(Parcel& parcel) { mService->handleMakeNdefReadonlyRequest(); diff --git a/src/MessageHandler.h b/src/MessageHandler.h index f4c9724..acc1332 100644 --- a/src/MessageHandler.h +++ b/src/MessageHandler.h @@ -45,8 +45,6 @@ class MessageHandler { bool handleChangeRFStateRequest(android::Parcel& parcel); bool handleReadNdefRequest(android::Parcel& parcel); bool handleWriteNdefRequest(android::Parcel& parcel); - bool handleConnectRequest(android::Parcel& parcel); - bool handleCloseRequest(android::Parcel& parcel); bool handleMakeNdefReadonlyRequest(android::Parcel& parcel); bool handleNdefFormatRequest(android::Parcel& parcel); bool handleTagTransceiveRequest(android::Parcel& parcel); diff --git a/src/NfcGonkMessage.h b/src/NfcGonkMessage.h index 80191d5..37c60e9 100644 --- a/src/NfcGonkMessage.h +++ b/src/NfcGonkMessage.h @@ -204,31 +204,7 @@ typedef enum { * * response is NfcChangeRFStateResponse. */ - NFC_REQUEST_CHANGE_RF_STATE = 0, - - /** - * NFC_REQUEST_CONNECT - * - * Connect to a specific NFC-compatible technology. - * - * data is NfcConnectRequest. - * - * response is NULL. - */ - NFC_REQUEST_CONNECT = 1, - - /** - * NFC_REQUEST_CLOSE - * - * Close an open connection that must have been opened with a prior - * NfcConnectRequest. - * - * data is NfcSessionId, which is correlates to a technology that was - * previously discovered with NFC_NOTIFICATION_TECH_DISCOVERED. - * - * response is NULL. - */ - NFC_REQUEST_CLOSE = 2, + NFC_REQUEST_CHANGE_RF_STATE, /** * NFC_REQUEST_READ_NDEF @@ -241,7 +217,7 @@ typedef enum { * * response is NfcNdefReadWritePdu. */ - NFC_REQUEST_READ_NDEF = 3, + NFC_REQUEST_READ_NDEF, /** * NFC_REQUEST_WRITE_NDEF @@ -254,7 +230,7 @@ typedef enum { * * response is NULL. */ - NFC_REQUEST_WRITE_NDEF = 4, + NFC_REQUEST_WRITE_NDEF, /** * NFC_REQUEST_MAKE_NDEF_READ_ONLY @@ -266,7 +242,7 @@ typedef enum { * * response is NULL. */ - NFC_REQUEST_MAKE_NDEF_READ_ONLY = 5, + NFC_REQUEST_MAKE_NDEF_READ_ONLY, /** * NFC_REQUEST_FORMAT @@ -278,7 +254,7 @@ typedef enum { * * response is NULL. */ - NFC_REQUEST_FORMAT = 6, + NFC_REQUEST_FORMAT, /** * NFC_RRQUEST_TRANSCEIVE @@ -287,7 +263,7 @@ typedef enum { * * response is tag response data. */ - NFC_REQUEST_TRANSCEIVE = 7, + NFC_REQUEST_TRANSCEIVE, } NfcRequestType; typedef enum { diff --git a/src/NfcService.cpp b/src/NfcService.cpp index 4bd7ae5..dae6c33 100644 --- a/src/NfcService.cpp +++ b/src/NfcService.cpp @@ -43,7 +43,6 @@ typedef enum { MSG_SE_NOTIFY_TRANSACTION_EVENT, MSG_READ_NDEF, MSG_WRITE_NDEF, - MSG_CLOSE, MSG_SOCKET_CONNECTED, MSG_PUSH_NDEF, MSG_NDEF_TAG_LIST, @@ -372,9 +371,6 @@ void* NfcService::eventLoop() case MSG_WRITE_NDEF: handleWriteNdefResponse(event); break; - case MSG_CLOSE: - handleCloseResponse(event); - break; case MSG_SOCKET_CONNECTED: mMsgHandler->processNotification(NFC_NOTIFICATION_INITIALIZED , NULL); break; @@ -429,19 +425,6 @@ bool NfcService::handleDisconnect() return result; } -void NfcService::handleConnect(int tech) -{ - INfcTag* pINfcTag = reinterpret_cast - (sNfcManager->queryInterface(INTERFACE_TAG_MANAGER)); - - NfcErrorCode code = !!pINfcTag ? - (pINfcTag->connect(static_cast(tech)) ? - NFC_SUCCESS : NFC_ERROR_CONNECT) : - NFC_ERROR_NOT_SUPPORTED; - - mMsgHandler->processResponse(NFC_RESPONSE_GENERAL, code, NULL); -} - bool NfcService::handleReadNdefRequest() { NfcEvent *event = new NfcEvent(MSG_READ_NDEF); @@ -526,21 +509,6 @@ void NfcService::handleWriteNdefResponse(NfcEvent* event) mMsgHandler->processResponse(resType, code, NULL); } -void NfcService::handleCloseRequest() -{ - NfcEvent *event = new NfcEvent(MSG_CLOSE); - mQueue.push_back(event); - sem_post(&thread_sem); -} - -void NfcService::handleCloseResponse(NfcEvent* event) -{ - // TODO : If we call tag disconnect here, will keep trggering tag discover notification - // Need to check with DT what should we do here - - mMsgHandler->processResponse(NFC_RESPONSE_GENERAL, NFC_SUCCESS, NULL); -} - void NfcService::onConnected() { NfcEvent *event = new NfcEvent(MSG_SOCKET_CONNECTED); diff --git a/src/NfcService.h b/src/NfcService.h index 10cf97d..f235b56 100644 --- a/src/NfcService.h +++ b/src/NfcService.h @@ -55,12 +55,10 @@ class NfcService : public IpcSocketListener { void handleTransactionEvent(NfcEvent* event); void handleLlcpLinkActivation(NfcEvent* event); void handleLlcpLinkDeactivation(NfcEvent* event); - void handleConnect(int technology); bool handleReadNdefRequest(); void handleReadNdefResponse(NfcEvent* event); bool handleWriteNdefRequest(NdefMessage* ndef, bool isP2P); void handleWriteNdefResponse(NfcEvent* event); - void handleCloseRequest(); void handleCloseResponse(NfcEvent* event); bool handlePushNdefRequest(NdefMessage* ndef); void handlePushNdefResponse(NfcEvent* event);