2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-02-19 11:14:22 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef NfcMessageHandler_h
|
|
|
|
#define NfcMessageHandler_h
|
|
|
|
|
2014-07-07 14:18:20 +04:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
|
2014-02-19 11:14:22 +04:00
|
|
|
namespace android {
|
|
|
|
class MOZ_EXPORT Parcel;
|
|
|
|
} // namespace android
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class CommandOptions;
|
|
|
|
class EventOptions;
|
|
|
|
|
|
|
|
class NfcMessageHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool Marshall(android::Parcel& aParcel, const CommandOptions& aOptions);
|
|
|
|
bool Unmarshall(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-07-07 14:18:20 +04:00
|
|
|
|
|
|
|
private:
|
2015-02-16 13:47:58 +03:00
|
|
|
bool ProcessResponse(int32_t aType, const android::Parcel& aParcel, EventOptions& aOptions);
|
2015-02-26 12:23:17 +03:00
|
|
|
bool GeneralResponse(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-11-12 05:13:33 +03:00
|
|
|
bool ChangeRFStateRequest(android::Parcel& aParcel, const CommandOptions& options);
|
|
|
|
bool ChangeRFStateResponse(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-07-07 14:18:20 +04:00
|
|
|
bool ReadNDEFRequest(android::Parcel& aParcel, const CommandOptions& options);
|
|
|
|
bool ReadNDEFResponse(const android::Parcel& aParcel, EventOptions& aOptions);
|
|
|
|
bool WriteNDEFRequest(android::Parcel& aParcel, const CommandOptions& options);
|
2014-10-31 09:51:41 +03:00
|
|
|
bool MakeReadOnlyRequest(android::Parcel& aParcel, const CommandOptions& options);
|
2014-11-18 04:52:39 +03:00
|
|
|
bool FormatRequest(android::Parcel& aParcel, const CommandOptions& options);
|
2015-01-09 05:42:48 +03:00
|
|
|
bool TransceiveRequest(android::Parcel& aParcel, const CommandOptions& options);
|
|
|
|
bool TransceiveResponse(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-07-07 14:18:20 +04:00
|
|
|
|
2015-02-16 13:47:58 +03:00
|
|
|
bool ProcessNotification(int32_t aType, const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-07-07 14:18:20 +04:00
|
|
|
bool InitializeNotification(const android::Parcel& aParcel, EventOptions& aOptions);
|
|
|
|
bool TechDiscoveredNotification(const android::Parcel& aParcel, EventOptions& aOptions);
|
|
|
|
bool TechLostNotification(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-08-27 16:21:00 +04:00
|
|
|
bool HCIEventTransactionNotification(const android::Parcel& aParcel, EventOptions& aOptions);
|
2015-03-25 06:16:42 +03:00
|
|
|
bool NDEFReceivedNotification(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-07-07 14:18:20 +04:00
|
|
|
|
|
|
|
bool ReadNDEFMessage(const android::Parcel& aParcel, EventOptions& aOptions);
|
|
|
|
bool WriteNDEFMessage(android::Parcel& aParcel, const CommandOptions& aOptions);
|
2015-01-09 05:42:48 +03:00
|
|
|
bool ReadTransceiveResponse(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-07-07 14:18:20 +04:00
|
|
|
private:
|
|
|
|
nsTArray<nsString> mRequestIdQueue;
|
2014-02-19 11:14:22 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // NfcMessageHandler_h
|