Experimental Physics and Industrial Control System
Ben,
The built in GDD application types are specified in the build system
generated file gddApps.h.
However, you will probably be best off binding them mnemonically like
this example from base/src/cas/example/simple/exPV.cc.
//
// exPV::initFT()
//
void exPV::initFT()
{
if (exPV::hasBeenInitialized) {
return;
}
exPV::ft.installReadFunc ("status", &exPV::getStatus);
exPV::ft.installReadFunc ("severity", &exPV::getSeverity);
exPV::ft.installReadFunc ("seconds", &exPV::getSeconds);
exPV::ft.installReadFunc ("nanoseconds", &exPV::getNanoseconds);
exPV::ft.installReadFunc ("precision", &exPV::getPrecision);
exPV::ft.installReadFunc ("graphicHigh", &exPV::getHighLimit);
exPV::ft.installReadFunc ("graphicLow", &exPV::getLowLimit);
exPV::ft.installReadFunc ("controlHigh", &exPV::getHighLimit);
exPV::ft.installReadFunc ("controlLow", &exPV::getLowLimit);
exPV::ft.installReadFunc ("alarmHigh", &exPV::getHighLimit);
exPV::ft.installReadFunc ("alarmLow", &exPV::getLowLimit);
exPV::ft.installReadFunc ("alarmHighWarning",
&exPV::getHighLimit);
exPV::ft.installReadFunc ("alarmLowWarning",
&exPV::getLowLimit);
exPV::ft.installReadFunc ("units", &exPV::getUnits);
exPV::ft.installReadFunc ("value", &exPV::getValue);
exPV::ft.installReadFunc ("enums", &exPV::getEnums);
exPV::hasBeenInitialized = 1;
}
To allow the clients to fetch a table of enumerated strings for a PV
with a "best external primitive type" of enumerated, then you will need
to install a function similar to this one that follows.
**** Note however that the support for this has been greatly improved in
EPICS R3.14. In R3.14 the enumerated string table is properly cached by
the server library and enumerated to string conversions requested by the
client are performed implicitly. This provides results that are much
closer to what is provided by a traditional EPICS IOC.
//
// exPV::getEnums()
//
// returns the enumerated state strings
// for a discrete channel
//
//
caStatus exPV::getEnums (gdd &enums)
{
unsigned nStr = 2;
aitFixedString *str;
enums.setDimension(1);
str = new aitFixedString[nStr];
if (!str) {
return S_casApp_noMemory;
}
enums.putRef (str,new gddDestructor);
strncpy (str[0].fixed_string, "off",
sizeof(str[0].fixed_string));
strncpy (str[1].fixed_string, "on",
sizeof(str[1].fixed_string));
enums.setBound (0,0,nStr);
return S_cas_success;
}
Hope this helps.
Jeff
>
> E.g. it seems that my server is not able to answer all differnt
> application
> types ca_test queries:
>
> ca_test-output is:
> bsailer@brian $ ca_test HAD:EB2:EB2PP:ERROR
> name: HAD:EB2:EB2PP:ERROR
> native type: 4
> native count: 1
> DBR_STRING
> DBR_SHORT 0
> DBR_FLOAT 0.0000
> DBR_ENUM 0
> DBR_CHAR 0
> DBR_LONG 0
> DBR_DOUBLE 0.0000
> DBR_STS_STRING 0 0 Value:
> DBR_STS_SHORT 0 0 Value: 0
> DBR_STS_FLOAT 0 0 Value: 0.0000
> DBR_STS_ENUM 0 0 Value: 0
> DBR_STS_CHAR 0 0 Value: 0
> DBR_STS_LONG 0 0 Value: 0
> DBR_STS_DOUBLE 0 0 Value: 0.0000
> DBR_TIME_STRING 0 0 TimeStamp: 01/29/22 04:00:00.000 Value:
> DBR_TIME_SHORT 0 0 TimeStamp: 01/29/22 04:00:00.000 Value:
0
> DBR_TIME_FLOAT 0 0 TimeStamp: 01/29/22 04:00:00.000 Value:
> 0.0000
> DBR_TIME_ENUM 0 0 TimeStamp: 01/29/22 04:00:00.000 Value:
0
> DBR_TIME_CHAR 0 0 TimeStamp: 01/29/22 04:00:00.000 Value:
0
> DBR_TIME_LONG 0 0 TimeStamp: 01/29/22 04:00:00.000 Value:
0
> DBR_TIME_DOUBLE 0 0 TimeStamp: 01/29/22 04:00:00.000 Value:
> 0.0000
> DBR_GR_STRING 0 0 Value:
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
> DBR_CTRL_STRING 0 0 Value:
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
> ../ca_test.c: err resp to get cb was "Could not perform a database
value
> get for that channel"
>
>
> bsailer@brian $
>
> while my server states:
>
> unregisted appl type - ukn appl type code = 14
>
> Operation not permitted <= get callback failure detail not passed to
> client
> unregisted appl type - ukn appl type code = 14
>
> Operation not permitted <= get callback failure detail not passed to
> client
> unregisted appl type - ukn appl type code = 17
>
> Operation not permitted <= get callback failure detail not passed to
> client
> unregisted appl type - ukn appl type code = 14
>
> Operation not permitted <= get callback failure detail not passed to
> client
> unregisted appl type - ukn appl type code = 14
>
> Operation not permitted <= get callback failure detail not passed to
> client
> unregisted appl type - ukn appl type code = 14
>
> Operation not permitted <= get callback failure detail not passed to
> client
> unregisted appl type - ukn appl type code = 14
>
> Operation not permitted <= get callback failure detail not passed to
> client
> unregisted appl type - ukn appl type code = 14
>
> Operation not permitted <= get callback failure detail not passed to
> client
> unregisted appl type - ukn appl type code = 17
>
> Operation not permitted <= get callback failure detail not passed to
> client
> unregisted appl type - ukn appl type code = 14
>
> Operation not permitted <= get callback failure detail not passed to
> client
> unregisted appl type - ukn appl type code = 14
>
> Operation not permitted <= get callback failure detail not passed to
> client
> unregisted appl type - ukn appl type code = 14
>
> Operation not permitted <= get callback failure detail not passed to
> client
>
> I did not find the application type corresponding to thiese two codes,
> and to speak honestly I am not eger to implement all of these types -
> I'd
> rather safe some space in the memory (this server should also work
> on a LynxOS VME PPC and the main part of 32MB on these should be
> reserved
> for DAQ-processes).
>
> I tried to implement a read function for "enums" and "menuitem", but I
> didn't
> get the concept of these record types and how to merge this with the
> gdd::putConvert() function (my code looks like
>
> gddAppFuncTableStatus ControlRecord::readMenuitem(gdd &value) {
> if((myValue >= 0) && (myValue < numMenuitems)) {
> value.putConvert(menuitem[myValue]);
> return S_casApp_success;
> } else {
> return S_casApp_noSupport;
> }
> return S_casApp_success;
> }
>
> but the only thing I know about this is that it cannot work :-().
>
> Can anybody give me some hints what I did wrong or what the philosophy
> is
> behind the caServer?
>
> Thanks a lot
>
> Benjamin
>
> --
> *****************************************************************
> Benjamin Sailer
> eMail: [email protected]
> *****************************************************************
> You'll see it's all a show, keep on laughing as You go
> just remember that the last laugh is on You
- References:
- Re: caTCL with R3.14 and Linux Benjamin Sailer
- Navigate by Date:
- Prev:
RE: "Unexpected UDP failure WIN32 Socket Library Error 10054" Jeff Hill
- Next:
RE: CA client library and Connection handler Jeff Hill
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
<2002>
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: caTCL with R3.14 and Linux Benjamin Sailer
- Next:
[no subject] Lynn Foth
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
<2002>
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024