Skip to content

Commit

Permalink
Add EV3.connect_bluetooth for all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris00 committed Jul 11, 2015
1 parent 3b3697b commit 21d277e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/mindstorm_EV3.ml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,26 @@ let bt_recv fd =

#ifdef MACOSX
(* Mac OS X *)
let connect_bluetooth tty =
let fd = Unix.openfile tty [Unix.O_RDWR] 0o660 in
{ fd = fd;
send = bt_send;
recv = bt_recv;
close = Unix.close;
msg_counter = 0 }

#elif defined WIN32
(* Windows *)
external socket_bluetooth : string -> Unix.file_descr
= "ocaml_mindstorm_connect"

let connect_bluetooth addr =
let fd = socket_bluetooth ("\\\\.\\" ^ addr) in
{ fd = fd;
send = bt_send;
recv = bt_recv;
close = Unix.close;
msg_counter = 0 }

#else
(* Unix *)
Expand Down

0 comments on commit 21d277e

Please sign in to comment.