Instrument Neutral Distributed Interface INDI 2.2.5
indiimuinterface.cpp
Go to the documentation of this file.
1/*
2 IMU Interface
3 Copyright (C) 2025 Jasem Mutlaq ([email protected])
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19*/
20
21#include "indiimuinterface.h"
22#include "defaultdevice.h"
23#include "indilogger.h"
24#include "indipropertylight.h"
25#include <cmath>
26
27namespace INDI
28{
29
30IMUInterface::IMUInterface(DefaultDevice *defaultDevice) : m_defaultDevice(defaultDevice)
31{
32}
33
34void IMUInterface::initProperties(const std::string &groupName)
35{
36 // Core Sensor Data Properties
37 if (HasOrientation())
38 {
39 OrientationNP[ORIENTATION_ROLL].fill("ROLL", "Roll (deg)", "%.4f", -180, 180, 0, 0);
40 OrientationNP[ORIENTATION_PITCH].fill("PITCH", "Pitch (deg)", "%.4f", -90, 90, 0, 0);
41 OrientationNP[ORIENTATION_YAW].fill("YAW", "Yaw (deg)", "%.4f", 0, 360, 0, 0);
42 OrientationNP[ORIENTATION_QUATERNION_W].fill("QUATERNION_W", "Quaternion W", "%.4f", -1, 1, 0, 0);
43 OrientationNP.fill(m_defaultDevice->getDeviceName(), "ORIENTATION", "Orientation", groupName.c_str(), IP_RO, 0, IPS_IDLE);
44 }
45
46 if (HasAcceleration())
47 {
48 AccelerationNP[ACCELERATION_X].fill("ACCEL_X", "X Acceleration (m/s²)", "%.4f", -100, 100, 0, 0);
49 AccelerationNP[ACCELERATION_Y].fill("ACCEL_Y", "Y Acceleration (m/s²)", "%.4f", -100, 100, 0, 0);
50 AccelerationNP[ACCELERATION_Z].fill("ACCEL_Z", "Z Acceleration (m/s²)", "%.4f", -100, 100, 0, 0);
51 AccelerationNP.fill(m_defaultDevice->getDeviceName(), "ACCELERATION", "Acceleration", groupName.c_str(), IP_RO, 0,
52 IPS_IDLE);
53 }
54
55 if (HasGyroscope())
56 {
57 GyroscopeNP[GYROSCOPE_X].fill("GYRO_X", "X Angular Velocity (rad/s)", "%.4f", -10, 10, 0, 0);
58 GyroscopeNP[GYROSCOPE_Y].fill("GYRO_Y", "Y Angular Velocity (rad/s)", "%.4f", -10, 10, 0, 0);
59 GyroscopeNP[GYROSCOPE_Z].fill("GYRO_Z", "Z Angular Velocity (rad/s)", "%.4f", -10, 10, 0, 0);
60 GyroscopeNP.fill(m_defaultDevice->getDeviceName(), "GYROSCOPE", "Gyroscope", groupName.c_str(), IP_RO, 0, IPS_IDLE);
61 }
62
63 if (HasMagnetometer())
64 {
65 MagnetometerNP[MAGNETOMETER_X].fill("MAG_X", "X Magnetic Field (µT)", "%.4f", -1000, 1000, 0, 0);
66 MagnetometerNP[MAGNETOMETER_Y].fill("MAG_Y", "Y Magnetic Field (µT)", "%.4f", -1000, 1000, 0, 0);
67 MagnetometerNP[MAGNETOMETER_Z].fill("MAG_Z", "Z Magnetic Field (µT)", "%.4f", -1000, 1000, 0, 0);
68 MagnetometerNP.fill(m_defaultDevice->getDeviceName(), "MAGNETOMETER", "Magnetometer", groupName.c_str(), IP_RO, 0,
69 IPS_IDLE);
70 }
71
72 // Calibration Properties
73 if (HasCalibration())
74 {
77 CalibrationStatusLP[CALIBRATION_STATUS_ACCEL].fill("CAL_ACCEL", "Accelerometer", IPS_IDLE);
78 CalibrationStatusLP[CALIBRATION_STATUS_MAG].fill("CAL_MAG", "Magnetometer", IPS_IDLE);
79 CalibrationStatusLP.fill(m_defaultDevice->getDeviceName(), "CALIBRATION_STATUS", "Calibration Status",
80 CALIBRATION_TAB.c_str(), IPS_IDLE);
81
82 CalibrationControlSP[CALIBRATION_CONTROL_START].fill("CAL_START", "Start Calibration", ISS_OFF);
83 CalibrationControlSP[CALIBRATION_CONTROL_SAVE].fill("CAL_SAVE", "Save Calibration", ISS_OFF);
84 CalibrationControlSP[CALIBRATION_CONTROL_LOAD].fill("CAL_LOAD", "Load Calibration", ISS_OFF);
85 CalibrationControlSP[CALIBRATION_CONTROL_RESET].fill("CAL_RESET", "Reset Calibration", ISS_OFF);
86 CalibrationControlSP.fill(m_defaultDevice->getDeviceName(), "CALIBRATION_CONTROL", "Calibration Control",
88 }
89
90 // Configuration Properties
91 PowerModeSP[POWER_MODE_NORMAL].fill("NORMAL", "Normal", ISS_ON);
92 PowerModeSP[POWER_MODE_LOW_POWER].fill("LOW_POWER", "Low Power", ISS_OFF);
93 PowerModeSP[POWER_MODE_SUSPEND].fill("SUSPEND", "Suspend", ISS_OFF);
94 PowerModeSP.fill(m_defaultDevice->getDeviceName(), "POWER_MODE", "Power Mode", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 0,
95 IPS_IDLE);
96
98 OperationModeSP[OPERATION_MODE_COMPASS].fill("COMPASS", "Compass", ISS_OFF);
101 OperationModeSP.fill(m_defaultDevice->getDeviceName(), "OPERATION_MODE", "Operation Mode", OPTIONS_TAB, IP_RW,
103
104 DistanceUnitsSP[DISTANCE_UNITS_METRIC].fill("METRIC", "Metric", ISS_ON);
105 DistanceUnitsSP[DISTANCE_UNITS_IMPERIAL].fill("IMPERIAL", "Imperial", ISS_OFF);
106 DistanceUnitsSP.fill(m_defaultDevice->getDeviceName(), "DISTANCE_UNITS", "Distance Units", OPTIONS_TAB, IP_RW, ISR_1OFMANY,
107 0, IPS_IDLE);
108
109 AngularUnitsSP[ANGULAR_UNITS_DEGREES].fill("DEGREES", "Degrees", ISS_ON);
110 AngularUnitsSP[ANGULAR_UNITS_RADIANS].fill("RADIANS", "Radians", ISS_OFF);
111 AngularUnitsSP.fill(m_defaultDevice->getDeviceName(), "ANGULAR_UNITS", "Angular Units", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 0,
112 IPS_IDLE);
113
114 UpdateRateNP[UPDATE_RATE_RATE].fill("RATE", "Update Rate (Hz)", "%.2f", 1, 100, 1, 10);
115 UpdateRateNP.fill(m_defaultDevice->getDeviceName(), "UPDATE_RATE", "Update Rate", OPTIONS_TAB, IP_RW, 0, IPS_IDLE);
116
117 DataThresholdNP[0].fill("DATA_THRESHOLD", "Data Threshold", "%.4f", 0, 1, 0, 0.01);
118 DataThresholdNP.fill(m_defaultDevice->getDeviceName(), "DATA_THRESHOLD_PROPERTY", "Data Threshold", OPTIONS_TAB,
119 IP_RW, 0, IPS_IDLE);
120
121 // Status and Info Properties
122 DeviceInfoTP[DEVICE_INFO_CHIP_ID].fill("CHIP_ID", "Chip ID", "");
123 DeviceInfoTP[DEVICE_INFO_FIRMWARE_VERSION].fill("FIRMWARE_VERSION", "Firmware Version", "");
124 DeviceInfoTP[DEVICE_INFO_SENSOR_STATUS].fill("SENSOR_STATUS", "Sensor Status", "");
125 DeviceInfoTP.fill(m_defaultDevice->getDeviceName(), "DEVICE_INFO", "Device Info", STATUS_TAB.c_str(), IP_RO, 0, IPS_IDLE);
126
127 if (HasTemperature())
128 {
129 TemperatureNP[TEMPERATURE_VALUE].fill("TEMPERATURE", "Temperature (°C)", "%.2f", -40, 85, 0, 0);
130 TemperatureNP.fill(m_defaultDevice->getDeviceName(), "TEMPERATURE", "Temperature", STATUS_TAB.c_str(), IP_RO, 0, IPS_IDLE);
131 }
132
133 // Astronomical-Specific Properties
135 {
136 StabilityMonitoringNP[STABILITY_MONITORING_VIBRATION_LEVEL].fill("VIBRATION_LEVEL", "Vibration Level (RMS)", "%.4f", 0, 100,
137 0, 0);
138 StabilityMonitoringNP[STABILITY_MONITORING_STABILITY_THRESHOLD].fill("STABILITY_MONITORING_STABILITY_THRESHOLD",
139 "Stability Threshold (RMS)", "%.4f", 0, 100, 0, 5);
140 StabilityMonitoringNP.fill(m_defaultDevice->getDeviceName(), "STABILITY_MONITORING", "Stability Monitoring",
141 COORDINATES_TAB.c_str(), IP_RW, 0, IPS_IDLE);
142 }
143}
144
146{
147 if (m_defaultDevice->isConnected())
148 {
149 // Define properties when connected
150 if (HasOrientation())
151 m_defaultDevice->defineProperty(OrientationNP);
152 if (HasAcceleration())
153 m_defaultDevice->defineProperty(AccelerationNP);
154 if (HasGyroscope())
155 m_defaultDevice->defineProperty(GyroscopeNP);
156 if (HasMagnetometer())
157 m_defaultDevice->defineProperty(MagnetometerNP);
158 if (HasCalibration())
159 {
160 m_defaultDevice->defineProperty(CalibrationStatusLP);
161 m_defaultDevice->defineProperty(CalibrationControlSP);
162 }
163
164 m_defaultDevice->defineProperty(PowerModeSP);
165 m_defaultDevice->defineProperty(OperationModeSP);
166 m_defaultDevice->defineProperty(DistanceUnitsSP);
167 m_defaultDevice->defineProperty(AngularUnitsSP);
168 m_defaultDevice->defineProperty(UpdateRateNP);
169 m_defaultDevice->defineProperty(DataThresholdNP);
170 m_defaultDevice->defineProperty(DeviceInfoTP);
171
172 if (HasTemperature())
173 m_defaultDevice->defineProperty(TemperatureNP);
175 m_defaultDevice->defineProperty(StabilityMonitoringNP);
176 }
177 else
178 {
179 // Delete properties when disconnected
180 if (HasOrientation())
181 m_defaultDevice->deleteProperty(OrientationNP);
182 if (HasAcceleration())
183 m_defaultDevice->deleteProperty(AccelerationNP);
184 if (HasGyroscope())
185 m_defaultDevice->deleteProperty(GyroscopeNP);
186 if (HasMagnetometer())
187 m_defaultDevice->deleteProperty(MagnetometerNP);
188 if (HasCalibration())
189 {
190 m_defaultDevice->deleteProperty(CalibrationStatusLP);
191 m_defaultDevice->deleteProperty(CalibrationControlSP);
192 }
193
194 m_defaultDevice->deleteProperty(PowerModeSP);
195 m_defaultDevice->deleteProperty(OperationModeSP);
196 m_defaultDevice->deleteProperty(DistanceUnitsSP);
197 m_defaultDevice->deleteProperty(AngularUnitsSP);
198 m_defaultDevice->deleteProperty(UpdateRateNP);
199 m_defaultDevice->deleteProperty(DataThresholdNP);
200 m_defaultDevice->deleteProperty(DeviceInfoTP);
201
202 if (HasTemperature())
203 m_defaultDevice->deleteProperty(TemperatureNP);
205 m_defaultDevice->deleteProperty(StabilityMonitoringNP);
206 }
207
208 return true;
209}
210
211bool IMUInterface::processNumber(const std::string &dev, const std::string &name, double values[], char *names[], int n)
212{
213 if (dev != m_defaultDevice->getDeviceName())
214 return false;
215
217 {
218 DataThresholdNP.update(values, names, n);
221 m_defaultDevice->saveConfig(DataThresholdNP);
222 return true;
223 }
224
225 if (UpdateRateNP.isNameMatch(name))
226 {
227 UpdateRateNP.update(values, names, n);
231 return true;
232 }
233
235 {
236 StabilityMonitoringNP.update(values, names, n);
241 return true;
242 }
243
244 return false;
245}
246
247bool IMUInterface::processSwitch(const std::string &dev, const std::string &name, ISState *states, char *names[], int n)
248{
249 if (dev != m_defaultDevice->getDeviceName())
250 return false;
251
252 if (PowerModeSP.isNameMatch(name))
253 {
254 PowerModeSP.update(states, names, n);
257
258 int index = PowerModeSP.findOnSwitchIndex();
259 if (index >= 0)
260 SetPowerMode(PowerModeSP[index].getName());
261 return true;
262 }
263
265 {
266 OperationModeSP.update(states, names, n);
269
271 if (index >= 0)
272 SetOperationMode(OperationModeSP[index].getName());
273 return true;
274 }
275
277 {
278 DistanceUnitsSP.update(states, names, n);
281 m_defaultDevice->saveConfig(DistanceUnitsSP);
282
284 SetDistanceUnits(metric);
285 return true;
286 }
287
288 if (AngularUnitsSP.isNameMatch(name))
289 {
290 AngularUnitsSP.update(states, names, n);
293 m_defaultDevice->saveConfig(AngularUnitsSP);
294
296 SetAngularUnits(degrees);
297 return true;
298 }
299
301 {
302 CalibrationControlSP.update(states, names, n);
305
306 for (int i = 0; i < n; i++)
307 {
308 if (states[i] == ISS_ON)
309 {
310 std::string switchName = names[i];
311 bool result = false;
312
313 if (switchName == CalibrationControlSP[CALIBRATION_CONTROL_START].getName())
314 result = StartCalibration();
315 else if (switchName == CalibrationControlSP[CALIBRATION_CONTROL_SAVE].getName())
316 result = SaveCalibrationData();
317 else if (switchName == CalibrationControlSP[CALIBRATION_CONTROL_LOAD].getName())
318 result = LoadCalibrationData();
319 else if (switchName == CalibrationControlSP[CALIBRATION_CONTROL_RESET].getName())
320 result = ResetCalibration();
321
325 break;
326 }
327 }
328 return true;
329 }
330
331 return false;
332}
333
334bool IMUInterface::processText(const std::string &dev, const std::string &name, char *texts[], char *names[], int n)
335{
336 INDI_UNUSED(dev);
337 INDI_UNUSED(name);
338 INDI_UNUSED(texts);
339 INDI_UNUSED(names);
340 INDI_UNUSED(n);
341 return false;
342}
343
344bool IMUInterface::SetOrientationData(double roll, double pitch, double yaw, double w)
345{
346 if (!HasOrientation())
347 return false;
348
349 double threshold = DataThresholdNP[0].getValue();
350 if (std::abs(OrientationNP[ORIENTATION_ROLL].getValue() - roll) < threshold &&
351 std::abs(OrientationNP[ORIENTATION_PITCH].getValue() - pitch) < threshold &&
352 std::abs(OrientationNP[ORIENTATION_YAW].getValue() - yaw) < threshold &&
353 std::abs(OrientationNP[ORIENTATION_QUATERNION_W].getValue() - w) < threshold)
354 return false;
355
356 OrientationNP[ORIENTATION_ROLL].setValue(roll);
357 OrientationNP[ORIENTATION_PITCH].setValue(pitch);
358 OrientationNP[ORIENTATION_YAW].setValue(yaw);
362 return true;
363}
364
365bool IMUInterface::SetAccelerationData(double x, double y, double z)
366{
367 if (!HasAcceleration())
368 return false;
369
370 double threshold = DataThresholdNP[0].getValue();
371 if (std::abs(AccelerationNP[ACCELERATION_X].getValue() - x) < threshold &&
372 std::abs(AccelerationNP[ACCELERATION_Y].getValue() - y) < threshold &&
373 std::abs(AccelerationNP[ACCELERATION_Z].getValue() - z) < threshold)
374 return false;
375
376 AccelerationNP[ACCELERATION_X].setValue(x);
377 AccelerationNP[ACCELERATION_Y].setValue(y);
378 AccelerationNP[ACCELERATION_Z].setValue(z);
381 return true;
382}
383
384bool IMUInterface::SetGyroscopeData(double x, double y, double z)
385{
386 if (!HasGyroscope())
387 return false;
388
389 double threshold = DataThresholdNP[0].getValue();
390 if (std::abs(GyroscopeNP[GYROSCOPE_X].getValue() - x) < threshold &&
391 std::abs(GyroscopeNP[GYROSCOPE_Y].getValue() - y) < threshold &&
392 std::abs(GyroscopeNP[GYROSCOPE_Z].getValue() - z) < threshold)
393 return false;
394
395 GyroscopeNP[GYROSCOPE_X].setValue(x);
396 GyroscopeNP[GYROSCOPE_Y].setValue(y);
397 GyroscopeNP[GYROSCOPE_Z].setValue(z);
400 return true;
401}
402
403bool IMUInterface::SetMagnetometerData(double x, double y, double z)
404{
405 if (!HasMagnetometer())
406 return false;
407
408 double threshold = DataThresholdNP[0].getValue();
409 if (std::abs(MagnetometerNP[MAGNETOMETER_X].getValue() - x) < threshold &&
410 std::abs(MagnetometerNP[MAGNETOMETER_Y].getValue() - y) < threshold &&
411 std::abs(MagnetometerNP[MAGNETOMETER_Z].getValue() - z) < threshold)
412 return false;
413
414 MagnetometerNP[MAGNETOMETER_X].setValue(x);
415 MagnetometerNP[MAGNETOMETER_Y].setValue(y);
416 MagnetometerNP[MAGNETOMETER_Z].setValue(z);
419 return true;
420}
421
422bool IMUInterface::SetCalibrationStatus(int sys, int gyro, int accel, int mag)
423{
424 if (!HasCalibration())
425 return false;
426
427 // Convert calibration values (0-3) to light states
428 auto getCalibrationState = [](int value) -> IPState
429 {
430 switch (value)
431 {
432 case 0:
433 return IPS_ALERT; // Not calibrated
434 case 1:
435 return IPS_BUSY; // Partially calibrated
436 case 2:
437 return IPS_BUSY; // Mostly calibrated
438 case 3:
439 return IPS_OK; // Fully calibrated
440 default:
441 return IPS_IDLE;
442 }
443 };
444
445 CalibrationStatusLP[CALIBRATION_STATUS_SYS].setState(getCalibrationState(sys));
446 CalibrationStatusLP[CALIBRATION_STATUS_GYRO].setState(getCalibrationState(gyro));
447 CalibrationStatusLP[CALIBRATION_STATUS_ACCEL].setState(getCalibrationState(accel));
448 CalibrationStatusLP[CALIBRATION_STATUS_MAG].setState(getCalibrationState(mag));
450 return true;
451}
452
454{
455 // Default implementation - should be overridden by concrete drivers
456 return false;
457}
458
460{
461 // Default implementation - should be overridden by concrete drivers
462 return false;
463}
464
466{
467 // Default implementation - should be overridden by concrete drivers
468 return false;
469}
470
472{
473 // Default implementation - should be overridden by concrete drivers
474 return false;
475}
476
477bool IMUInterface::SetPowerMode(const std::string &mode)
478{
479 INDI_UNUSED(mode);
480 // Default implementation - should be overridden by concrete drivers
481 return false;
482}
483
484bool IMUInterface::SetOperationMode(const std::string &mode)
485{
486 INDI_UNUSED(mode);
487 // Default implementation - should be overridden by concrete drivers
488 return false;
489}
490
492{
493 INDI_UNUSED(metric);
494 // Default implementation - should be overridden by concrete drivers
495 return false;
496}
497
499{
500 INDI_UNUSED(degrees);
501 // Default implementation - should be overridden by concrete drivers
502 return false;
503}
504
506{
507 INDI_UNUSED(rate);
508 // Default implementation - should be overridden by concrete drivers
509 return false;
510}
511
512bool IMUInterface::SetDeviceInfo(const std::string &chipID, const std::string &firmwareVersion,
513 const std::string &sensorStatus)
514{
515 DeviceInfoTP[DEVICE_INFO_CHIP_ID].setText(chipID.c_str());
516 DeviceInfoTP[DEVICE_INFO_FIRMWARE_VERSION].setText(firmwareVersion.c_str());
517 DeviceInfoTP[DEVICE_INFO_SENSOR_STATUS].setText(sensorStatus.c_str());
520 return true;
521}
522
524{
525 if (!HasTemperature())
526 return false;
527
531 return true;
532}
533
534bool IMUInterface::SetStabilityMonitoring(double vibrationLevel, double stabilityThreshold)
535{
537 return false;
538
543 return true;
544}
545
547{
548 PowerModeSP.save(fp);
552 UpdateRateNP.save(fp);
554
557
558 return true;
559}
560
561}
double temperature
bool isConnected() const
const char * getDeviceName() const
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
virtual bool ResetCalibration()
ResetCalibration Reset calibration data.
bool processSwitch(const std::string &dev, const std::string &name, ISState *states, char *names[], int n)
Process IMU switch properties.
virtual bool SetOrientationData(double roll, double pitch, double yaw, double w=0.0)
SetOrientationData Set the orientation data (Roll, Pitch, Yaw, Quaternion W)
virtual bool SetStabilityMonitoring(double vibrationLevel, double stabilityThreshold)
SetStabilityMonitoring Set vibration level and alert threshold.
virtual bool SaveCalibrationData()
SaveCalibrationData Save the current calibration data.
INDI::PropertyNumber TemperatureNP
bool saveConfigItems(FILE *fp)
saveConfigItems Save IMU properties in config file
virtual bool SetGyroscopeData(double x, double y, double z)
SetGyroscopeData Set the angular velocity data.
bool processText(const std::string &dev, const std::string &name, char *texts[], char *names[], int n)
Process IMU text properties.
INDI::PropertyNumber OrientationNP
INDI::PropertySwitch AngularUnitsSP
virtual bool SetAccelerationData(double x, double y, double z)
SetAccelerationData Set the linear acceleration data.
IMUInterface(DefaultDevice *defaultDevice)
INDI::PropertyNumber StabilityMonitoringNP
virtual bool LoadCalibrationData()
LoadCalibrationData Load previously saved calibration data.
virtual bool SetAngularUnits(bool degrees)
SetAngularUnits Set the angular units for sensor data.
INDI::PropertyNumber UpdateRateNP
virtual bool SetTemperature(double temperature)
SetTemperature Set the internal chip temperature.
virtual bool SetMagnetometerData(double x, double y, double z)
SetMagnetometerData Set the magnetic field strength data.
INDI::PropertyText DeviceInfoTP
INDI::PropertyNumber AccelerationNP
INDI::PropertySwitch CalibrationControlSP
INDI::PropertyLight CalibrationStatusLP
virtual bool StartCalibration()
StartCalibration Initiate the calibration sequence.
virtual bool SetDeviceInfo(const std::string &chipID, const std::string &firmwareVersion, const std::string &sensorStatus)
SetDeviceInfo Set chip ID, firmware version, and sensor status.
INDI::PropertyNumber GyroscopeNP
const std::string COORDINATES_TAB
virtual bool SetCalibrationStatus(int sys, int gyro, int accel, int mag)
SetCalibrationStatus Set the calibration status for each sensor.
virtual bool SetDistanceUnits(bool metric)
SetUnits Set the units for sensor data.
bool updateProperties()
updateProperties Define or Delete IMU properties based on the connection status of the base device
bool processNumber(const std::string &dev, const std::string &name, double values[], char *names[], int n)
Process IMU number properties.
virtual bool SetPowerMode(const std::string &mode)
SetPowerMode Set the power mode of the IMU sensor.
virtual bool SetUpdateRate(double rate)
SetUpdateRate Set the sensor polling frequency.
const std::string STATUS_TAB
INDI::PropertyNumber DataThresholdNP
INDI::PropertyNumber MagnetometerNP
INDI::PropertySwitch OperationModeSP
INDI::PropertySwitch DistanceUnitsSP
INDI::PropertySwitch PowerModeSP
const std::string CALIBRATION_TAB
void initProperties(const std::string &groupName)
Initialize IMU properties. It is recommended to call this function within initProperties() of your pr...
virtual bool SetOperationMode(const std::string &mode)
SetOperationMode Set the operation mode of the IMU sensor.
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
void save(FILE *f) const
save Save property to configuration file.
bool isNameMatch(const char *otherName) const
void fill(const char *device, const char *name, const char *label, const char *group, IPState state)
bool update(const double values[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
bool update(const ISState states[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
const char * OPTIONS_TAB
OPTIONS_TAB Where all the driver's options are located. Those may include auxiliary controls,...
ISState
Switch state.
Definition indiapi.h:148
@ ISS_OFF
Definition indiapi.h:149
@ ISS_ON
Definition indiapi.h:150
@ IP_RW
Definition indiapi.h:184
@ IP_RO
Definition indiapi.h:182
IPState
Property state.
Definition indiapi.h:158
@ IPS_BUSY
Definition indiapi.h:161
@ IPS_ALERT
Definition indiapi.h:162
@ IPS_IDLE
Definition indiapi.h:159
@ IPS_OK
Definition indiapi.h:160
@ ISR_1OFMANY
Definition indiapi.h:171
@ ISR_ATMOST1
Definition indiapi.h:172
#define INDI_UNUSED(x)
Definition indidevapi.h:132
Namespace to encapsulate INDI client, drivers, and mediator classes.