@@ -4,7 +4,6 @@ namespace phidgets {
44
55Phidget::Phidget ()
66{
7- updater.add (" IMU Driver Status" , this , &phidgets::Phidget::phidgetsDiagnostics);
87
98}
109
@@ -18,7 +17,7 @@ void Phidget::registerHandlers()
1817{
1918 CPhidget_set_OnAttach_Handler (handle_, &Phidget::AttachHandler, this );
2019 CPhidget_set_OnDetach_Handler (handle_, &Phidget::DetachHandler, this );
21- CPhidget_set_OnError_Handler (handle_, &Phidget::ErrorHandler, this );
20+ CPhidget_set_OnError_Handler (handle_, &Phidget::ErrorHandler, this );
2221}
2322
2423void Phidget::init (CPhidgetHandle handle)
@@ -28,7 +27,6 @@ void Phidget::init(CPhidgetHandle handle)
2827
2928int Phidget::open (int serial_number)
3029{
31- updater.setHardwareID (" none" );
3230 return CPhidget_open (handle_, serial_number);
3331}
3432
@@ -97,23 +95,16 @@ std::string Phidget::getErrorDescription(int errorCode)
9795
9896void Phidget::attachHandler ()
9997{
100- is_connected = true ;
101- updater.force_update ();
10298 printf (" Phidget attached (serial# %d)\n " , getDeviceSerialNumber ());
10399}
104100
105101void Phidget::detachHandler ()
106102{
107103 printf (" Phidget detached (serial# %d)\n " , getDeviceSerialNumber ());
108- is_connected = false ;
109- updater.force_update ();
110104}
111105
112106void Phidget::errorHandler (int error)
113107{
114- is_error = true ;
115- updater.force_update ();
116- is_error = false ;
117108 printf (" Phidget error [%d]: %s\n " , error, getErrorDescription (error).c_str ());
118109}
119110
@@ -135,27 +126,4 @@ int Phidget::ErrorHandler(CPhidgetHandle handle, void *userptr, int ErrorCode, c
135126 return 0 ;
136127}
137128
138- // Added for diagnostics
139- void Phidget::phidgetsDiagnostics (diagnostic_updater::DiagnosticStatusWrapper &stat)
140- {
141- if (is_connected)
142- {
143- stat.summary (diagnostic_msgs::DiagnosticStatus::OK, " The Phidget is connected." );
144- stat.add (" Device Serial Number" , getDeviceSerialNumber ());
145- stat.add (" Device Name" , getDeviceName ());
146- stat.add (" Device Type" , getDeviceType ());
147- }
148- else
149- {
150- stat.summary (diagnostic_msgs::DiagnosticStatus::ERROR, " The Phidget is not connected. Check USB." );
151- }
152-
153- if (is_error && error_number != 0 )
154- {
155- stat.summary (diagnostic_msgs::DiagnosticStatus::ERROR, " The Phidget is in Error." );
156- stat.addf (" Error Number" ," %f" ,error_number);
157- stat.add (" Error message" ,getErrorDescription (error_number));
158- }
159- }
160-
161129} // namespace phidgets
0 commit comments