pub struct LogBlock { /* private fields */ }Expand description
§Log Block
This object represent an IDLE LogBlock in the Crazyflie.
If the LogBlock object is dropped or its associated LogStream, the Log Block will be deleted in the Crazyflie freeing resources.
See the log module documentation for more context and information.
Implementations§
Source§impl LogBlock
impl LogBlock
Sourcepub async fn start(self, period: LogPeriod) -> Result<LogStream>
pub async fn start(self, period: LogPeriod) -> Result<LogStream>
Start log block and return a stream to read the value
Since a log-block cannot be modified after being started, this function consumes the LogBlock object and return a LogStream. The function LogStream::stop() can be called on the LogStream to get back the LogBlock object.
This function can fail if there is a protocol error or an error reported by the Crazyflie. In such case, the LogBlock object will be dropped and the block will be deleted in the Crazyflie
Sourcepub async fn add_variable(&mut self, name: &str) -> Result<()>
pub async fn add_variable(&mut self, name: &str) -> Result<()>
Add a variable to the log block
A packet will be sent to the Crazyflie to add the variable. The variable is logged in the same format as it is stored in the Crazyflie (ie. there is no conversion done)
This function can fail if the variable is not found in the toc or of the Crazyflie returns an error The most common error reported by the Crazyflie would be if the log block is already too full.