Renamed "ipPortUser_" to "ipPortAsynOctetSyncIO_"

I learned that there might be multiple asynUsers connected to the same
port for different types (asynInt32, asynOctet, ...). Therefore I
renamed "ipPortUser_" to better reflect this.
This commit is contained in:
2025-04-15 17:15:34 +02:00
parent eb94379efe
commit 4c3254687d
3 changed files with 18 additions and 16 deletions

View File

@ -662,8 +662,7 @@ extern "C" {
*/ */
asynStatus setWatchdogEnabled(const char *portName, int axisNo, int enable) { asynStatus setWatchdogEnabled(const char *portName, int axisNo, int enable) {
sinqController *pC; sinqController *pC = (sinqController *)findAsynPortDriver(portName);
pC = (sinqController *)findAsynPortDriver(portName);
if (pC == nullptr) { if (pC == nullptr) {
errlogPrintf("Controller \"%s\" => %s, line %d:\nPort %s not found.", errlogPrintf("Controller \"%s\" => %s, line %d:\nPort %s not found.",
portName, __PRETTY_FUNCTION__, __LINE__, portName); portName, __PRETTY_FUNCTION__, __LINE__, portName);

View File

@ -51,7 +51,9 @@ sinqController::sinqController(const char *portName,
msgPrintControl_(4) { msgPrintControl_(4) {
asynStatus status = asynSuccess; asynStatus status = asynSuccess;
ipPortUser_ = nullptr;
// Handle to the asynUser of the IP port asyn driver
ipPortAsynOctetSyncIO_ = nullptr;
// Initial values for the average timeout mechanism, can be overwritten // Initial values for the average timeout mechanism, can be overwritten
// later by a FFI function // later by a FFI function
@ -79,8 +81,9 @@ sinqController::sinqController(const char *portName,
We try to connect to the port via the port name provided by the constructor. We try to connect to the port via the port name provided by the constructor.
If this fails, the function is terminated via exit. If this fails, the function is terminated via exit.
*/ */
pasynOctetSyncIO->connect(ipPortConfigName, 0, &ipPortUser_, NULL); pasynOctetSyncIO->connect(ipPortConfigName, 0, &ipPortAsynOctetSyncIO_,
if (status != asynSuccess || ipPortUser_ == nullptr) { NULL);
if (status != asynSuccess || ipPortAsynOctetSyncIO_ == nullptr) {
errlogPrintf("Controller \"%s\" => %s, line %d:\nFATAL ERROR (cannot " errlogPrintf("Controller \"%s\" => %s, line %d:\nFATAL ERROR (cannot "
"connect to MCU controller).\n" "connect to MCU controller).\n"
"Terminating IOC", "Terminating IOC",
@ -353,7 +356,7 @@ asynStatus sinqController::couldNotParseResponse(const char *command,
int line) { int line) {
asynStatus pl_status = asynSuccess; asynStatus pl_status = asynSuccess;
asynPrint(ipPortUser_, ASYN_TRACE_ERROR, asynPrint(ipPortAsynOctetSyncIO_, ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d:\nCould not interpret " "Controller \"%s\", axis %d => %s, line %d:\nCould not interpret "
"response \"%s\" for command \"%s\".\n", "response \"%s\" for command \"%s\".\n",
portName, axisNo, functionName, line, response, command); portName, axisNo, functionName, line, response, command);
@ -382,7 +385,7 @@ asynStatus sinqController::paramLibAccessFailed(asynStatus status,
int line) { int line) {
if (status != asynSuccess) { if (status != asynSuccess) {
asynPrint(ipPortUser_, ASYN_TRACE_ERROR, asynPrint(ipPortAsynOctetSyncIO_, ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d:\n Accessing the " "Controller \"%s\", axis %d => %s, line %d:\n Accessing the "
"parameter library failed for parameter %s with error %s.\n", "parameter library failed for parameter %s with error %s.\n",
portName, axisNo, functionName, line, parameter, portName, axisNo, functionName, line, parameter,
@ -651,9 +654,9 @@ asynStatus setMaxSubsequentTimeouts(const char *portName,
if (ptr == nullptr) { if (ptr == nullptr) {
/* /*
We can't use asynPrint here since this macro would require us We can't use asynPrint here since this macro would require us
to get a ipPortUser_ from a pointer to an asynPortDriver. to get a ipPortAsynOctetSyncIO_ from a pointer to an asynPortDriver.
However, the given pointer is a nullptr and therefore doesn't However, the given pointer is a nullptr and therefore doesn't
have a ipPortUser_! printf is an EPICS alternative which have a ipPortAsynOctetSyncIO_! printf is an EPICS alternative which
works w/o that, but doesn't offer the comfort provided works w/o that, but doesn't offer the comfort provided
by the asynTrace-facility by the asynTrace-facility
*/ */

View File

@ -41,8 +41,8 @@ class epicsShareClass sinqController : public asynMotorController {
* @param extraParams Number of extra parameter library entries * @param extraParams Number of extra parameter library entries
* created in a concrete driver implementation * created in a concrete driver implementation
*/ */
sinqController(const char *portName, const char *SINQPortName, int numAxes, sinqController(const char *portName, const char *ipPortConfigName,
double movingPollPeriod, double idlePollPeriod, int numAxes, double movingPollPeriod, double idlePollPeriod,
int numExtraParams); int numExtraParams);
/** /**
@ -115,9 +115,9 @@ class epicsShareClass sinqController : public asynMotorController {
called. It is recommended to use a macro, e.g. __LINE__. called. It is recommended to use a macro, e.g. __LINE__.
* @return asynStatus Returns asynError. * @return asynStatus Returns asynError.
*/ */
asynStatus couldNotParseResponse(const char *command, asynStatus couldNotParseResponse(const char *command, const char *response,
const char *response, int axisNo, int axisNo, const char *functionName,
const char *functionName, int line); int line);
/** /**
* @brief Convert an asynStatus into a descriptive string. * @brief Convert an asynStatus into a descriptive string.
@ -298,14 +298,14 @@ class epicsShareClass sinqController : public asynMotorController {
double idlePollPeriod() { return idlePollPeriod_; } double idlePollPeriod() { return idlePollPeriod_; }
double movingPollPeriod() { return movingPollPeriod_; } double movingPollPeriod() { return movingPollPeriod_; }
asynUser *asynUserSelf() { return pasynUserSelf; } asynUser *asynUserSelf() { return pasynUserSelf; }
asynUser *ipPortUser() { return ipPortUser_; } asynUser *ipPortAsynOctetSyncIO() { return ipPortAsynOctetSyncIO_; }
// ========================================================================= // =========================================================================
protected: protected:
// Pointer to the port user which is specified by the char array // Pointer to the port user which is specified by the char array
// `ipPortConfigName` in the constructor // `ipPortConfigName` in the constructor
asynUser *ipPortUser_; asynUser *ipPortAsynOctetSyncIO_;
double movingPollPeriod_; double movingPollPeriod_;
double idlePollPeriod_; double idlePollPeriod_;
msgPrintControl msgPrintControl_; msgPrintControl msgPrintControl_;