Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 1093517 - remove impl for connect and close of Tag. r=dimi
Browse files Browse the repository at this point in the history
  • Loading branch information
allstarschh authored and rvandermeulen committed Jan 21, 2015
1 parent 66c2fd3 commit 89fa290
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 91 deletions.
26 changes: 1 addition & 25 deletions src/MessageHandler.cpp
Expand Up @@ -25,7 +25,7 @@
#include "NfcDebug.h"

#define MAJOR_VERSION (1)
#define MINOR_VERSION (19)
#define MINOR_VERSION (20)

using android::Parcel;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions src/MessageHandler.h
Expand Up @@ -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);
Expand Down
36 changes: 6 additions & 30 deletions src/NfcGonkMessage.h
Expand Up @@ -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
Expand All @@ -241,7 +217,7 @@ typedef enum {
*
* response is NfcNdefReadWritePdu.
*/
NFC_REQUEST_READ_NDEF = 3,
NFC_REQUEST_READ_NDEF,

/**
* NFC_REQUEST_WRITE_NDEF
Expand All @@ -254,7 +230,7 @@ typedef enum {
*
* response is NULL.
*/
NFC_REQUEST_WRITE_NDEF = 4,
NFC_REQUEST_WRITE_NDEF,

/**
* NFC_REQUEST_MAKE_NDEF_READ_ONLY
Expand All @@ -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
Expand All @@ -278,7 +254,7 @@ typedef enum {
*
* response is NULL.
*/
NFC_REQUEST_FORMAT = 6,
NFC_REQUEST_FORMAT,

/**
* NFC_RRQUEST_TRANSCEIVE
Expand All @@ -287,7 +263,7 @@ typedef enum {
*
* response is tag response data.
*/
NFC_REQUEST_TRANSCEIVE = 7,
NFC_REQUEST_TRANSCEIVE,
} NfcRequestType;

typedef enum {
Expand Down
32 changes: 0 additions & 32 deletions src/NfcService.cpp
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -429,19 +425,6 @@ bool NfcService::handleDisconnect()
return result;
}

void NfcService::handleConnect(int tech)
{
INfcTag* pINfcTag = reinterpret_cast<INfcTag*>
(sNfcManager->queryInterface(INTERFACE_TAG_MANAGER));

NfcErrorCode code = !!pINfcTag ?
(pINfcTag->connect(static_cast<TagTechnology>(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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/NfcService.h
Expand Up @@ -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);
Expand Down

0 comments on commit 89fa290

Please sign in to comment.