The info you provide is confusing.
If your record is a longin, its value is an integer (not a string, not an error message, ...).
In your protocol, the out line is what the computer writes on the bus to fetch the status of the device.
Base on what I understand, you probably should use a binary out (bo record) for each of your batteries.
You can pass the battery number in the OUT line as a parameter to the protocol
record(bo, $(prefix):$(number):BatteryOn")
{
field(DTYP, ...
field(out, "mydev.proto getStatus($prefix,$number)) dev)
}
record(stringin, $(prefix):$(number)Message")
{
}
with protocol
getStatus {
out "Battery On \$2";
in "OK";
@mismatch {
out "Battery On \$2";
in "%(\$1:\$2Message.VAL)s"; # Write on another PV
}
}
The mismatch should not be required if you know all the allowed values for $number.
If that's the case, you just dbLoadRecords with the allowed $number parameters
I hope this helps.
--
Emmanuel Mayssat
http://www.epicsqt.org
From:
[email protected]To:
[email protected]Subject: Stream device protocol files question?
Date: Wed, 17 Sep 2014 16:22:11 +0000
Hello,
I am trying to understand how to setup a particular command in a protocol file.
The command looks like this:
Battery On “number”
And the command returns either: “OK” or ”Error: err msg”.
I think my protocol file might look like this:
Battery
{
Out “Battery On %d”;
}
And my db file would look like this:
Record (longin, “batteryOn”)
{
Field(DTYP, “stream”)
Field(INP, “myDev.proto Battery dev”)
}
How do I get the status that the command returns?
I want to do something like
Battery
{
Out “Battery On %d”;
In “%s”;
}
But I am already using an input for the battery number. So how do I do both?
Thanks In advance.
Steve Goff