File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -563,7 +563,10 @@ impl<'a> InstantCamera<'a> {
563
563
}
564
564
565
565
pub fn stop_grabbing ( & self ) -> PylonResult < ( ) > {
566
- ffi:: instant_camera_stop_grabbing ( & self . inner ) . into_rust ( )
566
+ ffi:: instant_camera_stop_grabbing ( & self . inner ) . into_rust ( ) ?;
567
+ #[ cfg( feature = "stream" ) ]
568
+ self . fd . replace ( None ) ;
569
+ Ok ( ( ) )
567
570
}
568
571
569
572
pub fn is_grabbing ( & self ) -> bool {
Original file line number Diff line number Diff line change @@ -90,4 +90,23 @@ mod tests {
90
90
91
91
Ok ( ( ) )
92
92
}
93
+
94
+ #[ tokio:: test]
95
+ async fn start_stop_loop_works ( ) -> PylonResult < ( ) > {
96
+ let pylon = Pylon :: new ( ) ;
97
+ let cam = TlFactory :: instance ( & pylon) . create_first_device ( ) ?;
98
+ cam. open ( ) ?;
99
+ tokio:: pin!( cam) ;
100
+ for _ in 0 ..5 {
101
+ let mut images = 10 ;
102
+ cam. start_grabbing ( & GrabOptions :: default ( ) . count ( images) ) ?;
103
+ while let Some ( res) = cam. next ( ) . await {
104
+ images -= 1 ;
105
+ assert ! ( res. grab_succeeded( ) ?) ;
106
+ }
107
+ assert_eq ! ( images, 0 ) ;
108
+ cam. stop_grabbing ( ) ?;
109
+ }
110
+ Ok ( ( ) )
111
+ }
93
112
}
You can’t perform that action at this time.
0 commit comments