Commit 78b734f0 authored by Jonas Nylund's avatar Jonas Nylund

Minor changes to sev

parent 7701b57a
......@@ -711,7 +711,7 @@ int sev_server::send_histdata( qcom_sQid tgt, sev_sMsgHistDataGetRequest *rmsg,
{
pwr_tTime *tbuf;
void *vbuf;
unsigned int rows;
unsigned int rows = 0;
sev_sMsgHistDataGet *msg;
int msize;
qcom_sPut put;
......@@ -731,7 +731,7 @@ int sev_server::send_histdata( qcom_sQid tgt, sev_sMsgHistDataGetRequest *rmsg,
item.scantime, &item.creatime,
&starttime, &endtime, rmsg->NumPoints, &tbuf, &vbuf, &rows);
}
if ( ODD(m_sts))
if ( ODD(m_sts) && rows != 0)
msize = rows * ( sizeof(pwr_tTime) + item.attr[0].size) + sizeof(*msg) - sizeof(msg->Data);
else
msize = sizeof(*msg);
......@@ -771,7 +771,7 @@ int sev_server::send_objecthistdata( qcom_sQid tgt, sev_sMsgHistDataGetRequest *
{
pwr_tTime *tbuf;
void *vbuf;
unsigned int rows;
unsigned int rows = 0;
sev_sMsgHistObjectDataGet *msg;
int msize;
qcom_sPut put;
......@@ -788,7 +788,7 @@ int sev_server::send_objecthistdata( qcom_sQid tgt, sev_sMsgHistDataGetRequest *
if(ODD(m_sts)) {
m_db->get_objectvalues(&m_sts, &item, item.value_size, &starttime, &endtime, rmsg->NumPoints, &tbuf, &vbuf, &rows);
}
if ( ODD(m_sts)) {
if ( ODD(m_sts) && rows != 0 ) {
msize = rows * ( sizeof(pwr_tTime) + item.value_size);
msize += item.attr.size() * sizeof(msg->Attr);
msize += sizeof(*msg) - sizeof(msg->Data) - sizeof(msg->Attr);
......@@ -812,7 +812,7 @@ int sev_server::send_objecthistdata( qcom_sQid tgt, sev_sMsgHistDataGetRequest *
msg->Status = m_sts;
msg->NumPoints = 0;
msg->NumAttributes = 0;
if ( ODD(m_sts)) {
if ( ODD(m_sts) && rows != 0 ) {
msg->NumPoints = rows;
msg->NumAttributes = item.attr.size();
msg->TotalDataSize = rows * ( sizeof(pwr_tTime) + item.value_size);
......
......@@ -634,7 +634,6 @@ ItemLocal::ItemLocal( TblNav *tblnav, TblNav_sevhistobject *xitem,
strcat( aname, ".");
strcat( aname, item.objectattrlist[0].aname);
}
printf("aname %s\n", aname);
brow_SetAnnotation( node, 0, aname, strlen(aname));
brow_SetAnnotation( node, 1, item.description, strlen(item.description));
}
......
......@@ -157,13 +157,11 @@ int sevcli_get_itemlist( pwr_tStatus *sts, sevcli_tCtx ctx, sevcli_sHistItem **l
int attr_cnt = rmsg->NumAttributes;
unsigned int data_size = (item_cnt * sizeof(sevcli_sHistItem)) + ((attr_cnt - item_cnt) * sizeof(sevcli_sHistAttr));
printf("Get size: %d, data size: %d\n", get.size, data_size);
lp = (sevcli_sHistItem *) malloc( data_size );
sevcli_sHistItem *lp2 = lp;
sev_sHistItem *itemPtr = ((sev_sMsgHistItems *)rmsg)->Items;
for ( i = 0; i < item_cnt; i++) {
printf("i : %d\n", i);
lp->oid = itemPtr->oid;
strncpy( lp->oname, itemPtr->oname, sizeof(lp->oname));
lp->storagetime = net_NetTimeToDeltaTime( &itemPtr->storagetime);
......@@ -348,8 +346,10 @@ int sevcli_get_itemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid,
}
*sts = rmsg->Status;
if ( EVEN(*sts))
if ( EVEN(*sts)) {
qcom_Free( sts, rmsg);
return 0;
}
int item_cnt = rmsg->NumPoints;
......@@ -441,9 +441,12 @@ int sevcli_get_objectitemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid,
}
*sts = rmsg->Status;
if ( EVEN(*sts))
if ( EVEN(*sts)) {
qcom_Free( sts, rmsg);
return 0;
}
if( rmsg->NumPoints == 0 ) {
qcom_Free( sts, rmsg);
*sts = 0;
return 0;
}
......
......@@ -83,6 +83,10 @@ int XttSevHist::get_data( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
if ( EVEN(*sts))
return 0;
if( rows == 0 ) {
return 0;
}
// Create data for time axis
gcd = new GeCurveData( curve_eDataType_DsTrend);
......@@ -185,6 +189,10 @@ int XttSevHist::get_objectdata( pwr_tStatus *sts, pwr_tTime from, pwr_tTime to)
if ( EVEN(*sts))
return 0;
if( rows == 0 ) {
return 0;
}
// Create data for time axis
gcd = new GeCurveData( curve_eDataType_DsTrend);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment