Skip to content

Send command, receive respose using EPICS string records #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dls-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pmacApp/src/pmacController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ void pmacController::createAsynParams(void) {
createParam(PMAC_C_AxisCSString, asynParamInt32, &PMAC_C_AxisCS_);
createParam(PMAC_C_AxisReadonlyString, asynParamInt32, &PMAC_C_AxisReadonly_);
createParam(PMAC_C_WriteCmdString, asynParamOctet, &PMAC_C_WriteCmd_);
createParam(PMAC_C_WriteReadCmdString, asynParamOctet, &PMAC_C_WriteReadCmd_);
createParam(PMAC_C_WriteReadRBVString, asynParamOctet, &PMAC_C_WriteReadRbv_);
createParam(PMAC_C_KillAxisString, asynParamInt32, &PMAC_C_KillAxis_);
createParam(PMAC_C_PLCBits00String, asynParamInt32, &PMAC_C_PLCBits00_);
createParam(PMAC_C_PLCBits01String, asynParamInt32, &PMAC_C_PLCBits01_);
Expand Down Expand Up @@ -2442,6 +2444,18 @@ pmacController::writeOctet(asynUser *pasynUser, const char *value, size_t nChars
status = this->immediateWriteRead(command, response);
}

// Added by AJF
if (function == PMAC_C_WriteReadCmd_) {
// Write the arbitrary string to the PMAC, set the response in the parameter library
strcpy(command, value);
status = this->immediateWriteRead(command, response);
// Strip off the \r
response[strlen(response)-1] = '\0';
// Set the response in the parameter library
status = (asynStatus) setStringParam(addr, PMAC_C_WriteReadRbv_, response);
if (status != asynSuccess) return (status);
}

// Do callbacks so higher layers see any changes
callParamCallbacks(addr, addr);

Expand Down
4 changes: 4 additions & 0 deletions pmacApp/src/pmacController.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
#define PMAC_C_AxisCSString "PMAC_C_AXIS_CS"
#define PMAC_C_AxisReadonlyString "PMAC_C_AXIS_READONLY"
#define PMAC_C_WriteCmdString "PMAC_C_WRITE_CMD"
#define PMAC_C_WriteReadCmdString "PMAC_C_WRITE_READ_CMD"
#define PMAC_C_WriteReadRBVString "PMAC_C_WRITE_READ_RBV"
#define PMAC_C_KillAxisString "PMAC_C_KILL_AXIS"
#define PMAC_C_PLCBits00String "PMAC_C_PLC_BITS00"
#define PMAC_C_PLCBits01String "PMAC_C_PLC_BITS01"
Expand Down Expand Up @@ -395,6 +397,8 @@ class pmacController
int PMAC_C_AxisCS_;
int PMAC_C_AxisReadonly_;
int PMAC_C_WriteCmd_;
int PMAC_C_WriteReadCmd_;
int PMAC_C_WriteReadRbv_;
int PMAC_C_KillAxis_;
int PMAC_C_PLCBits00_;
int PMAC_C_PLCBits01_;
Expand Down