Added public accessors for all status library indices and some other

properties. This also enabled the removal of "friend classes".
This commit is contained in:
2025-03-10 16:53:45 +01:00
parent bed245b010
commit f26d1bb612
4 changed files with 161 additions and 79 deletions

View File

@@ -51,7 +51,7 @@ sinqController::sinqController(const char *portName,
msgPrintControl_(4) {
asynStatus status = asynSuccess;
lowLevelPortUser_ = nullptr;
ipPortUser_ = nullptr;
// Initial values for the average timeout mechanism, can be overwritten
// later by a FFI function
@@ -74,8 +74,8 @@ sinqController::sinqController(const char *portName,
We try to connect to the port via the port name provided by the constructor.
If this fails, the function is terminated via exit.
*/
pasynOctetSyncIO->connect(ipPortConfigName, 0, &lowLevelPortUser_, NULL);
if (status != asynSuccess || lowLevelPortUser_ == nullptr) {
pasynOctetSyncIO->connect(ipPortConfigName, 0, &ipPortUser_, NULL);
if (status != asynSuccess || ipPortUser_ == nullptr) {
errlogPrintf("Controller \"%s\" => %s, line %d:\nFATAL ERROR (cannot "
"connect to MCU controller).\n"
"Terminating IOC",
@@ -296,7 +296,7 @@ asynStatus sinqController::writeInt32(asynUser *pasynUser, epicsInt32 value) {
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d:\nAxis is not an "
"instance of sinqAxis",
portName, axis->axisNo_, __PRETTY_FUNCTION__, __LINE__);
portName, axis->axisNo(), __PRETTY_FUNCTION__, __LINE__);
return asynError;
}
@@ -314,7 +314,7 @@ asynStatus sinqController::writeInt32(asynUser *pasynUser, epicsInt32 value) {
asynStatus sinqController::readInt32(asynUser *pasynUser, epicsInt32 *value) {
// Casting into a sinqAxis is necessary to get access to the field axisNo_
// Casting into a sinqAxis is necessary to get access to the field axisNo()
asynMotorAxis *asynAxis = getAxis(pasynUser);
sinqAxis *axis = dynamic_cast<sinqAxis *>(asynAxis);
@@ -322,14 +322,14 @@ asynStatus sinqController::readInt32(asynUser *pasynUser, epicsInt32 *value) {
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d:\nAxis is not an "
"instance of sinqAxis.\n",
portName, axis->axisNo_, __PRETTY_FUNCTION__, __LINE__);
portName, axis->axisNo(), __PRETTY_FUNCTION__, __LINE__);
return asynError;
}
if (pasynUser->reason == motorEnableRBV_) {
return getIntegerParam(axis->axisNo_, motorEnableRBV_, value);
return getIntegerParam(axis->axisNo(), motorEnableRBV_, value);
} else if (pasynUser->reason == motorCanDisable_) {
return getIntegerParam(axis->axisNo_, motorCanDisable_, value);
return getIntegerParam(axis->axisNo(), motorCanDisable_, value);
} else {
return asynMotorController::readInt32(pasynUser, value);
}
@@ -342,7 +342,7 @@ asynStatus sinqController::errMsgCouldNotParseResponse(const char *command,
int line) {
asynStatus pl_status = asynSuccess;
asynPrint(lowLevelPortUser_, ASYN_TRACE_ERROR,
asynPrint(ipPortUser_, ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d:\nCould not interpret "
"response \"%s\" for command \"%s\".\n",
portName, axisNo, functionName, line, response, command);
@@ -371,7 +371,7 @@ asynStatus sinqController::paramLibAccessFailed(asynStatus status,
int line) {
if (status != asynSuccess) {
asynPrint(lowLevelPortUser_, ASYN_TRACE_ERROR,
asynPrint(ipPortUser_, ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d:\n Accessing the "
"parameter library failed for parameter %s with error %s.\n",
portName, axisNo, functionName, line, parameter,
@@ -446,12 +446,12 @@ asynStatus sinqController::checkComTimeoutWatchdog(sinqAxis *axis) {
char motorMessage[200] = {0};
asynStatus status =
checkComTimeoutWatchdog(axis->axisNo_, motorMessage, 200);
checkComTimeoutWatchdog(axis->axisNo(), motorMessage, 200);
if (status == asynError) {
status = axis->setStringParam(motorMessageText_, motorMessage);
if (status != asynSuccess) {
return paramLibAccessFailed(status, "motorMessageText_",
axis->axisNo_, __PRETTY_FUNCTION__,
axis->axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
}
@@ -498,13 +498,13 @@ asynStatus sinqController::checkMaxSubsequentTimeouts(int timeoutNo,
char motorMessage[200] = {0};
asynStatus status =
checkMaxSubsequentTimeouts(axis->axisNo_, timeoutNo, motorMessage, 200);
asynStatus status = checkMaxSubsequentTimeouts(axis->axisNo(), timeoutNo,
motorMessage, 200);
if (status == asynError) {
status = axis->setStringParam(motorMessageText_, motorMessage);
if (status != asynSuccess) {
return paramLibAccessFailed(status, "motorMessageText_",
axis->axisNo_, __PRETTY_FUNCTION__,
axis->axisNo(), __PRETTY_FUNCTION__,
__LINE__);
}
}
@@ -640,9 +640,9 @@ asynStatus setMaxSubsequentTimeouts(const char *portName,
if (ptr == nullptr) {
/*
We can't use asynPrint here since this macro would require us
to get a lowLevelPortUser_ from a pointer to an asynPortDriver.
to get a ipPortUser_ from a pointer to an asynPortDriver.
However, the given pointer is a nullptr and therefore doesn't
have a lowLevelPortUser_! printf is an EPICS alternative which
have a ipPortUser_! printf is an EPICS alternative which
works w/o that, but doesn't offer the comfort provided
by the asynTrace-facility
*/