Source file communication.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
open Sexplib.Std
type payload =
| State of int * [ `Fast | `Normal ]
| Ready
| Open_speaker_notes
| Close_speaker_notes
| Open_recording_panel
| Close_recording_panel
| Speaker_notes of string
| Drawing of string
| Send_all_drawing
| Receive_all_drawing of string list
| Save_drawing of string * string
| Next
| Previous
| Can_save
| Can_gui
| ActivateGUI of Common_types.gui_id
| DeActivateGUI
| SaveCoordinates of {
id : Common_types.gui_id;
x : int option;
y : int option;
w : int option;
h : int option;
scale : float option;
}
| GotoLoc of Common_types.gui_id
[@@deriving sexp]
type t = { payload : payload; id : string } [@@deriving sexp]
let t_of_sexp_opt s =
try Some (t_of_sexp s) with Sexplib0.Sexp.Of_sexp_error _ -> None
let of_string s =
match Sexplib.Sexp.of_string_conv s t_of_sexp_opt with
| `Result (Some _ as r) -> r
| _ -> None
let to_string v = v |> sexp_of_t |> Sexplib.Sexp.to_string