dom/icc/src/Icc.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/icc/src/Icc.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,122 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef mozilla_dom_Icc_h
     1.9 +#define mozilla_dom_Icc_h
    1.10 +
    1.11 +#include "mozilla/DOMEventTargetHelper.h"
    1.12 +#include "nsIIccProvider.h"
    1.13 +
    1.14 +namespace mozilla {
    1.15 +namespace dom {
    1.16 +
    1.17 +class Icc MOZ_FINAL : public DOMEventTargetHelper
    1.18 +{
    1.19 +public:
    1.20 +  NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
    1.21 +
    1.22 +  Icc(nsPIDOMWindow* aWindow, long aClientId, const nsAString& aIccId);
    1.23 +
    1.24 +  void
    1.25 +  Shutdown();
    1.26 +
    1.27 +  nsresult
    1.28 +  NotifyEvent(const nsAString& aName);
    1.29 +
    1.30 +  nsresult
    1.31 +  NotifyStkEvent(const nsAString& aName, const nsAString& aMessage);
    1.32 +
    1.33 +  nsString
    1.34 +  GetIccId()
    1.35 +  {
    1.36 +    return mIccId;
    1.37 +  }
    1.38 +
    1.39 +  nsPIDOMWindow*
    1.40 +  GetParentObject() const
    1.41 +  {
    1.42 +    return GetOwner();
    1.43 +  }
    1.44 +
    1.45 +  // WrapperCache
    1.46 +  virtual JSObject*
    1.47 +  WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    1.48 +
    1.49 +  // MozIcc WebIDL
    1.50 +  already_AddRefed<nsIDOMMozIccInfo>
    1.51 +  GetIccInfo() const;
    1.52 +
    1.53 +  void
    1.54 +  GetCardState(nsString& aCardState) const;
    1.55 +
    1.56 +  void
    1.57 +  SendStkResponse(const JSContext* aCx, JS::Handle<JS::Value> aCommand,
    1.58 +                  JS::Handle<JS::Value> aResponse, ErrorResult& aRv);
    1.59 +
    1.60 +  void
    1.61 +  SendStkMenuSelection(uint16_t aItemIdentifier, bool aHelpRequested,
    1.62 +                       ErrorResult& aRv);
    1.63 +
    1.64 +  void
    1.65 +  SendStkTimerExpiration(const JSContext* aCx, JS::Handle<JS::Value> aTimer,
    1.66 +                         ErrorResult& aRv);
    1.67 +
    1.68 +  void
    1.69 +  SendStkEventDownload(const JSContext* aCx, JS::Handle<JS::Value> aEvent,
    1.70 +                       ErrorResult& aRv);
    1.71 +
    1.72 +  already_AddRefed<nsISupports>
    1.73 +  GetCardLock(const nsAString& aLockType, ErrorResult& aRv);
    1.74 +
    1.75 +  already_AddRefed<nsISupports>
    1.76 +  UnlockCardLock(const JSContext* aCx, JS::Handle<JS::Value> aInfo,
    1.77 +                 ErrorResult& aRv);
    1.78 +
    1.79 +  already_AddRefed<nsISupports>
    1.80 +  SetCardLock(const JSContext* aCx, JS::Handle<JS::Value> aInfo,
    1.81 +              ErrorResult& aRv);
    1.82 +
    1.83 +  already_AddRefed<nsISupports>
    1.84 +  GetCardLockRetryCount(const nsAString& aLockType, ErrorResult& aRv);
    1.85 +
    1.86 +  already_AddRefed<nsISupports>
    1.87 +  ReadContacts(const nsAString& aContactType, ErrorResult& aRv);
    1.88 +
    1.89 +  already_AddRefed<nsISupports>
    1.90 +  UpdateContact(const JSContext* aCx, const nsAString& aContactType,
    1.91 +                JS::Handle<JS::Value> aContact, const nsAString& aPin2,
    1.92 +                ErrorResult& aRv);
    1.93 +
    1.94 +  already_AddRefed<nsISupports>
    1.95 +  IccOpenChannel(const nsAString& aAid, ErrorResult& aRv);
    1.96 +
    1.97 +  already_AddRefed<nsISupports>
    1.98 +  IccExchangeAPDU(const JSContext* aCx, int32_t aChannel,
    1.99 +                  JS::Handle<JS::Value> aApdu, ErrorResult& aRv);
   1.100 +
   1.101 +  already_AddRefed<nsISupports>
   1.102 +  IccCloseChannel(int32_t aChannel, ErrorResult& aRv);
   1.103 +
   1.104 +  already_AddRefed<nsISupports>
   1.105 +  MatchMvno(const nsAString& aMvnoType, const nsAString& aMatchData,
   1.106 +            ErrorResult& aRv);
   1.107 +
   1.108 +  IMPL_EVENT_HANDLER(iccinfochange)
   1.109 +  IMPL_EVENT_HANDLER(cardstatechange)
   1.110 +  IMPL_EVENT_HANDLER(stkcommand)
   1.111 +  IMPL_EVENT_HANDLER(stksessionend)
   1.112 +
   1.113 +private:
   1.114 +  bool mLive;
   1.115 +  uint32_t mClientId;
   1.116 +  nsString mIccId;
   1.117 +  // mProvider is a xpcom service and will be released at shutdown, so it
   1.118 +  // doesn't need to be cycle collected.
   1.119 +  nsCOMPtr<nsIIccProvider> mProvider;
   1.120 +};
   1.121 +
   1.122 +} // namespace dom
   1.123 +} // namespace mozilla
   1.124 +
   1.125 +#endif // mozilla_dom_icc_Icc_h

mercurial