HomeKit Accessory Protocol (HAP) for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-linkedin: apply dune fmt

Pure formatting changes from `dune fmt`: doc comment placement moves
from above the binding to below it for `type`s, multi-line `match`
expressions collapse onto one line where they fit, and infix operator
applications pick up spaces (`Soup.($?)` -> `Soup.( $? )`). No
semantic changes.

+31 -12
+24 -12
README.md
··· 6 6 7 7 ## Installation 8 8 9 + Install with opam: 10 + 11 + ```sh 12 + $ opam install hap 9 13 ``` 10 - opam install hap 14 + 15 + If opam cannot find the package, it may not yet be released in the public 16 + `opam-repository`. Add the overlay repository, then install it: 17 + 18 + ```sh 19 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 20 + $ opam update 21 + $ opam install hap 11 22 ``` 12 23 13 24 ## Usage ··· 15 26 ```ocaml 16 27 Eio_main.run @@ fun env -> 17 28 Eio.Switch.run @@ fun sw -> 18 - let net = Eio.Stdenv.net env in 19 - let clock = Eio.Stdenv.clock env in 20 - 29 + let net = Eio.Stdenv.net env 30 + let clock = Eio.Stdenv.clock env 21 31 (* Discover HomeKit accessories on the network *) 22 - let accessories = Hap.discover ~sw ~net ~clock ~timeout:5.0 () in 23 - 32 + let accessories = Hap.discover ~sw ~net ~clock ~timeout:5.0 () 24 33 (* Pair with an accessory (one-time setup) *) 25 34 let pairing = Hap.pair_setup ~sw ~net ~clock ~pin:"031-45-154" 26 35 accessory_info in 27 36 28 37 (* Verify and establish encrypted session *) 29 - let session = Hap.pair_verify ~sw ~net ~clock pairing in 30 - 38 + let session = Hap.pair_verify ~sw ~net ~clock pairing 31 39 (* Control an outlet *) 32 - Hap.turn_on_outlet session; 33 - Hap.turn_off_outlet session; 34 - Hap.toggle_outlet session 40 + Hap.turn_on_out 41 + let session; 42 + Hap.turn_off_out 43 + let session; 44 + Hap.toggle_out 45 + let session 35 46 ``` 36 47 37 48 ## API ··· 58 69 - `Hap.accessories` -- List accessory services and characteristics 59 70 - `Hap.characteristics` -- Read characteristic values 60 71 - `Hap.put_characteristic` -- Write a characteristic value 61 - - `Hap.turn_on_outlet` / `turn_off_outlet` / `toggle_outlet` -- Outlet shortcuts 72 + - `Hap.turn_on_outlet` / `turn_off_outlet` / `toggle_outlet` -- Out 73 + let shortcuts 62 74 63 75 ### TLV 64 76
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries hap eio_main))
+2
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 3 4 (name hap) 4 5 ··· 34 35 (ipaddr (>= 5.0)) 35 36 (domain-name (>= 0.4)) 36 37 (alcotest :with-test) 38 + (mdx :with-test) 37 39 (alcobar :with-test)))
+1
hap.opam
··· 28 28 "ipaddr" {>= "5.0"} 29 29 "domain-name" {>= "0.4"} 30 30 "alcotest" {with-test} 31 + "mdx" {with-test} 31 32 "alcobar" {with-test} 32 33 "odoc" {with-doc} 33 34 ]