2015-05-03 12:32:37 -07: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-18 23:14:22 -08: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 03:18:20 -07:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
|
2014-02-18 23:14:22 -08: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 03:18:20 -07:00
|
|
|
|
|
|
|
private:
|
2015-02-16 02:47:58 -08:00
|
|
|
bool ProcessResponse(int32_t aType, const android::Parcel& aParcel, EventOptions& aOptions);
|
2015-02-26 01:23:17 -08:00
|
|
|
bool GeneralResponse(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-11-11 18:13:33 -08:00
|
|
|
bool ChangeRFStateRequest(android::Parcel& aParcel, const CommandOptions& options);
|
|
|
|
bool ChangeRFStateResponse(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-07-07 03:18:20 -07: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-30 23:51:41 -07:00
|
|
|
bool MakeReadOnlyRequest(android::Parcel& aParcel, const CommandOptions& options);
|
2014-11-17 17:52:39 -08:00
|
|
|
bool FormatRequest(android::Parcel& aParcel, const CommandOptions& options);
|
2015-01-08 18:42:48 -08:00
|
|
|
bool TransceiveRequest(android::Parcel& aParcel, const CommandOptions& options);
|
|
|
|
bool TransceiveResponse(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-07-07 03:18:20 -07:00
|
|
|
|
2015-02-16 02:47:58 -08:00
|
|
|
bool ProcessNotification(int32_t aType, const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-07-07 03:18:20 -07: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 05:21:00 -07:00
|
|
|
bool HCIEventTransactionNotification(const android::Parcel& aParcel, EventOptions& aOptions);
|
2015-03-24 20:16:42 -07:00
|
|
|
bool NDEFReceivedNotification(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-07-07 03:18:20 -07:00
|
|
|
|
|
|
|
bool ReadNDEFMessage(const android::Parcel& aParcel, EventOptions& aOptions);
|
|
|
|
bool WriteNDEFMessage(android::Parcel& aParcel, const CommandOptions& aOptions);
|
2015-01-08 18:42:48 -08:00
|
|
|
bool ReadTransceiveResponse(const android::Parcel& aParcel, EventOptions& aOptions);
|
2014-07-07 03:18:20 -07:00
|
|
|
private:
|
|
|
|
nsTArray<nsString> mRequestIdQueue;
|
2014-02-18 23:14:22 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // NfcMessageHandler_h
|