@@ -34,27 +34,26 @@ class On : public Camera<inum> {
3434 std::rethrow_exception (std::current_exception ());
3535 }
3636 });
37- spdlog::info (" Camera<{}{}> on" , DEADEYE_UNIT, inum);
37+ base::pipeline_runner_.SetLoggingEnabled (true );
38+ spdlog::info (" Camera<{}> on" , CameraId (inum));
3839 }
3940
4041 void react (CameraOff const &) final {
4142 Lights<inum>::dispatch (LightsOff ());
42- base::pipeline_runner_.Stop ();
4343
44- // future will not be valid at start-up since pipeline task not started yet
45- if (base::pipeline_future_.valid ()) {
46- try {
47- base::pipeline_future_.get ();
48- } catch (std::exception const & e) {
49- base::error_ = e.what ();
50- base::has_error_ = false ; // don't retrigger in controller
51- base::template transit<camera::Error<inum>>();
52- return ;
53- }
54- }
5544 base::template transit<camera::Off<inum>>();
5645 }
5746
47+ void react (LightsOff const &) final {
48+ base::pipeline_runner_.SetLoggingEnabled (false );
49+ spdlog::debug (" Camera<{}> stop logging" , CameraId (inum));
50+ }
51+
52+ void react (LightsOn const &) final {
53+ base::pipeline_runner_.SetLoggingEnabled (true );
54+ spdlog::debug (" Camera<{}> start logging" , CameraId (inum));
55+ }
56+
5857 void exit () final { base::SetStatus (DE_ON, false ); }
5958};
6059
@@ -67,7 +66,21 @@ class Off : public Camera<inum> {
6766
6867 void entry () final {
6968 base::SetStatus (DE_OFF, true );
70- spdlog::info (" Camera<{}{}> off" , DEADEYE_UNIT, inum);
69+ base::pipeline_runner_.SetLoggingEnabled (false );
70+ base::pipeline_runner_.Stop ();
71+
72+ // future will not be valid at start-up since pipeline task not started yet
73+ if (base::pipeline_future_.valid ()) {
74+ try {
75+ base::pipeline_future_.get ();
76+ } catch (std::exception const & e) {
77+ base::error_ = e.what ();
78+ base::has_error_ = false ; // don't re-trigger in controller
79+ base::template transit<camera::Error<inum>>();
80+ return ;
81+ }
82+ }
83+ spdlog::info (" Camera<{}> off" , CameraId (inum));
7184 }
7285
7386 void react (CameraOn const &) final {
@@ -88,20 +101,20 @@ class Error : public Camera<inum> {
88101 void entry () final {
89102 base::SetStatus (DE_ERROR, true );
90103 Lights<inum>::dispatch (LightsOff ());
91- spdlog::error (" Camera<{}{} > error: {}" , DEADEYE_UNIT, inum, base::error_);
104+ spdlog::error (" Camera<{}> error: {}" , CameraId ( inum) , base::error_);
92105 }
93106
94107 void react (CameraOn const &) final {
95108 base::SetStatus (DE_ON, false );
96- spdlog::warn (" Camera<{}{} > attempting to turn on camera in error state: {}" ,
97- DEADEYE_UNIT, inum, base::error_);
109+ spdlog::warn (" Camera<{}> attempting to turn on camera in error state: {}" ,
110+ CameraId ( inum) , base::error_);
98111 }
99112
100113 void react (CameraOff const &) final {
101114 base::SetStatus (DE_OFF, false );
102115 spdlog::warn (
103116 " Camera<{}{}> attempting to turn off camera in error state: {}" ,
104- DEADEYE_UNIT, inum, base::error_);
117+ CameraId ( inum) , base::error_);
105118 }
106119
107120 void exit () final { base::SetStatus (DE_ERROR, false ); }
0 commit comments