Skip to main content

Crate pv

Crate pv 

Source
Expand description

PV access for bobview.

Widgets ask a PvManager for a Pv by name and read its latest PvState each frame. The manager owns a tokio runtime on which one task per PV talks to the backend chosen by the name’s prefix:

prefixbackend
ca://Channel Access (the default)
pva://PV Access
loc://local PVs held in this process
sim://simulated signals (sine, ramp, noise …)
=, eq://formulas over other PVs

In a browser (wasm32) there is no runtime: sim:// runs on the page’s event loop, and ca:// and pva:// PVs come over a PV Web Socket ([set_pvws]).

Structs§

Image
A 2D image, row-major with x varying fastest.
Pv
A handle to a live PV. Cheap to clone.
PvManager
Creates and shares PV subscriptions.
PvName
A parsed PV name such as ca://X, loc://x<VDouble>(3) or sim://sine(0, 10, 0.1).
PvState
Everything known about a PV at one moment.

Enums§

ImageData
Image samples in their native type.
Scheme
Which backend serves a PV.
Severity
EPICS alarm severity.
Value
A PV’s value, reduced to the few shapes a display needs.

Functions§

formula_inputs
The PVs a formula’s text names (a+b for the formula =a+b), each once, in order; none when it does not parse. A PV whose name is computed is left out, though the PVs its name is computed from are not.
long_string
The text held in a char array, as Phoebus’s getLongString reads it: the bytes up to the first NUL (or all of them), as UTF-8.
long_string_bytes
text as a char array holding a long string: its UTF-8 bytes and a terminating NUL, cut to fit max elements (the PV’s element count, if known) with the NUL kept, and never inside a multi-byte character.
same_origin
Whether two URLs are on one server (see url_origin).
split_array
The elements of an array typed as text, in the [1, 2, 3] form that arrays are shown in, or just separated by spaces or commas.
split_strings
The elements of a string array typed as text, as Phoebus’s StringList reads it: ["a b", "c"], with \" for a quote inside a quoted item, or unquoted items separated by commas.
url_origin
The origin of an absolute URL: scheme://host[:port] in lowercase, without user info or a default port, and with a websocket’s scheme as the page’s (ws as http, wss as https), so a socket and a page on one server have one origin. None for anything else, including a URL with a backslash, a control character or white space: a browser reads those otherwise (\ is / to it, so ws://evil\@server/ is a socket to evil).

Type Aliases§

ListenFn
Listener
Called with a PV’s new state on each change, from the thread making it, for as long as the caller keeps the Arc (see Pv::listen).
Notifier
Called whenever any PV changes, so a UI can schedule a repaint.