|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #ifndef mozilla_dom_Icc_h |
|
6 #define mozilla_dom_Icc_h |
|
7 |
|
8 #include "mozilla/DOMEventTargetHelper.h" |
|
9 #include "nsIIccProvider.h" |
|
10 |
|
11 namespace mozilla { |
|
12 namespace dom { |
|
13 |
|
14 class Icc MOZ_FINAL : public DOMEventTargetHelper |
|
15 { |
|
16 public: |
|
17 NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper) |
|
18 |
|
19 Icc(nsPIDOMWindow* aWindow, long aClientId, const nsAString& aIccId); |
|
20 |
|
21 void |
|
22 Shutdown(); |
|
23 |
|
24 nsresult |
|
25 NotifyEvent(const nsAString& aName); |
|
26 |
|
27 nsresult |
|
28 NotifyStkEvent(const nsAString& aName, const nsAString& aMessage); |
|
29 |
|
30 nsString |
|
31 GetIccId() |
|
32 { |
|
33 return mIccId; |
|
34 } |
|
35 |
|
36 nsPIDOMWindow* |
|
37 GetParentObject() const |
|
38 { |
|
39 return GetOwner(); |
|
40 } |
|
41 |
|
42 // WrapperCache |
|
43 virtual JSObject* |
|
44 WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
|
45 |
|
46 // MozIcc WebIDL |
|
47 already_AddRefed<nsIDOMMozIccInfo> |
|
48 GetIccInfo() const; |
|
49 |
|
50 void |
|
51 GetCardState(nsString& aCardState) const; |
|
52 |
|
53 void |
|
54 SendStkResponse(const JSContext* aCx, JS::Handle<JS::Value> aCommand, |
|
55 JS::Handle<JS::Value> aResponse, ErrorResult& aRv); |
|
56 |
|
57 void |
|
58 SendStkMenuSelection(uint16_t aItemIdentifier, bool aHelpRequested, |
|
59 ErrorResult& aRv); |
|
60 |
|
61 void |
|
62 SendStkTimerExpiration(const JSContext* aCx, JS::Handle<JS::Value> aTimer, |
|
63 ErrorResult& aRv); |
|
64 |
|
65 void |
|
66 SendStkEventDownload(const JSContext* aCx, JS::Handle<JS::Value> aEvent, |
|
67 ErrorResult& aRv); |
|
68 |
|
69 already_AddRefed<nsISupports> |
|
70 GetCardLock(const nsAString& aLockType, ErrorResult& aRv); |
|
71 |
|
72 already_AddRefed<nsISupports> |
|
73 UnlockCardLock(const JSContext* aCx, JS::Handle<JS::Value> aInfo, |
|
74 ErrorResult& aRv); |
|
75 |
|
76 already_AddRefed<nsISupports> |
|
77 SetCardLock(const JSContext* aCx, JS::Handle<JS::Value> aInfo, |
|
78 ErrorResult& aRv); |
|
79 |
|
80 already_AddRefed<nsISupports> |
|
81 GetCardLockRetryCount(const nsAString& aLockType, ErrorResult& aRv); |
|
82 |
|
83 already_AddRefed<nsISupports> |
|
84 ReadContacts(const nsAString& aContactType, ErrorResult& aRv); |
|
85 |
|
86 already_AddRefed<nsISupports> |
|
87 UpdateContact(const JSContext* aCx, const nsAString& aContactType, |
|
88 JS::Handle<JS::Value> aContact, const nsAString& aPin2, |
|
89 ErrorResult& aRv); |
|
90 |
|
91 already_AddRefed<nsISupports> |
|
92 IccOpenChannel(const nsAString& aAid, ErrorResult& aRv); |
|
93 |
|
94 already_AddRefed<nsISupports> |
|
95 IccExchangeAPDU(const JSContext* aCx, int32_t aChannel, |
|
96 JS::Handle<JS::Value> aApdu, ErrorResult& aRv); |
|
97 |
|
98 already_AddRefed<nsISupports> |
|
99 IccCloseChannel(int32_t aChannel, ErrorResult& aRv); |
|
100 |
|
101 already_AddRefed<nsISupports> |
|
102 MatchMvno(const nsAString& aMvnoType, const nsAString& aMatchData, |
|
103 ErrorResult& aRv); |
|
104 |
|
105 IMPL_EVENT_HANDLER(iccinfochange) |
|
106 IMPL_EVENT_HANDLER(cardstatechange) |
|
107 IMPL_EVENT_HANDLER(stkcommand) |
|
108 IMPL_EVENT_HANDLER(stksessionend) |
|
109 |
|
110 private: |
|
111 bool mLive; |
|
112 uint32_t mClientId; |
|
113 nsString mIccId; |
|
114 // mProvider is a xpcom service and will be released at shutdown, so it |
|
115 // doesn't need to be cycle collected. |
|
116 nsCOMPtr<nsIIccProvider> mProvider; |
|
117 }; |
|
118 |
|
119 } // namespace dom |
|
120 } // namespace mozilla |
|
121 |
|
122 #endif // mozilla_dom_icc_Icc_h |