Cannes.Dumper (cannes v0.0.4) View Source
This module is for communicating with linux can sockets over candump.
TODO:
- Add logic to mount a can interface
- Test if desired interface is reacable
- Test if candump is available
- Pass options to candump
Link to this section Summary
Functions
Check if the candump process is still running.
Parses the given candump string in the candump log format into a map.
Returns a stream of formatted can messages.
Spawns a candump process on the given interface.
Stops a running candump process carefully.
Link to this section Functions
Specs
alive?(Porcelain.Process.t()) :: boolean()
Check if the candump process is still running.
Specs
format_candump_string(binary(), any()) :: %{ data: binary(), identifier: binary(), interface: any(), timestamp: number() }
Parses the given candump string in the candump log format into a map.
Example
iex> Cannes.Dumper.format_candump_string("(1398128227.045337) can0 133#0000000098")
%{
data: <<0, 0, 0, 0, 0, 0, 0, 9>>,
identifier: <<1, 51>>,
interface: "can0",
timestamp: 1398128227.045337
}
Specs
get_formatted_stream(Porcelain.Process.t()) :: Stream.t()
Returns a stream of formatted can messages.
Example
iex> Cannes.Dumper.get_formatted_stream(proc) #Stream<[ enum: #Function<63.104660160/2 in Stream.unfold/2>, funs: [#Function<51.104660160/1 in Stream.reject/2>, #Function<38.104660160/1 in Stream.each/2>] ]>
Specs
Specs
start(binary()) :: Porcelain.Process.t()
Spawns a candump process on the given interface.
Example
iex> Cannes.Dumper.start("vcan0")
%Porcelain.Process{
err: nil,
out: #Function<63.104660160/2 in Stream.unfold/2>,
pid: #PID<0.212.0>
}
Specs
stop(Porcelain.Process.t()) :: true
Stops a running candump process carefully.
Example
proc = Cannes.Dumper.stop(proc)
true