package obus
Pure Ocaml implementation of the D-Bus protocol
Install
Dune Dependency
Authors
Maintainers
Sources
obus-1.2.5.tar.gz
md5=81eb1034c6ef4421a2368a9b352199de
sha512=4b540497188a7d78f4f14f94c6b7fdff47dd06436a34e650ff378dd77bb3e2acb7afd45cd72daf4ddba06e732e9944d560c2882dc37862f1b1f1bb6df37e6205
doc/src/obus.upower/uPower_policy.ml.html
Source file uPower_policy.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
(* * uPower_policy.ml * ---------------- * Copyright : (c) 2010, Jeremie Dimino <jeremie@dimino.org> * Licence : BSD3 * * This file is a part of obus, an ocaml implementation of D-Bus. *) open Lwt type latency = [ `Cpu_dma | `Network ] let string_of_latency = function | `Cpu_dma -> "cpu_dma" | `Network -> "network" let latency_of_string = function | "cpu_dma" -> `Cpu_dma | "network" -> `Network | latency -> Printf.ksprintf failwith "unknown latency type (%S)" latency type latency_request = { lr_cookie : cookie; lr_uid : int; lr_pid : int; lr_exec : string; lr_timespec : int64; lr_persistent : bool; lr_typ : latency; lr_reserved : string; lr_value : int; } open UPower_interfaces.Org_freedesktop_UPower_QoS let proxy daemon = OBus_proxy.make (UPower.to_peer daemon) ["org"; "freedesktop"; "UPower"; "Policy"] let set_minimum_latency daemon ~latency ~value = OBus_method.call m_SetMinimumLatency (proxy daemon) (string_of_latency latency, Int32.of_int value) let request_latency daemon ~latency ~value ~persistent = let value = Int32.of_int value in let%lwt = OBus_method.call m_RequestLatency (proxy daemon) (string_of_latency latency, value, persistent) in let = Int32.to_int cookie in return cookie let cancel_request daemon ~latency ~ = let = Int32.of_int cookie in OBus_method.call m_CancelRequest (proxy daemon) (string_of_latency latency, cookie) let get_latency daemon ~latency = let%lwt value = OBus_method.call m_GetLatency (proxy daemon) (string_of_latency latency) in let value = Int32.to_int value in return value let latency_changed daemon = OBus_signal.map (fun (latency, value) -> (latency_of_string latency, Int32.to_int value)) (OBus_signal.make s_LatencyChanged (proxy daemon)) let get_latency_requests daemon = let%lwt requests = OBus_method.call m_GetLatencyRequests (proxy daemon) () in return (List.map (fun (, uid, pid, exec, timespec, persistent, typ, reserved, value) -> { lr_cookie = Int32.to_int cookie; lr_uid = Int32.to_int uid; lr_pid = Int32.to_int pid; lr_exec = exec; lr_timespec = timespec; lr_persistent = persistent; lr_typ = latency_of_string typ; lr_reserved = reserved; lr_value = Int32.to_int value; }) requests) let requests_changed daemon = OBus_signal.make s_RequestsChanged (proxy daemon)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>