Cure
The main Cure module. Provides a few functions to easily start a connection with a C-program, to send messages to the C-program and to handle the incoming responses.
Summary↑
load(c_program_name) | Starts a Cure.Server process that can communicate with a C-program |
send_data(server, msg) | Sends binary data to the C-program that the server is connected with. A callback function (arity 1) can be added to handle the incoming response of the C-program. If no callback is added, the result is sent back to the process that called this function. If the third argument is :sync, this function blocks and returns the output from the C-program |
send_data(server, msg, callback) | |
start(type, args) | Starts the Cure application, returns the Cure.Supervisor-PID |
stop(server) | Stops a server process |
Functions
Specs:
- load(String.t) :: {:ok, pid}
Starts a Cure.Server process that can communicate with a C-program.
Specs:
- send_data(pid, binary) :: :ok
Sends binary data to the C-program that the server is connected with. A callback function (arity 1) can be added to handle the incoming response of the C-program. If no callback is added, the result is sent back to the process that called this function. If the third argument is :sync, this function blocks and returns the output from the C-program.
(Same effect as calling Cure.Server.send_data directly.)
Specs:
- send_data(pid, binary, (binary -> any) | nil | :sync) :: :ok | binary
Specs:
- start(any, any) :: {:ok, pid} | {:error, term}
Starts the Cure application, returns the Cure.Supervisor-PID.
Specs:
- stop(pid) :: :ok
Stops a server process.