Bug 1093517 - remove impl for connect and close of MozNFCTag. r=dimi

From 8d41372b81f36efced2f46bfa8428eb12688ffd7 Mon Sep 17 00:00:00 2001
---
 dom/nfc/NfcContentHelper.js        | 27 ++-------------------------
 dom/nfc/gonk/Nfc.js                | 12 +-----------
 dom/nfc/gonk/NfcGonkMessage.h      |  4 +---
 dom/nfc/gonk/NfcMessageHandler.cpp | 35 -----------------------------------
 dom/nfc/gonk/NfcMessageHandler.h   |  2 --
 dom/nfc/nsINfcContentHelper.idl    | 30 +-----------------------------
 6 files changed, 5 insertions(+), 105 deletions(-)
This commit is contained in:
Yoshi Huang 2015-01-15 15:41:43 +08:00
parent a3c2b470b3
commit 86e65bebb0
6 changed files with 5 additions and 105 deletions

View File

@ -187,27 +187,6 @@ NfcContentHelper.prototype = {
});
},
connect: function connect(techType, sessionToken, callback) {
let requestId = callback.getCallbackId();
this._requestMap[requestId] = callback;
cpmm.sendAsyncMessage("NFC:Connect", {
requestId: requestId,
sessionToken: sessionToken,
techType: techType
});
},
close: function close(sessionToken, callback) {
let requestId = callback.getCallbackId();
this._requestMap[requestId] = callback;
cpmm.sendAsyncMessage("NFC:Close", {
requestId: requestId,
sessionToken: sessionToken
});
},
sendFile: function sendFile(data, sessionToken, callback) {
let requestId = callback.getCallbackId();
this._requestMap[requestId] = callback;
@ -284,7 +263,7 @@ NfcContentHelper.prototype = {
// nsIMessageListener
receiveMessage: function receiveMessage(message) {
DEBUG && debug("Message received: " + JSON.stringify(message));
let result = message.json;
let result = message.data;
switch (message.name) {
case "NFC:ReadNDEFResponse":
@ -296,9 +275,7 @@ NfcContentHelper.prototype = {
case "NFC:TransceiveResponse":
this.handleTransceiveResponse(result);
break;
case "NFC:ConnectResponse": // Fall through.
case "NFC:CloseResponse":
case "NFC:WriteNDEFResponse":
case "NFC:WriteNDEFResponse": // Fall through.
case "NFC:MakeReadOnlyResponse":
case "NFC:FormatResponse":
case "NFC:NotifySendFileStatusResponse":

View File

@ -61,8 +61,6 @@ const NFC_IPC_MSG_ENTRIES = [
{ permission: "nfc",
messages: ["NFC:ReadNDEF",
"NFC:Connect",
"NFC:Close",
"NFC:WriteNDEF",
"NFC:MakeReadOnly",
"NFC:Format",
@ -514,9 +512,7 @@ Nfc.prototype = {
gMessageManager.onRFStateChange(this.rfState);
}
break;
case "ConnectResponse": // Fall through.
case "CloseResponse":
case "ReadNDEFResponse":
case "ReadNDEFResponse": // Fall through.
case "MakeReadOnlyResponse":
case "FormatResponse":
case "TransceiveResponse":
@ -579,12 +575,6 @@ Nfc.prototype = {
case "NFC:Transceive":
this.sendToNfcService("transceive", message.data);
break;
case "NFC:Connect":
this.sendToNfcService("connect", message.data);
break;
case "NFC:Close":
this.sendToNfcService("close", message.data);
break;
case "NFC:SendFile":
// Chrome process is the arbitrator / mediator between
// system app (content process) that issued nfc 'sendFile' operation

View File

@ -8,12 +8,10 @@
namespace mozilla {
#define NFCD_MAJOR_VERSION 1
#define NFCD_MINOR_VERSION 19
#define NFCD_MINOR_VERSION 20
enum NfcRequest {
ChangeRFStateReq = 0,
ConnectReq,
CloseReq,
ReadNDEFReq,
WriteNDEFReq,
MakeReadOnlyReq,

View File

@ -23,8 +23,6 @@ static const char* kWriteNDEFRequest = "writeNDEF";
static const char* kMakeReadOnlyRequest = "makeReadOnly";
static const char* kFormatRequest = "format";
static const char* kTransceiveRequest = "transceive";
static const char* kConnectRequest = "connect";
static const char* kCloseRequest = "close";
static const char* kChangeRFStateResponse = "ChangeRFStateResponse";
static const char* kReadNDEFResponse = "ReadNDEFResponse";
@ -32,8 +30,6 @@ static const char* kWriteNDEFResponse = "WriteNDEFResponse";
static const char* kMakeReadOnlyResponse = "MakeReadOnlyResponse";
static const char* kFormatResponse = "FormatResponse";
static const char* kTransceiveResponse = "TransceiveResponse";
static const char* kConnectResponse = "ConnectResponse";
static const char* kCloseResponse = "CloseResponse";
static const char* kInitializedNotification = "InitializedNotification";
static const char* kTechDiscoveredNotification = "TechDiscoveredNotification";
@ -63,12 +59,6 @@ NfcMessageHandler::Marshall(Parcel& aParcel, const CommandOptions& aOptions)
} else if (!strcmp(type, kTransceiveRequest)) {
result = TransceiveRequest(aParcel, aOptions);
mPendingReqQueue.AppendElement(NfcRequest::TransceiveReq);
} else if (!strcmp(type, kConnectRequest)) {
result = ConnectRequest(aParcel, aOptions);
mPendingReqQueue.AppendElement(NfcRequest::ConnectReq);
} else if (!strcmp(type, kCloseRequest)) {
result = CloseRequest(aParcel, aOptions);
mPendingReqQueue.AppendElement(NfcRequest::CloseReq);
} else {
result = false;
}
@ -134,12 +124,6 @@ NfcMessageHandler::GeneralResponse(const Parcel& aParcel, EventOptions& aOptions
case NfcRequest::FormatReq:
type = kFormatResponse;
break;
case NfcRequest::ConnectReq:
type = kConnectResponse;
break;
case NfcRequest::CloseReq:
type = kCloseResponse;
break;
default:
NMH_LOG("Nfcd, unknown general response %d", pendingReq);
return false;
@ -268,25 +252,6 @@ NfcMessageHandler::TransceiveRequest(Parcel& aParcel, const CommandOptions& aOpt
return true;
}
bool
NfcMessageHandler::ConnectRequest(Parcel& aParcel, const CommandOptions& aOptions)
{
aParcel.writeInt32(NfcRequest::ConnectReq);
aParcel.writeInt32(aOptions.mSessionId);
aParcel.writeInt32(aOptions.mTechType);
mRequestIdQueue.AppendElement(aOptions.mRequestId);
return true;
}
bool
NfcMessageHandler::CloseRequest(Parcel& aParcel, const CommandOptions& aOptions)
{
aParcel.writeInt32(NfcRequest::CloseReq);
aParcel.writeInt32(aOptions.mSessionId);
mRequestIdQueue.AppendElement(aOptions.mRequestId);
return true;
}
bool
NfcMessageHandler::InitializeNotification(const Parcel& aParcel, EventOptions& aOptions)
{

View File

@ -34,8 +34,6 @@ private:
bool FormatRequest(android::Parcel& aParcel, const CommandOptions& options);
bool TransceiveRequest(android::Parcel& aParcel, const CommandOptions& options);
bool TransceiveResponse(const android::Parcel& aParcel, EventOptions& aOptions);
bool ConnectRequest(android::Parcel& aParcel, const CommandOptions& options);
bool CloseRequest(android::Parcel& aParcel, const CommandOptions& options);
bool InitializeNotification(const android::Parcel& aParcel, EventOptions& aOptions);
bool TechDiscoveredNotification(const android::Parcel& aParcel, EventOptions& aOptions);

View File

@ -102,7 +102,7 @@ interface nsINfcRequestCallback : nsISupports
void notifyError(in DOMString errorMsg);
};
[scriptable, uuid(0f8aae32-9920-491e-a197-8995941d54df)]
[scriptable, uuid(b5194ae8-d5d5-482f-a73f-dd0d755a1972)]
interface nsINfcContentHelper : nsISupports
{
void init(in nsIDOMWindow window);
@ -180,34 +180,6 @@ interface nsINfcContentHelper : nsISupports
in nsIVariant command,
in nsINfcRequestCallback callback);
/**
* Enable I/O operations to the tag
*
* @param techType
* Interface to a technology in a Tag
*
* @param sessionToken
* Current token
*
* @param callback
* Called when request is finished
*/
void connect(in unsigned long techType,
in DOMString sessionToken,
in nsINfcRequestCallback callback);
/**
* Disable I/O operations to the tag
*
* @param sessionToken
* Current token
*
* @param callback
* Called when request is finished
*/
void close(in DOMString sessionToken,
in nsINfcRequestCallback callback);
/**
* Get current RF state.
*/