Applied PIMPL by moving members to internal struct sinqAxisImpl
This change makes sinqMotor ready for 1.x releases where ABI stability and backwards compatibility is guaranteed.
This commit is contained in:
@@ -11,9 +11,8 @@ Stefan Mathis, November 2024
|
||||
#define sinqController_H
|
||||
#include "asynMotorController.h"
|
||||
#include "msgPrintControl.h"
|
||||
#include <deque>
|
||||
#include <initHooks.h>
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
|
||||
#define motorMessageIsFromDriverString "MOTOR_MESSAGE_DRIVER"
|
||||
#define motorMessageTextString "MOTOR_MESSAGE_TEXT"
|
||||
@@ -21,6 +20,8 @@ Stefan Mathis, November 2024
|
||||
#define AbsoluteEncoder "absolute"
|
||||
#define NoEncoder "none"
|
||||
|
||||
struct sinqControllerImpl;
|
||||
|
||||
class epicsShareClass sinqController : public asynMotorController {
|
||||
public:
|
||||
/**
|
||||
@@ -175,11 +176,7 @@ class epicsShareClass sinqController : public asynMotorController {
|
||||
* @return asynStatus
|
||||
*/
|
||||
virtual asynStatus setThresholdComTimeout(time_t comTimeoutWindow,
|
||||
size_t maxNumberTimeouts) {
|
||||
comTimeoutWindow_ = comTimeoutWindow;
|
||||
maxNumberTimeouts_ = maxNumberTimeouts;
|
||||
return asynSuccess;
|
||||
}
|
||||
size_t maxNumberTimeouts);
|
||||
|
||||
/**
|
||||
* @brief Inform the user, if the number of timeouts exceeds the threshold
|
||||
@@ -211,17 +208,14 @@ class epicsShareClass sinqController : public asynMotorController {
|
||||
* @param maxSubsequentTimeouts
|
||||
* @return asynStatus
|
||||
*/
|
||||
asynStatus setMaxSubsequentTimeouts(int maxSubsequentTimeouts) {
|
||||
maxSubsequentTimeouts_ = maxSubsequentTimeouts;
|
||||
return asynSuccess;
|
||||
}
|
||||
asynStatus setMaxSubsequentTimeouts(int maxSubsequentTimeouts);
|
||||
|
||||
/**
|
||||
* @brief Get a reference to the map used to control the maximum number of
|
||||
* message repetitions. See the documentation of `printRepetitionWatchdog`
|
||||
* in msgPrintControl.h for details.
|
||||
*/
|
||||
msgPrintControl &getMsgPrintControl() { return msgPrintControl_; }
|
||||
msgPrintControl &getMsgPrintControl();
|
||||
|
||||
/**
|
||||
* @brief Get the axis object
|
||||
@@ -293,25 +287,26 @@ class epicsShareClass sinqController : public asynMotorController {
|
||||
int motorRecDirection() { return motorRecDirection_; }
|
||||
int motorRecOffset() { return motorRecOffset_; }
|
||||
|
||||
// Accessors for additional PVs defined in sinqController
|
||||
int motorMessageText() { return motorMessageText_; }
|
||||
int motorReset() { return motorReset_; }
|
||||
int motorEnable() { return motorEnable_; }
|
||||
int motorEnableRBV() { return motorEnableRBV_; }
|
||||
int motorCanDisable() { return motorCanDisable_; }
|
||||
int motorEnableMovWatchdog() { return motorEnableMovWatchdog_; }
|
||||
int motorCanSetSpeed() { return motorCanSetSpeed_; }
|
||||
int motorLimitsOffset() { return motorLimitsOffset_; }
|
||||
int motorForceStop() { return motorForceStop_; }
|
||||
int motorConnected() { return motorConnected_; }
|
||||
int motorVeloFromDriver() { return motorVeloFromDriver_; }
|
||||
int motorVbasFromDriver() { return motorVbasFromDriver_; }
|
||||
int motorVmaxFromDriver() { return motorVmaxFromDriver_; }
|
||||
int motorAcclFromDriver() { return motorAcclFromDriver_; }
|
||||
int motorHighLimitFromDriver() { return motorHighLimitFromDriver_; }
|
||||
int motorLowLimitFromDriver() { return motorLowLimitFromDriver_; }
|
||||
int adaptivePolling() { return adaptivePolling_; }
|
||||
int encoderType() { return encoderType_; }
|
||||
// Accessors for additional PVs defined in sinqController (which are hidden
|
||||
// in pSinqC_)
|
||||
int motorMessageText();
|
||||
int motorReset();
|
||||
int motorEnable();
|
||||
int motorEnableRBV();
|
||||
int motorCanDisable();
|
||||
int motorEnableMovWatchdog();
|
||||
int motorCanSetSpeed();
|
||||
int motorLimitsOffset();
|
||||
int motorForceStop();
|
||||
int motorConnected();
|
||||
int motorVeloFromDriver();
|
||||
int motorVbasFromDriver();
|
||||
int motorVmaxFromDriver();
|
||||
int motorAcclFromDriver();
|
||||
int motorHighLimitFromDriver();
|
||||
int motorLowLimitFromDriver();
|
||||
int adaptivePolling();
|
||||
int encoderType();
|
||||
|
||||
// Additional members
|
||||
int numAxes() { return numAxes_; }
|
||||
@@ -330,7 +325,7 @@ class epicsShareClass sinqController : public asynMotorController {
|
||||
*
|
||||
* @return asynUser*
|
||||
*/
|
||||
asynUser *pasynOctetSyncIOipPort() { return pasynOctetSyncIOipPort_; }
|
||||
asynUser *pasynOctetSyncIOipPort();
|
||||
|
||||
/**
|
||||
* @brief Overloaded version of `asynController::poll` which decreases
|
||||
@@ -374,7 +369,7 @@ class epicsShareClass sinqController : public asynMotorController {
|
||||
* specified
|
||||
*
|
||||
*/
|
||||
int outstandingForcedFastPolls() { return outstandingForcedFastPolls_; }
|
||||
int outstandingForcedFastPolls();
|
||||
|
||||
// Maximum error message buffer size. This is an empirical value which must
|
||||
// be large enough to avoid overflows for all commands to the device /
|
||||
@@ -383,67 +378,9 @@ class epicsShareClass sinqController : public asynMotorController {
|
||||
|
||||
// =========================================================================
|
||||
|
||||
protected:
|
||||
// Number of fast polls which still need to be performed before adaptive
|
||||
// polling is active again.
|
||||
int outstandingForcedFastPolls_;
|
||||
|
||||
// Number of polls forced by wakeupPoller which are still
|
||||
|
||||
// Pointer to the port user which is specified by the char array
|
||||
// `ipPortConfigName` in the constructor
|
||||
asynUser *pasynOctetSyncIOipPort_;
|
||||
double movingPollPeriod_;
|
||||
double idlePollPeriod_;
|
||||
msgPrintControl msgPrintControl_;
|
||||
|
||||
// Internal variables used in the communication timeout frequency watchdog
|
||||
time_t comTimeoutWindow_; // Size of the time window
|
||||
size_t maxNumberTimeouts_; // Maximum acceptable number of events within the
|
||||
// time window
|
||||
std::deque<time_t>
|
||||
timeoutEvents_; // Deque holding the timestamps of the individual events
|
||||
|
||||
// Communicate a timeout to the user after it has happened this many times
|
||||
// in a row
|
||||
int maxSubsequentTimeouts_;
|
||||
bool maxSubsequentTimeoutsExceeded_;
|
||||
|
||||
/*
|
||||
See the documentation in db/sinqMotor.db for the following integers
|
||||
*/
|
||||
#define FIRST_SINQMOTOR_PARAM motorMessageText_
|
||||
int motorMessageText_;
|
||||
int motorReset_;
|
||||
int motorEnable_;
|
||||
int motorEnableRBV_;
|
||||
int motorCanDisable_;
|
||||
int motorEnableMovWatchdog_;
|
||||
int motorCanSetSpeed_;
|
||||
int motorLimitsOffset_;
|
||||
int motorForceStop_;
|
||||
int motorConnected_;
|
||||
/*
|
||||
These parameters are here to write values from the hardware to the EPICS
|
||||
motor record. Using motorHighLimit_ / motorLowLimit_ does not work:
|
||||
https://epics.anl.gov/tech-talk/2023/msg00576.php. Therefore, some
|
||||
additional records are introduced which read from these parameters and write
|
||||
into the motor record.
|
||||
*/
|
||||
int motorVeloFromDriver_;
|
||||
int motorVbasFromDriver_;
|
||||
int motorVmaxFromDriver_;
|
||||
int motorAcclFromDriver_;
|
||||
int motorHighLimitFromDriver_;
|
||||
int motorLowLimitFromDriver_;
|
||||
int adaptivePolling_;
|
||||
int encoderType_;
|
||||
#define LAST_SINQMOTOR_PARAM encoderType_
|
||||
|
||||
private:
|
||||
std::unique_ptr<sinqControllerImpl> pSinqC_;
|
||||
static void epicsInithookFunction(initHookState iState);
|
||||
};
|
||||
#define NUM_SINQMOTOR_DRIVER_PARAMS \
|
||||
(&LAST_SINQMOTOR_PARAM - &FIRST_SINQMOTOR_PARAM + 1)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user