From 4c3254687dbf93fc2cac063be84d7843dfe6174f Mon Sep 17 00:00:00 2001 From: smathis Date: Tue, 15 Apr 2025 17:15:34 +0200 Subject: [PATCH] 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. --- src/sinqAxis.cpp | 3 +-- src/sinqController.cpp | 17 ++++++++++------- src/sinqController.h | 14 +++++++------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/sinqAxis.cpp b/src/sinqAxis.cpp index 733a83f..42c83e6 100644 --- a/src/sinqAxis.cpp +++ b/src/sinqAxis.cpp @@ -662,8 +662,7 @@ extern "C" { */ asynStatus setWatchdogEnabled(const char *portName, int axisNo, int enable) { - sinqController *pC; - pC = (sinqController *)findAsynPortDriver(portName); + sinqController *pC = (sinqController *)findAsynPortDriver(portName); if (pC == nullptr) { errlogPrintf("Controller \"%s\" => %s, line %d:\nPort %s not found.", portName, __PRETTY_FUNCTION__, __LINE__, portName); diff --git a/src/sinqController.cpp b/src/sinqController.cpp index b1d3ceb..f69784c 100644 --- a/src/sinqController.cpp +++ b/src/sinqController.cpp @@ -51,7 +51,9 @@ sinqController::sinqController(const char *portName, msgPrintControl_(4) { 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 // 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. If this fails, the function is terminated via exit. */ - pasynOctetSyncIO->connect(ipPortConfigName, 0, &ipPortUser_, NULL); - if (status != asynSuccess || ipPortUser_ == nullptr) { + pasynOctetSyncIO->connect(ipPortConfigName, 0, &ipPortAsynOctetSyncIO_, + NULL); + if (status != asynSuccess || ipPortAsynOctetSyncIO_ == nullptr) { errlogPrintf("Controller \"%s\" => %s, line %d:\nFATAL ERROR (cannot " "connect to MCU controller).\n" "Terminating IOC", @@ -353,7 +356,7 @@ asynStatus sinqController::couldNotParseResponse(const char *command, int line) { asynStatus pl_status = asynSuccess; - asynPrint(ipPortUser_, ASYN_TRACE_ERROR, + asynPrint(ipPortAsynOctetSyncIO_, 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); @@ -382,7 +385,7 @@ asynStatus sinqController::paramLibAccessFailed(asynStatus status, int line) { if (status != asynSuccess) { - asynPrint(ipPortUser_, ASYN_TRACE_ERROR, + asynPrint(ipPortAsynOctetSyncIO_, 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, @@ -651,9 +654,9 @@ asynStatus setMaxSubsequentTimeouts(const char *portName, if (ptr == nullptr) { /* 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 - 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 by the asynTrace-facility */ diff --git a/src/sinqController.h b/src/sinqController.h index 043a50c..9c94608 100644 --- a/src/sinqController.h +++ b/src/sinqController.h @@ -41,8 +41,8 @@ class epicsShareClass sinqController : public asynMotorController { * @param extraParams Number of extra parameter library entries * created in a concrete driver implementation */ - sinqController(const char *portName, const char *SINQPortName, int numAxes, - double movingPollPeriod, double idlePollPeriod, + sinqController(const char *portName, const char *ipPortConfigName, + int numAxes, double movingPollPeriod, double idlePollPeriod, int numExtraParams); /** @@ -115,9 +115,9 @@ class epicsShareClass sinqController : public asynMotorController { called. It is recommended to use a macro, e.g. __LINE__. * @return asynStatus Returns asynError. */ - asynStatus couldNotParseResponse(const char *command, - const char *response, int axisNo, - const char *functionName, int line); + asynStatus couldNotParseResponse(const char *command, const char *response, + int axisNo, const char *functionName, + int line); /** * @brief Convert an asynStatus into a descriptive string. @@ -298,14 +298,14 @@ class epicsShareClass sinqController : public asynMotorController { double idlePollPeriod() { return idlePollPeriod_; } double movingPollPeriod() { return movingPollPeriod_; } asynUser *asynUserSelf() { return pasynUserSelf; } - asynUser *ipPortUser() { return ipPortUser_; } + asynUser *ipPortAsynOctetSyncIO() { return ipPortAsynOctetSyncIO_; } // ========================================================================= protected: // Pointer to the port user which is specified by the char array // `ipPortConfigName` in the constructor - asynUser *ipPortUser_; + asynUser *ipPortAsynOctetSyncIO_; double movingPollPeriod_; double idlePollPeriod_; msgPrintControl msgPrintControl_;