taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

hint-power-state.rst (1397B)


      1 .. ts:op:: hintPowerState
      2 
      3   Report the host system's current power source.
      4 
      5   **Request:**
      6 
      7   The request ``args`` must be a `HintPowerStateRequest` object.
      8 
      9   **Response:**
     10 
     11   On success, the result is an empty object.
     12 
     13   **Side effects:**
     14 
     15   Records the host's power state, which affects whether free
     16   opportunistic refreshes run.  When the power source changes, running
     17   background tasks are woken up.
     18 
     19   **Details:**
     20 
     21   The power source controls whether wallet-core may refresh coins
     22   opportunistically, long before they expire: such early refreshes are
     23   only made when they are free of charge, and only on ``external``
     24   power.  The ``unknown`` power source never qualifies.  When the power
     25   source changes, wallet-core restarts all running background tasks.
     26 
     27   The reported power source is a transient observation: it is discarded
     28   when wallet-core restarts, and if no fresh hint arrives within 60
     29   seconds the effective power source falls back to ``unknown``.  Clients
     30   should therefore re-report the power state periodically and after any
     31   change.
     32 
     33 .. ts:def:: HintPowerStateRequest
     34 
     35   interface HintPowerStateRequest {
     36     // Currently observed power source of the host system.
     37     powerSource: WalletPowerSource;
     38   }
     39 
     40 .. ts:def:: WalletPowerSource
     41 
     42   // Power source of the host system, as observed by the client.
     43   type WalletPowerSource = "external" | "battery" | "unknown";