diff --git a/motorApp/MotorSrc/asynMotorController.cpp b/motorApp/MotorSrc/asynMotorController.cpp index e5d069d5..ced4ee4f 100644 --- a/motorApp/MotorSrc/asynMotorController.cpp +++ b/motorApp/MotorSrc/asynMotorController.cpp @@ -764,6 +764,30 @@ asynStatus asynMotorController::writeController(const char *output, double timeo return status ; } +/** Reads a string from the controller. + * Calls deadController() with default locations of the input string and default timeout. */ +asynStatus asynMotorController::readController() +{ + size_t nread; + return readController(inString_, sizeof(inString_), &nread, DEFAULT_CONTROLLER_TIMEOUT); +} + +/** Reads a string from the controller + * \param[out] input Pointer to the input string location. + * \param[in] maxChars Size of the input buffer. + * \param[out] nread Number of characters read. + * \param[out] timeout Timeout before returning an error.*/ +asynStatus asynMotorController::readController(char *input, size_t maxChars, size_t *nread, double timeout) +{ + asynStatus status; + int eomReason; + // const char *functionName="readController"; + + status = pasynOctetSyncIO->read(pasynUserController_, input, maxChars, timeout, nread, &eomReason); + + return status; +} + /** Writes a string to the controller and reads the response. * Calls writeReadController() with default locations of the input and output strings * and default timeout. */ diff --git a/motorApp/MotorSrc/asynMotorController.h b/motorApp/MotorSrc/asynMotorController.h index bbcfa8e9..5de1ee79 100644 --- a/motorApp/MotorSrc/asynMotorController.h +++ b/motorApp/MotorSrc/asynMotorController.h @@ -302,6 +302,8 @@ class epicsShareClass asynMotorController : public asynPortDriver { /* These are convenience functions for controllers that use asynOctet interfaces to the hardware */ asynStatus writeController(); asynStatus writeController(const char *output, double timeout); + asynStatus readController(); + asynStatus readController(char *response, size_t maxResponseLen, size_t *responseLen, double timeout); asynStatus writeReadController(); asynStatus writeReadController(const char *output, char *response, size_t maxResponseLen, size_t *responseLen, double timeout); asynUser *pasynUserController_;