File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,6 +118,15 @@ impl Attribute {
118118 } )
119119 }
120120
121+ /// Returns the current content of the wrapped file.
122+ pub fn get_bytes ( & self ) -> Ev3Result < Vec < u8 > > {
123+ let mut value: Vec < u8 > = Vec :: new ( ) ;
124+ let mut file = self . file . lock ( ) . unwrap ( ) ;
125+ file. seek ( SeekFrom :: Start ( 0 ) ) ?;
126+ file. read_to_end ( & mut value) ?;
127+ Ok ( value)
128+ }
129+
121130 /// Returns the current value of the wrapped file.
122131 fn get_str ( & self ) -> Ev3Result < String > {
123132 let mut value = String :: new ( ) ;
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ use crate::{Device, Ev3Result};
66pub trait Sensor : Device {
77 /// Reading the file will give the unscaled raw values in the `value<N>` attributes.
88 /// Use `bin_data_format`, `num_values` and the individual sensor documentation to determine how to interpret the data.
9- fn get_bin_data ( & self ) -> Ev3Result < String > {
10- self . get_attribute ( "bin_data" ) . get ( )
9+ fn get_bin_data ( & self ) -> Ev3Result < Vec < u8 > > {
10+ self . get_attribute ( "bin_data" ) . get_bytes ( )
1111 }
1212
1313 /// Returns the format of the values in `bin_data` for the current mode. Possible values are:
You can’t perform that action at this time.
0 commit comments