re-init record when 2 is written to .PROC
This commit is contained in:
@ -556,14 +556,17 @@ There is a fixed set of exception handler names starting with
|
||||
<dt><code>@init</code></dt>
|
||||
<dd>
|
||||
Not really an exception but formally specified in the same syntax.
|
||||
This handler is called from <code>iocInit</code> during record
|
||||
initialization <span class="new">and again whenever <em>StreamDevice</em>
|
||||
detects that the device has reconnected after a disconnect or when the
|
||||
ioc is resumed with <code>iocRun</code> after beeing paused or
|
||||
when the protocol has been <a href="setup.html#reload">reloaded</a></span>.
|
||||
It can be used to initialize an output record with a value read from
|
||||
This handler can be used to initialize an output record with a value read from
|
||||
the device.
|
||||
Also see chapter <a href="processing.html#init">Record Processing</a>.
|
||||
|
||||
It is called at startup by <code>iocInit</code> during record
|
||||
initialization <span class="new">and again whenever <em>StreamDevice</em>
|
||||
detects that the device has reconnected after a disconnect or when the
|
||||
IOC is resumed with <code>iocRun</code> after beeing paused or
|
||||
when the protocol has been <a href="setup.html#reload">reloaded</a></span>
|
||||
or when the "magic value" <code>2</code> is written to the <code>.PROC</code>
|
||||
field.
|
||||
</dd>
|
||||
</dl>
|
||||
<h3>Example:</h3>
|
||||
|
@ -421,6 +421,7 @@ startProtocol(StartMode startMode)
|
||||
switch (startMode)
|
||||
{
|
||||
case StartInit:
|
||||
if (!onInit) return false;
|
||||
flags |= InitRun;
|
||||
commandIndex = onInit();
|
||||
break;
|
||||
@ -432,13 +433,10 @@ startProtocol(StartMode startMode)
|
||||
}
|
||||
flags |= AsyncMode;
|
||||
case StartNormal:
|
||||
if (!commands) return false;
|
||||
commandIndex = commands();
|
||||
break;
|
||||
}
|
||||
if (!commandIndex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
StreamBuffer buffer;
|
||||
runningHandler = Success;
|
||||
protocolStartHook();
|
||||
|
@ -869,11 +869,11 @@ process()
|
||||
debug("Stream::process(%s) start\n", name());
|
||||
status = NO_ALARM;
|
||||
convert = OK;
|
||||
if (!startProtocol(StreamCore::StartNormal))
|
||||
if (!startProtocol(record->proc==2 ? StreamCore::StartInit : StreamCore::StartNormal))
|
||||
{
|
||||
debug("Stream::process(%s): could not start, status=%d\n",
|
||||
name(), status);
|
||||
(void) recGblSetSevr(record, status, INVALID_ALARM);
|
||||
debug("Stream::process(%s): could not start %sprotocol, status=%d\n",
|
||||
name(), record->proc==2 ? "@init " : "", status);
|
||||
(void) recGblSetSevr(record, status ? status : UDF_ALARM, INVALID_ALARM);
|
||||
return false;
|
||||
}
|
||||
debug("Stream::process(%s): protocol started\n", name());
|
||||
@ -1010,7 +1010,7 @@ protocolFinishHook(ProtocolResult result)
|
||||
break;
|
||||
|
||||
}
|
||||
if ((flags & (InitRun|Aborted)) == InitRun)
|
||||
if ((flags & (InitRun|Aborted)) == InitRun && record->proc != 2)
|
||||
{
|
||||
debug("Stream::protocolFinishHook %s: signalling init done\n", name());
|
||||
#ifdef EPICS_3_13
|
||||
@ -1033,7 +1033,6 @@ protocolFinishHook(ProtocolResult result)
|
||||
callbackSetPriority(priority(), &processCallback);
|
||||
callbackRequest(&processCallback);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Stream::
|
||||
|
Reference in New Issue
Block a user