2013-10-09 02:40:12 -07: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 mozilla_dom_Icc_h
|
|
|
|
#define mozilla_dom_Icc_h
|
|
|
|
|
2014-09-03 04:31:00 -07:00
|
|
|
#include "mozilla/dom/MozIccBinding.h" // For IccCardState
|
2014-03-31 23:13:50 -07:00
|
|
|
#include "mozilla/DOMEventTargetHelper.h"
|
2014-09-19 00:53:05 -07:00
|
|
|
|
|
|
|
class nsIIccInfo;
|
|
|
|
class nsIIccProvider;
|
2013-10-09 02:40:12 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2014-05-19 13:37:58 -07:00
|
|
|
class DOMRequest;
|
2014-10-01 11:43:26 -07:00
|
|
|
class OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo;
|
2014-05-19 13:37:58 -07:00
|
|
|
|
2014-03-31 23:13:50 -07:00
|
|
|
class Icc MOZ_FINAL : public DOMEventTargetHelper
|
2013-10-09 02:40:12 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-09-19 00:53:05 -07:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Icc, DOMEventTargetHelper)
|
2014-03-31 23:13:50 -07:00
|
|
|
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
|
2013-10-09 02:40:12 -07:00
|
|
|
|
2014-09-19 00:53:05 -07:00
|
|
|
Icc(nsPIDOMWindow* aWindow, long aClientId, nsIIccInfo* aIccInfo);
|
2013-10-09 02:40:12 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
Shutdown();
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
NotifyEvent(const nsAString& aName);
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
NotifyStkEvent(const nsAString& aName, const nsAString& aMessage);
|
|
|
|
|
|
|
|
nsString
|
|
|
|
GetIccId()
|
|
|
|
{
|
|
|
|
return mIccId;
|
|
|
|
}
|
|
|
|
|
2014-09-19 00:53:05 -07:00
|
|
|
void
|
|
|
|
UpdateIccInfo(nsIIccInfo* aIccInfo);
|
|
|
|
|
2013-10-09 02:40:12 -07:00
|
|
|
nsPIDOMWindow*
|
|
|
|
GetParentObject() const
|
|
|
|
{
|
|
|
|
return GetOwner();
|
|
|
|
}
|
|
|
|
|
|
|
|
// WrapperCache
|
|
|
|
virtual JSObject*
|
2014-04-08 15:27:18 -07:00
|
|
|
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2013-10-09 02:40:12 -07:00
|
|
|
|
|
|
|
// MozIcc WebIDL
|
2014-09-19 00:53:05 -07:00
|
|
|
void
|
|
|
|
GetIccInfo(Nullable<OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo>& aIccInfo) const;
|
2013-10-09 02:40:12 -07:00
|
|
|
|
2014-09-03 04:31:00 -07:00
|
|
|
Nullable<IccCardState>
|
|
|
|
GetCardState() const;
|
2013-10-09 02:40:12 -07:00
|
|
|
|
|
|
|
void
|
2014-01-09 09:39:36 -08:00
|
|
|
SendStkResponse(const JSContext* aCx, JS::Handle<JS::Value> aCommand,
|
|
|
|
JS::Handle<JS::Value> aResponse, ErrorResult& aRv);
|
2013-10-09 02:40:12 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
SendStkMenuSelection(uint16_t aItemIdentifier, bool aHelpRequested,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
void
|
2014-01-09 09:39:36 -08:00
|
|
|
SendStkTimerExpiration(const JSContext* aCx, JS::Handle<JS::Value> aTimer,
|
2013-10-09 02:40:12 -07:00
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
void
|
2014-01-09 09:39:36 -08:00
|
|
|
SendStkEventDownload(const JSContext* aCx, JS::Handle<JS::Value> aEvent,
|
2013-10-09 02:40:12 -07:00
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2014-05-19 13:37:58 -07:00
|
|
|
already_AddRefed<DOMRequest>
|
2013-10-09 02:40:12 -07:00
|
|
|
GetCardLock(const nsAString& aLockType, ErrorResult& aRv);
|
|
|
|
|
2014-05-19 13:37:58 -07:00
|
|
|
already_AddRefed<DOMRequest>
|
2014-01-09 09:39:36 -08:00
|
|
|
UnlockCardLock(const JSContext* aCx, JS::Handle<JS::Value> aInfo,
|
2013-10-09 02:40:12 -07:00
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2014-05-19 13:37:58 -07:00
|
|
|
already_AddRefed<DOMRequest>
|
2014-01-09 09:39:36 -08:00
|
|
|
SetCardLock(const JSContext* aCx, JS::Handle<JS::Value> aInfo,
|
|
|
|
ErrorResult& aRv);
|
2013-10-09 02:40:12 -07:00
|
|
|
|
2014-05-19 13:37:58 -07:00
|
|
|
already_AddRefed<DOMRequest>
|
2013-10-09 02:40:12 -07:00
|
|
|
GetCardLockRetryCount(const nsAString& aLockType, ErrorResult& aRv);
|
|
|
|
|
2014-05-19 13:37:58 -07:00
|
|
|
already_AddRefed<DOMRequest>
|
2013-10-09 02:40:12 -07:00
|
|
|
ReadContacts(const nsAString& aContactType, ErrorResult& aRv);
|
|
|
|
|
2014-05-19 13:37:58 -07:00
|
|
|
already_AddRefed<DOMRequest>
|
2013-10-09 02:40:12 -07:00
|
|
|
UpdateContact(const JSContext* aCx, const nsAString& aContactType,
|
2014-01-09 09:39:36 -08:00
|
|
|
JS::Handle<JS::Value> aContact, const nsAString& aPin2,
|
2013-10-09 02:40:12 -07:00
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2014-05-19 13:37:58 -07:00
|
|
|
already_AddRefed<DOMRequest>
|
2014-01-28 02:58:00 -08:00
|
|
|
MatchMvno(const nsAString& aMvnoType, const nsAString& aMatchData,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2013-10-09 02:40:12 -07:00
|
|
|
IMPL_EVENT_HANDLER(iccinfochange)
|
|
|
|
IMPL_EVENT_HANDLER(cardstatechange)
|
|
|
|
IMPL_EVENT_HANDLER(stkcommand)
|
|
|
|
IMPL_EVENT_HANDLER(stksessionend)
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool mLive;
|
|
|
|
uint32_t mClientId;
|
|
|
|
nsString mIccId;
|
|
|
|
// mProvider is a xpcom service and will be released at shutdown, so it
|
|
|
|
// doesn't need to be cycle collected.
|
|
|
|
nsCOMPtr<nsIIccProvider> mProvider;
|
2014-09-19 00:53:05 -07:00
|
|
|
Nullable<OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo> mIccInfo;
|
2013-10-09 02:40:12 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_icc_Icc_h
|