diff --git a/index.html b/index.html index d01a0e8..9f1d2bc 100644 --- a/index.html +++ b/index.html @@ -1538,8 +1538,55 @@

control() method

getAttribute() method

-

Queries a card reader's attribute or capability value, given its tag.

-
Write an algorithm for this method.
+

The {{SmartCardConnection/getAttribute(tag)}} method steps are:

+
    +
  1. Let |promise:Promise| be [=a new promise=].
  2. +
  3. If + [=this=].{{SmartCardConnection/[[context]]}}.{{SmartCardContext/[[operationInProgress]]}} + is `true`, [=reject=] |promise| with a "{{InvalidStateError}}" + {{DOMException}} and return |promise|.
  4. +
  5. If [=this=].{{SmartCardConnection/[[comm]]}} is `null`, [=reject=] + |promise| with a "{{InvalidStateError}}" {{DOMException}} and return + |promise|.
  6. +
  7. Set + [=this=].{{SmartCardConnection/[[context]]}}.{{SmartCardContext/[[operationInProgress]]}} + to `true`.
  8. +
  9. Run the following steps [=in parallel=]: +
      +
    1. Let |pcscTag:DWORD| be a [[PCSC5]] `DWORD` containing |tag|.
    2. +
    3. Let |buffer:array of BYTE| be a [[PCSC5]] `BYTE[]` large + enough to hold this reader attribute, as determined by the + platform's [[PCSC5]] implementation.
    4. +
    5. Call [=this=].{{SmartCardConnection/[[comm]]}}.`GetReaderCapabilities()` + with |pcscTag| and |buffer| as arguments.
    6. +
    7. Let |responseCode:RESPONSECODE| be the returned + `RESPONSECODE`.
    8. +
    9. [=Queue a global task=] on the [=relevant global object=] of + [=this=] using the [=smart card task source=] which performs the + following steps: +
        +
      1. [=Clear the operationInProgress=] of + [=this=].{{SmartCardConnection/[[context]]}}.
      2. +
      3. If |responseCode| is not `SCARD_S_SUCCESS`, [=reject=] + |promise| with an [=exception=] + {{SmartCardError/corresponding}} to |responseCode| and abort + these steps.
      4. +
      5. Let |resultBytes:byte sequence| be the bytes of |buffer| + containing the attribute read.
      6. +
      7. [=Resolve=] |promise| with the result of + [=ArrayBuffer/Create|creating=] an {{ArrayBuffer}} from + |resultBytes| in [=this=]'s [=relevant Realm=].
      8. +
      +
    10. +
    +
  10. +
  11. Return |promise|.
  12. +
+

setAttribute() method