pub struct Session {
pub(crate) handle: NonNull<SvzSession>,
}Expand description
One opened log: its catalog, the view state, the transforms, and what the plot and readout show.
Fields§
§handle: NonNull<SvzSession>The C handle; never null.
Implementations§
Source§impl Session
impl Session
Sourcepub fn new() -> Result<Self, Error>
pub fn new() -> Result<Self, Error>
A session with no log.
§Errors
Error::AbiMismatch for a library of another interface version,
Error::OutOfMemory when it cannot allocate.
Sourcepub(crate) fn raw(&self) -> *mut SvzSession
pub(crate) fn raw(&self) -> *mut SvzSession
The handle, for a call.
Sourcepub(crate) fn last_error(&self) -> Error
pub(crate) fn last_error(&self) -> Error
The library’s last error on this session.
Sourcepub(crate) fn returned(&mut self, text: *const c_char) -> String
pub(crate) fn returned(&mut self, text: *const c_char) -> String
Copies a string the library returned for this session.
Sourcepub fn open(
&mut self,
path: impl AsRef<Path>,
preferences: Option<&Preferences>,
) -> Result<(), Error>
pub fn open( &mut self, path: impl AsRef<Path>, preferences: Option<&Preferences>, ) -> Result<(), Error>
Opens a log and does everything sensorViz’s File > Load does: reads
it, resets the view, runs the transforms and applies preferences’
entry for its tag.
§Errors
Error::Library when the log cannot be read, leaving the session as
it was; Error::Nul when the path holds a NUL.
Sourcepub fn apply_preferences(&mut self, preferences: &Preferences) -> Changes
pub fn apply_preferences(&mut self, preferences: &Preferences) -> Changes
Applies preferences’ entry for the open log’s tag, or the defaults.
Sourcepub fn remember_preferences(&self, preferences: &mut Preferences)
pub fn remember_preferences(&self, preferences: &mut Preferences)
Stores the open log’s display choices in preferences under its tag.
Sourcepub fn forget_preferences(&self, preferences: &mut Preferences)
pub fn forget_preferences(&self, preferences: &mut Preferences)
Removes preferences’ entry for the open log’s tag.
Sourcepub fn state_json(&mut self) -> [String; 3]
pub fn state_json(&mut self) -> [String; 3]
The JSON texts of the catalog, view and spec, as the library writes them: for comparing two sessions exactly.
Sourcepub fn parameters(&mut self) -> Result<Vec<Parameter>, Error>
pub fn parameters(&mut self) -> Result<Vec<Parameter>, Error>
The parameters of the transforms that apply to the open log, with their current values.
§Errors
Error::Json for JSON this crate does not understand.
Sourcepub fn hover(&mut self, time: f64) -> Result<Vec<String>, Error>
pub fn hover(&mut self, time: f64) -> Result<Vec<String>, Error>
The hover readout at time: the time, then each visible stream’s
label: value units.
§Errors
Error::Json for JSON this crate does not understand.
Sourcepub fn format_time(&mut self, time: f64) -> String
pub fn format_time(&mut self, time: f64) -> String
time as the readout shows it.
Sourcepub fn range_for_dialog(&self, id: &str) -> Option<(f64, f64)>
pub fn range_for_dialog(&self, id: &str) -> Option<(f64, f64)>
The range the range dialog starts from for stream id; None for an
unknown stream.
Sourcepub fn envelope(
&mut self,
stream: u64,
t0: f64,
t1: f64,
columns: i32,
break_gaps: bool,
) -> Envelope
pub fn envelope( &mut self, stream: u64, t0: f64, t1: f64, columns: i32, break_gaps: bool, ) -> Envelope
One stream’s M4 envelope over [t0, t1] (infinities for the whole
stream) at columns, breaking lines at gaps when break_gaps.
Sourcepub fn compass_samples(&mut self) -> Vec<OrientationSample>
pub fn compass_samples(&mut self) -> Vec<OrientationSample>
The compass orientation samples; empty without a compass.
Sourcepub fn state_dump(&mut self) -> String
pub fn state_dump(&mut self) -> String
Takes the open log through sensorViz’s state-dump script and returns the dump; it changes the session, so use one opened for the purpose.
Sourcepub fn set_stream_visible(&mut self, id: &str, visible: bool) -> Changes
pub fn set_stream_visible(&mut self, id: &str, visible: bool) -> Changes
Shows or hides stream id.
Sourcepub fn set_stream_range(&mut self, id: &str, lower: f64, upper: f64) -> Changes
pub fn set_stream_range(&mut self, id: &str, lower: f64, upper: f64) -> Changes
Sets a y range the user chose, and the ranges linked to it.
Sourcepub fn reset_zoom(&mut self) -> Changes
pub fn reset_zoom(&mut self) -> Changes
Reset Zoom: clears every custom range.
Sourcepub fn set_title_visible(&mut self, visible: bool) -> Changes
pub fn set_title_visible(&mut self, visible: bool) -> Changes
Shows or hides the title.
Sourcepub fn set_utc_offset(&mut self, hours: i32) -> Changes
pub fn set_utc_offset(&mut self, hours: i32) -> Changes
Sets the UTC offset for epoch times, hours.
Sourcepub fn set_cursors_visible(&mut self, visible: bool) -> Changes
pub fn set_cursors_visible(&mut self, visible: bool) -> Changes
Shows or hides the time cursors.
Sourcepub fn set_break_at_gaps(&mut self, break_gaps: bool) -> Changes
pub fn set_break_at_gaps(&mut self, break_gaps: bool) -> Changes
Breaks lines at gaps, or joins them.
Sourcepub fn set_parameter(&mut self, id: &str, value: f64) -> Result<Changes, Error>
pub fn set_parameter(&mut self, id: &str, value: f64) -> Result<Changes, Error>
Sets a transform parameter (an id from Session::parameters) and
remakes what it affects; a toggle is on when value is nonzero.
§Errors
Error::Library when the transform failed to remake its outputs;
Error::Nul when the id holds a NUL.