pub struct DefaultRM(_);
Expand description
Default Resource Manager for VISA
Implementations
sourceimpl DefaultRM
impl DefaultRM
sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
returns a session to the Default Resource Manager resource.
The first call to this function initializes the VISA system, including the Default Resource Manager resource, and also returns a session to that resource. Subsequent calls to this function return unique sessions to the same Default Resource Manager resource.
When a Resource Manager session is dropped, not only is that session closed, but also all find lists and device sessions (which that Resource Manager session was used to create) are closed.
sourcepub fn find_res_list(&self, expr: &ResID) -> Result<ResList>
pub fn find_res_list(&self, expr: &ResID) -> Result<ResList>
Queries a VISA system to locate the resources associated with a specified interface.
The viFindRsrc() operation matches the value specified in the expr parameter with the resources available for a particular interface. A regular expression is a string consisting of ordinary characters as well as special characters. You use a regular expression to specify patterns to match in a given string; in other words, it is a search criterion. The viFindRsrc() operation uses a case-insensitive compare feature when matching resource names against the regular expression specified in expr. For example, calling viFindRsrc() with “VXI?*INSTR” would return the same resources as invoking it with “vxi?*instr”.
All resource strings returned by viFindRsrc() will always be recognized by viOpen(). However, viFindRsrc() will not necessarily return all strings that you can pass to viParseRsrc() or viOpen(). This is especially true for network and TCPIP resources.
The search criteria specified in the expr parameter has two parts: a regular expression over a resource string, and an optional logical expression over attribute values. The regular expression is matched against the resource strings of resources known to the VISA Resource Manager. If the resource string matches the regular expression, the attribute values of the resource are then matched against the expression over attribute values. If the match is successful, the resource has met the search criteria and gets added to the list of resources found.
Special Characters and Operators | Meaning |
---|---|
? | Matches any one character. |
\ | Makes the character that follows it an ordinary character instead of special character. For example, when a question mark follows a backslash (?), it matches the ? character instead of any one character. |
[list] | Matches any one character from the enclosed list. You can use a hyphen to match a range of characters. |
[^list] | Matches any character not in the enclosed list. You can use a hyphen to match a range of characters. |
* | Matches 0 or more occurrences of the preceding character or expression. |
+ | Matches 1 or more occurrences of the preceding character or expression. |
Exp|exp | Matches either the preceding or following expression. The or operator |
(exp) | Grouping characters or expressions. |
Regular Expression | Sample Matches |
---|---|
GPIB?*INSTR | GPIB0::2::INSTR, and GPIB1::1::1::INSTR. |
GPIB[0-9]*::?*INSTR | GPIB0::2::INSTR and GPIB1::1::1::INSTR. |
GPIB[^0]::?*INSTR | GPIB1::1::1::INSTR but not GPIB0::2::INSTR or GPIB12::8::INSTR. |
VXI?*INSTR | VXI0::1::INSTR. |
?*VXI[0-9]*::?*INSTR | VXI0::1::INSTR. |
ASRL[0-9]*::?*INSTR | ASRL1::INSTR but not VXI0::5::INSTR. |
ASRL1+::INSTR | ASRL1::INSTR and ASRL11::INSTR but not ASRL2::INSTR. |
(GPIB|VXI)?*INSTR | GPIB1::5::INSTR and VXI0::3::INSTR but not ASRL2::INSTR. |
(GPIB0|VXI0)::1::INSTR | GPIB0::1::INSTR and VXI0::1::INSTR. |
?*INSTR | all INSTR (device) resources. |
?*VXI[0-9]*::?*MEMACC | VXI0::MEMACC. |
VXI0::?* | VXI0::1::INSTR, VXI0::2::INSTR, and VXI0::MEMACC. |
?* | all resources. |
visa://hostname/?* | all resources on the specified remote system. The hostname can be represented as either an IP address (dot-notation) or network machine name. This remote system need not be a conf igured remote system. |
/?* | all resources on the local machine. Configured remote systems are not queried. |
visa:/ASRL?*INSTR | all ASRL resources on the local machine and returns them in URL format (for example, visa:/ASRL1::INSTR). |
see also official doc
sourcepub fn find_res(&self, expr: &ResID) -> Result<ResID>
pub fn find_res(&self, expr: &ResID) -> Result<ResID>
Queries a VISA system to locate the resources associated with a specified interface, return the first resource matched
sourcepub fn parse_res(&self, res: &ResID) -> Result<(AttrIntfType, AttrIntfNum)>
pub fn parse_res(&self, res: &ResID) -> Result<(AttrIntfType, AttrIntfNum)>
Parse a resource string to get the interface information.
sourcepub fn parse_res_ex(
&self,
res: &ResID
) -> Result<(AttrIntfType, AttrIntfNum, VisaString, VisaString, VisaString)>
pub fn parse_res_ex(
&self,
res: &ResID
) -> Result<(AttrIntfType, AttrIntfNum, VisaString, VisaString, VisaString)>
Parse a resource string to get extended interface information.
the returned three VisaStrings are:
-
Specifies the resource class (for example, “INSTR”) of the given resource string.
-
This is the expanded version of the given resource string. The format should be similar to the VISA-defined canonical resource name.
-
Specifies the user-defined alias for the given resource string.
sourcepub fn open(
&self,
res_name: &ResID,
access_mode: AccessMode,
open_timeout: Duration
) -> Result<Instrument>
pub fn open(
&self,
res_name: &ResID,
access_mode: AccessMode,
open_timeout: Duration
) -> Result<Instrument>
Opens a session to the specified resource.
For the parameter accessMode, the value VI_EXCLUSIVE_LOCK (1) is used to acquire an exclusive lock immediately upon opening a session; if a lock cannot be acquired, the session is closed and an error is returned. The value VI_LOAD_CONFIG (4) is used to configure attributes to values specified by some external configuration utility. Multiple access modes can be used simultaneously by specifying a bit-wise OR of the values other than VI_NULL.
NI-VISA currently supports VI_LOAD_CONFIG only on Serial INSTR sessions.
Trait Implementations
sourceimpl HasAttribute for DefaultRM
impl HasAttribute for DefaultRM
sourceimpl Ord for DefaultRM
impl Ord for DefaultRM
sourceimpl PartialOrd<DefaultRM> for DefaultRM
impl PartialOrd<DefaultRM> for DefaultRM
sourcefn partial_cmp(&self, other: &DefaultRM) -> Option<Ordering>
fn partial_cmp(&self, other: &DefaultRM) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for DefaultRM
impl StructuralEq for DefaultRM
impl StructuralPartialEq for DefaultRM
Auto Trait Implementations
impl RefUnwindSafe for DefaultRM
impl Send for DefaultRM
impl Sync for DefaultRM
impl Unpin for DefaultRM
impl UnwindSafe for DefaultRM
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more