DBR status <-> NT status mapping
This commit is contained in:
@@ -921,3 +921,5 @@ testApp/pvAccessAllTests.c
|
||||
testApp/rtemsConfig.c
|
||||
testApp/rtemsNetworking.h
|
||||
testApp/rtemsTestHarness.c
|
||||
src/ca/caStatus.cpp
|
||||
src/ca/caStatus.h
|
||||
|
||||
@@ -4,6 +4,8 @@ SRC_DIRS += $(PVACCESS_SRC)/ca
|
||||
|
||||
INC += caProvider.h
|
||||
INC += caChannel.h
|
||||
INC += caStatus.h
|
||||
|
||||
LIBSRCS += caProvider.cpp
|
||||
LIBSRCS += caChannel.cpp
|
||||
LIBSRCS += caStatus.cpp
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <pv/standardField.h>
|
||||
|
||||
#include <pv/caChannel.h>
|
||||
#include <pv/caStatus.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
@@ -637,31 +638,6 @@ void copy_DBR<dbr_enum_t, pvString, PVString, PVStringArray>(const void * dbr, u
|
||||
}
|
||||
}
|
||||
|
||||
static string dbrStatus2alarmMessage[] = {
|
||||
"NO_ALARM", // 0 ..
|
||||
"READ_ALARM",
|
||||
"WRITE_ALARM",
|
||||
"HIHI_ALARM",
|
||||
"HIGH_ALARM",
|
||||
"LOLO_ALARM",
|
||||
"LOW_ALARM",
|
||||
"STATE_ALARM",
|
||||
"COS_ALARM",
|
||||
"COMM_ALARM",
|
||||
"TIMEOUT_ALARM",
|
||||
"HW_LIMIT_ALARM",
|
||||
"CALC_ALARM",
|
||||
"SCAN_ALARM",
|
||||
"LINK_ALARM",
|
||||
"SOFT_ALARM",
|
||||
"BAD_SUB_ALARM",
|
||||
"UDF_ALARM",
|
||||
"DISABLE_ALARM",
|
||||
"SIMM_ALARM",
|
||||
"READ_ACCESS_ALARM",
|
||||
"WRITE_ACCESS_ALARM" // .. 21
|
||||
};
|
||||
|
||||
// template<DBR type, primitive type, ScalarType, scalar Field, array Field>
|
||||
template<typename T, typename pT, epics::pvData::ScalarType sT, typename sF, typename aF>
|
||||
void copy_DBR_STS(const void * dbr, unsigned count, PVStructure::shared_pointer const & pvStructure)
|
||||
@@ -669,8 +645,7 @@ void copy_DBR_STS(const void * dbr, unsigned count, PVStructure::shared_pointer
|
||||
const T* data = static_cast<const T*>(dbr);
|
||||
|
||||
PVStructure::shared_pointer alarm = pvStructure->getStructureField("alarm");
|
||||
// no mapping needed
|
||||
alarm->getIntField("status")->put(0);
|
||||
alarm->getIntField("status")->put(dbrStatus2alarmStatus[data->status]);
|
||||
alarm->getIntField("severity")->put(data->severity);
|
||||
alarm->getStringField("message")->put(dbrStatus2alarmMessage[data->status]);
|
||||
|
||||
|
||||
68
src/ca/caStatus.cpp
Normal file
68
src/ca/caStatus.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* Copyright - See the COPYRIGHT that is included with this distribution.
|
||||
* pvAccessCPP is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
|
||||
#include <pv/caStatus.h>
|
||||
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
namespace ca {
|
||||
|
||||
std::string dbrStatus2alarmMessage[] = {
|
||||
"NO_ALARM", // 0 ..
|
||||
"READ_ALARM",
|
||||
"WRITE_ALARM",
|
||||
"HIHI_ALARM",
|
||||
"HIGH_ALARM",
|
||||
"LOLO_ALARM",
|
||||
"LOW_ALARM",
|
||||
"STATE_ALARM",
|
||||
"COS_ALARM",
|
||||
"COMM_ALARM",
|
||||
"TIMEOUT_ALARM",
|
||||
"HW_LIMIT_ALARM",
|
||||
"CALC_ALARM",
|
||||
"SCAN_ALARM",
|
||||
"LINK_ALARM",
|
||||
"SOFT_ALARM",
|
||||
"BAD_SUB_ALARM",
|
||||
"UDF_ALARM",
|
||||
"DISABLE_ALARM",
|
||||
"SIMM_ALARM",
|
||||
"READ_ACCESS_ALARM",
|
||||
"WRITE_ACCESS_ALARM" // .. 21
|
||||
};
|
||||
|
||||
int dbrStatus2alarmStatus[] = {
|
||||
noStatus, //"NO_ALARM"
|
||||
driverStatus, //"READ_ALARM",
|
||||
driverStatus, //"WRITE_ALARM",
|
||||
recordStatus, //"HIHI_ALARM",
|
||||
recordStatus, //"HIGH_ALARM",
|
||||
recordStatus, //"LOLO_ALARM",
|
||||
recordStatus, //"LOW_ALARM",
|
||||
recordStatus, //"STATE_ALARM",
|
||||
recordStatus, //"COS_ALARM",
|
||||
driverStatus, //"COMM_ALARM",
|
||||
driverStatus, //"TIMEOUT_ALARM",
|
||||
deviceStatus, //"HW_LIMIT_ALARM",
|
||||
recordStatus, //"CALC_ALARM",
|
||||
dbStatus, //"SCAN_ALARM",
|
||||
dbStatus, //"LINK_ALARM",
|
||||
dbStatus, //"SOFT_ALARM",
|
||||
confStatus, //"BAD_SUB_ALARM",
|
||||
recordStatus, //"UDF_ALARM",
|
||||
recordStatus, //"DISABLE_ALARM",
|
||||
recordStatus, //"SIMM_ALARM",
|
||||
clientStatus, //"READ_ACCESS_ALARM",
|
||||
clientStatus //"WRITE_ACCESS_ALARM" // .. 21
|
||||
};
|
||||
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
30
src/ca/caStatus.h
Normal file
30
src/ca/caStatus.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright - See the COPYRIGHT that is included with this distribution.
|
||||
* pvAccessCPP is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef CASTATUS_H
|
||||
#define CASTATUS_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <cadef.h>
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
namespace ca {
|
||||
|
||||
enum AlarmStatus {
|
||||
noStatus,deviceStatus,driverStatus,recordStatus,
|
||||
dbStatus,confStatus,undefinedStatus,clientStatus
|
||||
};
|
||||
|
||||
epicsShareExtern std::string dbrStatus2alarmMessage[];
|
||||
epicsShareExtern int dbrStatus2alarmStatus[];
|
||||
|
||||
}}}
|
||||
|
||||
#endif /* CASTATUS_H */
|
||||
Reference in New Issue
Block a user