-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
270 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//! Implements system parameters on the session. | ||
mod real_time; | ||
|
||
use ni_syscfg_sys::{NISysCfgSystemProperty, NISysCfgSystemProperty_NISysCfgSystemPropertyHostname, NISysCfgSystemProperty_NISysCfgSystemPropertyIsLocked, NISysCfgSystemProperty_NISysCfgSystemPropertyIsLockingSupported, NISysCfgSystemProperty_NISysCfgSystemPropertyProductName, NISysCfgSystemProperty_NISysCfgSystemPropertySerialNumber}; | ||
use crate::Session; | ||
use crate::parameters::{ApiBool, ReadableParameter}; | ||
use crate::error::Result; | ||
pub use real_time::RealTimeSession; | ||
|
||
impl Session { | ||
|
||
pub fn locked(&self) -> Result<bool> { | ||
ApiBool::read_system_parameter(self.handle(), NISysCfgSystemProperty_NISysCfgSystemPropertyIsLocked).map(|a| a.into()) | ||
} | ||
|
||
pub fn locking_supported(&self) -> Result<bool> { | ||
ApiBool::read_system_parameter(self.handle(), NISysCfgSystemProperty_NISysCfgSystemPropertyIsLockingSupported).map(|a| a.into()) | ||
} | ||
|
||
pub fn hostname(&self) -> Result<String> { | ||
String::read_system_parameter(self.handle(), NISysCfgSystemProperty_NISysCfgSystemPropertyHostname) | ||
} | ||
|
||
pub fn serial_number(&self) -> Result<String> { | ||
String::read_system_parameter(self.handle(), NISysCfgSystemProperty_NISysCfgSystemPropertySerialNumber) | ||
} | ||
|
||
pub fn product_name(&self) -> Result<String> { | ||
String::read_system_parameter(self.handle(), NISysCfgSystemProperty_NISysCfgSystemPropertyProductName) | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//! System interface specific to real time systems. | ||
use ni_syscfg_sys::{NISysCfgSessionHandle, NISysCfgSystemProperty_NISysCfgSystemPropertySystemState}; | ||
use crate::Session; | ||
use crate::error::Result; | ||
use crate::parameters::ReadableParameter; | ||
|
||
pub struct RealTimeSession { | ||
handle: NISysCfgSessionHandle | ||
} | ||
|
||
|
||
impl RealTimeSession { | ||
pub fn from_session(session: &Session) -> RealTimeSession { | ||
Self { | ||
handle: session.handle() | ||
} | ||
} | ||
|
||
pub fn status(&self) -> Result<String> { | ||
String::read_system_parameter(self.handle, NISysCfgSystemProperty_NISysCfgSystemPropertySystemState) | ||
} | ||
|
||
|
||
} |