fixed wrong app type used when client is acknowledging an alarm

(slightly revised to use primitive type of request if writing to other than
gddAppType_value)
This commit is contained in:
Jeff Hill
2006-10-04 18:49:29 +00:00
parent e98b305246
commit 394222ac72

View File

@@ -2043,13 +2043,24 @@ caStatus casStrmClient::writeScalarData ()
if ( pHdr->m_dataType >= NELEMENTS(gddDbrToAit) ) {
return S_cas_badType;
}
// a primitive type matching the atomic DBR_XXX type
aitEnum type = gddDbrToAit[pHdr->m_dataType].type;
if ( type == aitEnumInvalid ) {
return S_cas_badType;
}
aitEnum bestExternalType = this->ctx.getPV()->bestExternalType ();
// the application type best maching this DBR_XXX type
aitUint16 app = gddDbrToAit[pHdr->m_dataType].app;
gdd * pDD = new gddScalar ( app, bestExternalType );
// When possible, preconvert to best external type in order
// to reduce problems in the services
aitEnum bestWritePrimType =
app == gddAppType_value ?
this->ctx.getPV()->bestExternalType () :
type;
gdd * pDD = new gddScalar ( app, bestWritePrimType );
if ( ! pDD ) {
return S_cas_noMemory;
}