open methods refined

This commit is contained in:
2017-11-22 14:15:37 +01:00
parent 6dfd64a9a3
commit 0aeb952d62
6 changed files with 2087 additions and 28 deletions
+1 -5
View File
@@ -245,8 +245,6 @@ pvStruct.epicsTS; %[secPastEpoch, nsec]
%END (2) Simple single channel operations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%(3) Understanding the Status Error Code / MATLAB Exceptions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -545,8 +543,6 @@ pvData(3).val
%END (8) Multiple Struct operations on several PVS returning PVData Objects plus Multiple Sets for Scalars/Vectors
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%(9) Asynchronous interactions and retrieving data from Cache
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -762,7 +758,7 @@ mocha('monitorFlushEvent', pv(1)); %will execute the MATLAB script monitorAction
mocha('monitorFlushEvent'); %will execute all 'actions' for all 'handles' that have received new data
%The above command is used in conjunction with MATLAB timer (as for MCA's mcamontimer.m)
obj.t = timer('TimerFcn', 'mocha(''monitorFlushEvent'')', 'Period', 2.0, 'ExecutionMode', 'fixedSpacing');
obj.t = timer('TimerFcn', 'mocha(''monitorFlushEvent'')', 'Period', 1.0, 'ExecutionMode', 'fixedSpacing');
%Else if double quotes cannot be used in the above; here's a way around the problem:
%obj.t = timer('TimerFcn', 'mocha(402)', 'Period', 2.0, 'ExecutionMode', 'fixedSpacing');
start(obj.t);
+2 -1
View File
@@ -215,6 +215,8 @@ void msInsert() {
ms.insert(mochaccino(OPEN_NOWAIT, "openprepare"));
ms.insert(mochaccino(OPEN_NOW, "opennow"));
ms.insert(mochaccino(OPEN_NOW_AND_WAIT, "opennowandwait"));
ms.insert(mochaccino(OPEN_WAIT_WITH_TIME, "setopentimeout"));
ms.insert(mochaccino(OPEN_WAIT_TIME_TO_DEFAULT, "setopentimeouttodefault"));
ms.insert(mochaccino(OPEN_WAIT_WITH_TIME, "setopenwaittime"));
ms.insert(mochaccino(OPEN_WAIT_TIME_TO_DEFAULT, "setopenwaittimetodefault"));
@@ -1012,7 +1014,6 @@ vector<unsigned int> openArray(vector<string> vstr) {
}
unsigned int open(char _pv[PVNAME_MAX_SIZE]) {
uint32_T _handle=0;
+2052
View File
File diff suppressed because it is too large Load Diff
+13 -7
View File
@@ -375,10 +375,10 @@ void macchinettaFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
case OPEN_WAIT_WITH_TIME:
if (nrhs<2) {
mochaIndex=OPEN_WAIT_TIME_TO_DEFAULT;
cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_AFTER_EACH_CHANNEL_CREATION);
cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
//cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_AFTER_EACH_CHANNEL_CREATION);
//cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
}
break;
break;
default:
break;
@@ -453,7 +453,7 @@ void macchinettaFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
break;
case MOCHA_VERSION:
plhs[0]=mxCreateString((char *) "mocha-1.4.0-final-1 : November 2017");
plhs[0]=mxCreateString((char *) "mocha-1.5.0-final-1 : November 2017");
break;
case SHOW:
@@ -752,6 +752,7 @@ void macchinettaFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
case OPEN_WAIT:
cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_AFTER_EACH_CHANNEL_CREATION);
cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
break;
@@ -770,16 +771,20 @@ void macchinettaFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
return;
}
if (nrhs>1) {
if (!mxIsNumeric(prhs[1]) ) {
mexPrintf("Timeout does not have a numeric value \n");
return;
}
cafe.channelOpenPolicy.setTimeout(mxGetScalar(prhs[1]));
cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_AFTER_EACH_CHANNEL_CREATION);
cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
//cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_AFTER_EACH_CHANNEL_CREATION);
//cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
}
break;
@@ -916,7 +921,8 @@ void macchinettaFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
}
}
mexPrintf("openArray - when %d\n", cafe.channelOpenPolicy.getWhenToFlushSendBuffer());
mexPrintf("openArray - with %d\n", cafe.channelOpenPolicy.getFlushSendBufferKind());
vector<uint32_T> vuint32=NS_MOCHA::openArray(vstr);
+17 -13
View File
@@ -453,7 +453,7 @@ void macchinettaFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
break;
case MOCHA_VERSION:
plhs[0]=mxCreateString((char *) "mocha-1.3.0-final-1 : September 2017");
plhs[0]=mxCreateString((char *) "mocha-1.4.0-final-1 : November 2017");
break;
case SHOW:
@@ -743,8 +743,9 @@ void macchinettaFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
}
case OPEN_NOWAIT:
cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_DESIGNATED_TO_CLIENT);
cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
//cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_DESIGNATED_TO_CLIENT);
//cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
cafe.openPrepare();
break;
@@ -755,13 +756,14 @@ void macchinettaFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
case OPEN_NOW:
cafe.channelOpenPolicy.flushSendBufferNow();
cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_AFTER_EACH_CHANNEL_CREATION);
cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
//cafe.channelOpenPolicy.flushSendBufferNow();
//cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_AFTER_EACH_CHANNEL_CREATION);
//cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
cafe.openNow();
break;
//change open method to with pend_event - for single opens that wish to pend
case OPEN_WAIT_WITH_TIME:
if (nrhs<2) {
mexPrintf("Invalid Number of argument %d. Input: message, timeout \n", nrhs);
@@ -776,6 +778,7 @@ void macchinettaFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
cafe.channelOpenPolicy.setTimeout(mxGetScalar(prhs[1]));
cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_AFTER_EACH_CHANNEL_CREATION);
cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
}
break;
@@ -809,17 +812,18 @@ void macchinettaFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
}
//Get Timeput
double tPrevious=cafe.channelOpenPolicy.getTimeout();
cafe.channelOpenPolicy.setTimeout(mxGetScalar(prhs[1]));
cafe.channelOpenPolicy.flushSendBufferNow();
//double tPrevious=cafe.channelOpenPolicy.getTimeout();
//cafe.channelOpenPolicy.setTimeout(mxGetScalar(prhs[1]));
//cafe.channelOpenPolicy.flushSendBufferNow();
//reset
cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
//cafe.channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
//cafe.channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
//Set to previous
//cafe.channelOpenPolicy.setTimeoutToDefault();
cafe.channelOpenPolicy.setTimeout(tPrevious);
//cafe.channelOpenPolicy.setTimeout(tPrevious);
cafe.openNowAndWait(mxGetScalar(prhs[1]));
}
break;
+2 -2
View File
@@ -16,9 +16,9 @@ MATLAB_VERSION=$(notdir $(MATLAB_ROOT))
##### CHANGE AS APPROPRIATE #################
#Mocha Version to install
MOCHA_VERSION=mocha-1.5.0-final-1
MOCHA_VERSION=mocha-1.5.0-final-2
#CAFE version to link to
CAFE_VERSION=cafe-1.5.0-final-1
CAFE_VERSION=cafe-1.5.0-final-2
#CAFE_VERSION_M=cafe-1.3.0-final-2m
#PYTHON_INCLUDE=/usr/include/python2.6