From b75bdb19309f94bf87f0d00186afa36dade92a53 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 4 Oct 2006 20:46:11 +0000 Subject: [PATCH] fixed wrong app type used when client is acknowledging an alarm (slightly revised to also deal with arrays although they are technically invalid when acking an alarm) --- src/cas/generic/casStrmClient.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/cas/generic/casStrmClient.cc b/src/cas/generic/casStrmClient.cc index 4dc33a872..9045a4e99 100644 --- a/src/cas/generic/casStrmClient.cc +++ b/src/cas/generic/casStrmClient.cc @@ -2124,7 +2124,17 @@ caStatus casStrmClient::writeArrayData() aitEnum bestExternalType = this->ctx.getPV()->bestExternalType (); - gdd * pDD = new gddAtomic(gddAppType_value, bestExternalType, 1, pHdr->m_count); + // the application type best maching this DBR_XXX type + aitUint16 app = gddDbrToAit[pHdr->m_dataType].app; + + // 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 gddAtomic( app, bestWritePrimType, 1, pHdr->m_count); if ( ! pDD ) { return S_cas_noMemory; } @@ -2158,7 +2168,7 @@ caStatus casStrmClient::writeArrayData() // will be allowed to ref the DD // caStatus status = S_cas_noConvert; - gddStatus gddStat = aitConvert ( bestExternalType, + gddStatus gddStat = aitConvert ( bestWritePrimType, pData, type, this->ctx.getData(), pHdr->m_count, &this->ctx.getPV()->enumStringTable() ); if ( gddStat >= 0 ) {