package socketcan
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Socketcan.Frame
CAN frames representing CAN message frames including CAN identifier, payload and time of arrival.
val create :
Id.t ->
?rtr:bool ->
?error:bool ->
?timestamp:Posix_time.Timespec.t ->
Bytes.t ->
(t, [> `Exceeded_payload_size ]) Result.resultcreate i data creates a new CAN frame with CAN-id i and payload data; the payload size must not exceed max_dlen bytes else Result.Error is returned. The extended frame format flag ist set, if the supplied CAN id i is an CAN 2.0B identifier (iff Id.is_eff i = true). The remote transmission request flag and error frame flag are set if rtr and error are set to true respectively. The default timestamp is 0 sec, 0 nsec.
val create_exn :
Id.t ->
?rtr:bool ->
?error:bool ->
?timestamp:Posix_time.Timespec.t ->
Bytes.t ->
tcreate_exn i data is identical to create i data but will raise Invalid_argument in case the payload size is exceeded.
val create_data :
Id.t ->
Bytes.t ->
(t, [> `Exceeded_payload_size ]) Result.resultcreate i p creates a new CAN data frame with CAN-id i and payload p; the payload size must not exceed max_dlen bytes else Result.Error is returned.
create_exn i p is identical to create i p but will raise Invalid_argument in case the payload size is exceeded.
create_rtr i creates a new remote transmission request CAN frame with CAN-id i. The frame does not contain any payload.
val set_data : t -> Bytes.t -> (t, [> `Exceeded_payload_size ]) Result.resultset_data f d returns a new frame with the payload set to d. All other properties of the new frame are identical to f.
val timestamp : t -> Posix_time.Timespec.ttimestamp frame returns the timestamp of the frame frame.
val set_timestamp : t -> Posix_time.Timespec.t -> tset_timestamp frame timestamp returns a new frame with the timestamp set to timestamp.
val is_rtr : t -> boolis_rtr frame returns whether the frame frame is a remote transmission request frame.
set_rtr frame returns a new frame with the remote transmission request flag set.
unset_rtr frame returns a new frame with the remote transmission request flag removed.
val is_error : t -> boolis_error frame returns whether the frame frame is an error message frame
val is_sff : t -> boolis_sff frame returns whether the frame frame is a standard frame format frame.
set_sff frame returns a new frame with the standard frame format flag set. The CAN identifier will be masked down to sff_mask.
val is_eff : t -> boolis_eff frame returns whether the frame frame is an extended frame format frame. This is the negation of is_sff: is_eff x = not is_sff x.
val to_string : t -> stringto_string f returns a human-readable string representation of the frame f.
val print : t -> unitprint f prints the frame f to stdout in a human-readable fashion.