Commit c2d370df authored by Claes Sjofors's avatar Claes Sjofors

Merge branch 'master'

parents 0c561193 a238e41c
......@@ -420,6 +420,69 @@ int sev_server::send_itemlist(qcom_sQid tgt)
return 1;
}
int sev_server::send_eventsitemlist(qcom_sQid tgt)
{
int item_cnt = 0;
qcom_sPut put;
pwr_tStatus sts, lsts;
int size;
for (unsigned int i = 0; i < m_db->m_items.size(); i++) {
if (!m_db->m_items[i].deleted &&
strcmp(m_db->m_items[i].attr[0].aname, "Events") == 0 &&
m_db->m_items[i].attr[0].size == 0)
item_cnt++;
}
if (!item_cnt)
return 1;
size = sizeof(sev_sMsgEventsItems) + (item_cnt - 1) * sizeof(sev_sEventsItem);
put.size = size;
put.data = qcom_Alloc(&lsts, put.size);
put.allocate = 0;
((sev_sMsgEventsItems*)put.data)->Type = sev_eMsgType_EventsItems;
((sev_sMsgEventsItems*)put.data)->Version = sev_cNetVersion;
((sev_sMsgEventsItems*)put.data)->NumItems = item_cnt;
sev_sEventsItem* itemPtr = ((sev_sMsgEventsItems*)put.data)->Items;
for (unsigned int i = 0; i < m_db->m_items.size(); i++) {
if (!(!m_db->m_items[i].deleted &&
strcmp(m_db->m_items[i].attr[0].aname, "Events") == 0 &&
m_db->m_items[i].attr[0].size == 0))
continue;
itemPtr->oid = m_db->m_items[i].oid;
strcpy(itemPtr->oname, m_db->m_items[i].oname);
itemPtr->storagetime
= net_DeltaTimeToNetTime(&m_db->m_items[i].storagetime);
itemPtr->creatime = net_TimeToNetTime(&m_db->m_items[i].creatime);
strcpy(itemPtr->description, m_db->m_items[i].description);
itemPtr->options = m_db->m_items[i].options;
itemPtr++;
}
if (!item_cnt)
((sev_sMsgHistItems*)put.data)->Status = SEV__NOITEMS;
else
((sev_sMsgHistItems*)put.data)->Status = SEV__SUCCESS;
put.reply.nid = m_nodes[0].nid;
put.reply.qix = sev_eProcSevServer;
put.type.b = (qcom_eBtype)sev_cMsgClass;
put.type.s = (qcom_eStype)sev_eMsgType_EventsItems;
put.msg_id = m_msg_id++;
if (!qcom_Put(&sts, &tgt, &put)) {
qcom_Free(&sts, put.data);
return 0;
}
return 1;
}
int sev_server::send_server_status(qcom_sQid tgt)
{
qcom_sPut put;
......@@ -625,6 +688,14 @@ int sev_server::mainloop()
receive_events((sev_sMsgEventsStore*)mp, get.size, get.sender.nid);
m_stat.eventstore_msg_cnt++;
break;
case sev_eMsgType_EventsGetRequest:
send_events(get.reply, (sev_sMsgEventsGetRequest*)mp, get.size);
// m_stat.dataget_msg_cnt++;
// Don't free the message now
continue;
case sev_eMsgType_EventsItemsRequest:
send_eventsitemlist(get.reply);
break;
default:;
}
break;
......@@ -845,6 +916,8 @@ int sev_server::check_histitems(sev_sMsgHistItems* msg, unsigned int size)
} else {
// SevHistEvents item
storagetime = net_NetTimeToDeltaTime(&msg->Items[i].storagetime);
if (!m_db->check_item(&m_sts, msg->Items[i].oid, msg->Items[i].oname,
(char*)"Events", storagetime, (pwr_eType)0, 0,
msg->Items[i].description, (char*)"", msg->Items[i].scantime, 0,
......@@ -1192,6 +1265,118 @@ void* sev_server::send_objecthistdata_thread(void* arg)
return (void*)1;
}
int sev_server::send_events(
qcom_sQid tgt, sev_sMsgEventsGetRequest* rmsg, unsigned int size)
{
pthread_t thread;
pthread_attr_t attr;
int sts;
sev_sEventsThread* arg = (sev_sEventsThread*)malloc(sizeof(*arg));
arg->sev = this;
arg->tgt = tgt;
arg->rmsg = rmsg;
arg->size = size;
if (m_read_threads) {
static int pcnt = 0;
printf("New read thread %d\n", pcnt++);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
sts = pthread_create(&thread, &attr, send_events_thread, arg);
if (sts != 0)
printf("pthread_create error %d\n", sts);
} else {
send_events_thread(arg);
}
return 1;
}
void* sev_server::send_events_thread(void* arg)
{
sev_sMsgEventsGet* msg;
int msize;
qcom_sPut put;
pwr_tStatus sts, lsts;
pwr_tTime starttime, endtime;
unsigned int item_idx;
void* thread = 0;
std::vector<sev_event> list;
sev_server* sev = ((sev_sEventsThread*)arg)->sev;
qcom_sQid tgt = ((sev_sEventsThread*)arg)->tgt;
sev_sMsgEventsGetRequest* rmsg = ((sev_sEventsThread*)arg)->rmsg;
free(arg);
starttime = net_NetTimeToTime(&rmsg->StartTime);
endtime = net_NetTimeToTime(&rmsg->EndTime);
sev->m_db->get_item_idx(&sts, &item_idx, rmsg->Oid, (char *)"Events");
if (EVEN(sts)) {
qcom_Free(&lsts, rmsg);
return (void*)1;
}
if (sev->m_read_threads)
thread = sev->m_db->new_thread();
sev->m_db->get_events(&sts, thread, rmsg->Oid,
sev->m_db->m_items[item_idx].options, rmsg->EventTypeMask,
rmsg->EventPrioMask, rmsg->EventText, rmsg->EventName,
&starttime, &endtime, rmsg->MaxEvents, list);
if (ODD(sts) && list.size() != 0)
msize = sizeof(*msg) + (list.size() - 1) * sizeof(sev_sEvents);
else
msize = sizeof(*msg);
put.reply.nid = sev->m_nodes[0].nid;
put.reply.qix = sev_eProcSevServer;
put.type.b = (qcom_eBtype)sev_cMsgClass;
put.type.s = (qcom_eStype)sev_eMsgType_EventsGet;
put.msg_id = sev->m_msg_id++;
put.size = msize;
msg = (sev_sMsgEventsGet*)qcom_Alloc(&lsts, put.size);
put.data = msg;
put.allocate = 0;
msg->Type = sev_eMsgType_EventsGet;
msg->Version = sev_cNetVersion;
msg->Oid = rmsg->Oid;
if (ODD(sts)) {
msg->NumEvents = list.size();
}
qcom_Free(&lsts, rmsg);
msg->Status = sts;
if (ODD(sts) && list.size()) {
sev_sEvents *mp = msg->Events;
for (int i = 0; i < list.size(); i++) {
mp->Time = net_TimeToNetTime(&list[i].time);
mp->EventType = list[i].type;
mp->EventPrio = list[i].eventprio;
mp->SupObjectOid = list[i].supobject.Objid;
mp->SupObjectOffset = list[i].supobject.Offset;
mp->SupObjectSize = list[i].supobject.Size;
strncpy(mp->EventText, list[i].eventtext, sizeof(mp->EventText));
strncpy(mp->EventName, list[i].eventname, sizeof(mp->EventName));
mp->EventId = list[i].eventid;
mp++;
}
}
if (!qcom_Put(&sts, &tgt, &put)) {
qcom_Free(&sts, put.data);
}
if (sev->m_read_threads)
sev->m_db->delete_thread(thread);
pthread_exit( (void *) 1);
return (void*)1;
}
int sev_server::receive_events(
sev_sMsgEventsStore* msg, unsigned int size, pwr_tNodeId nid)
{
......
......@@ -65,6 +65,14 @@ typedef struct {
unsigned int item_idx;
} sev_sHistDataThread;
typedef struct {
sev_server* sev;
qcom_sQid tgt;
sev_sMsgEventsGetRequest* rmsg;
unsigned int size;
unsigned int item_idx;
} sev_sEventsThread;
typedef struct {
int key;
pthread_t thread;
......@@ -148,7 +156,10 @@ public:
int send_objecthistdata(
qcom_sQid tgt, sev_sMsgHistDataGetRequest* rmsg, unsigned int size);
static void* send_objecthistdata_thread(void* arg);
int send_events(qcom_sQid tgt, sev_sMsgEventsGetRequest* rmsg, unsigned int size);
static void* send_events_thread(void* arg);
int send_itemlist(qcom_sQid tgt);
int send_eventsitemlist(qcom_sQid tgt);
int send_server_status(qcom_sQid tgt);
int delete_item(qcom_sQid tgt, sev_sMsgHistItemDelete* rmsg);
int receive_events(
......
......@@ -224,6 +224,11 @@ public:
pwr_tTime** tbuf, void** vbuf, unsigned int* bsize);
virtual int handle_objectchange(
pwr_tStatus* sts, char* tablename, unsigned int item_idx, bool newObject);
virtual int get_events(pwr_tStatus *sts, void *thread, pwr_tOid,
pwr_tMask options, pwr_tMask eventtypemask,
pwr_tMask eventpriomask, char *eventtext, char *eventname,
pwr_tTime *starttime, pwr_tTime *endtime, unsigned int numpoints,
std::vector<sev_event> &list) {return 0;}
virtual int repair_table(pwr_tStatus* sts, char* tablename);
virtual int alter_engine(pwr_tStatus* sts, char* tablename);
virtual int optimize(pwr_tStatus* sts, char* tablename);
......
This diff is collapsed.
......@@ -205,6 +205,11 @@ public:
pwr_tStatus* sts, char* tablename, unsigned int item_idx);
int handle_objectchange(
pwr_tStatus* sts, char* tablename, unsigned int item_idx, bool newObject);
int get_events(pwr_tStatus *sts, void *thread, pwr_tOid,
pwr_tMask options, pwr_tMask eventtypemask,
pwr_tMask eventpriomask, char *eventtext, char *eventname,
pwr_tTime *starttime, pwr_tTime *endtime, unsigned int numpoints,
std::vector<sev_event> &list);
int repair_table(pwr_tStatus* sts, char* tablename);
int alter_engine(pwr_tStatus* sts, char* tablename);
int optimize(pwr_tStatus* sts, char* tablename);
......
......@@ -1215,8 +1215,7 @@ static void sendAlarmStatus(sOutunit* op)
if (ep && !(ep->msg.info.EventFlags & mh_mEventFlags_InfoWindow))
break;
if (ep && ep->msg.info.EventFlags & mh_mEventFlags_InfoWindow
&& (!(ep->msg.info.EventFlags & mh_mEventFlags_Ack)
|| !(ep->msg.info.EventFlags & mh_mEventFlags_Return)))
&& !(ep->msg.info.EventFlags & mh_mEventFlags_Ack))
break;
}
......@@ -1263,8 +1262,7 @@ static void sendAlarmStatus(sOutunit* op)
if (ep && !(ep->msg.info.EventFlags & mh_mEventFlags_InfoWindow))
break;
if (ep && ep->msg.info.EventFlags & mh_mEventFlags_InfoWindow
&& (!(ep->msg.info.EventFlags & mh_mEventFlags_Ack)
|| !(ep->msg.info.EventFlags & mh_mEventFlags_Return)))
&& !(ep->msg.info.EventFlags & mh_mEventFlags_Ack))
break;
}
......
......@@ -1480,7 +1480,7 @@ pwr_tStatus rt_sevhistmon::mh_ack_bc(mh_sAck* msg)
{
sev_sEvent ed;
ed.type = sev_eEventType_Ack;
ed.type = msg->Info.EventType;
ed.time = msg->Info.EventTime;
strcpy(ed.eventtext, "");
strncpy(ed.eventname, msg->EventName, sizeof(ed.eventname));
......@@ -1502,7 +1502,7 @@ pwr_tStatus rt_sevhistmon::mh_return_bc(mh_sReturn* msg)
{
sev_sEvent ed;
ed.type = sev_eEventType_Return;
ed.type = msg->Info.EventType;
ed.time = msg->Info.EventTime;
strncpy(ed.eventtext, msg->EventText, sizeof(ed.eventtext));
strncpy(ed.eventname, msg->EventName, sizeof(ed.eventname));
......@@ -1525,7 +1525,7 @@ pwr_tStatus rt_sevhistmon::mh_alarm_bc(mh_sMessage* msg)
{
sev_sEvent ed;
ed.type = sev_eEventType_Alarm;
ed.type = msg->Info.EventType;
ed.time = msg->Info.EventTime;
strncpy(ed.eventtext, msg->EventText, sizeof(ed.eventtext));
strncpy(ed.eventname, msg->EventName, sizeof(ed.eventname));
......@@ -1548,7 +1548,7 @@ pwr_tStatus rt_sevhistmon::mh_block_bc(mh_sBlock* msg)
{
sev_sEvent ed;
ed.type = sev_eEventType_Block;
ed.type = msg->Info.EventType;
ed.time = msg->Info.EventTime;
strcpy(ed.eventtext, "");
strncpy(ed.eventname, msg->EventName, sizeof(ed.eventname));
......@@ -1571,7 +1571,7 @@ pwr_tStatus rt_sevhistmon::mh_cancel_bc(mh_sReturn* msg)
{
sev_sEvent ed;
ed.type = sev_eEventType_Cancel;
ed.type = msg->Info.EventType;
ed.time = msg->Info.EventTime;
strcpy(ed.eventtext, "");
strncpy(ed.eventname, msg->EventName, sizeof(ed.eventname));
......@@ -1594,7 +1594,7 @@ pwr_tStatus rt_sevhistmon::mh_info_bc(mh_sMessage* msg)
{
sev_sEvent ed;
ed.type = sev_eEventType_Info;
ed.type = msg->Info.EventType;
ed.time = msg->Info.EventTime;
strncpy(ed.eventtext, msg->EventText, sizeof(ed.eventtext));
strncpy(ed.eventname, msg->EventName, sizeof(ed.eventname));
......
......@@ -36,7 +36,7 @@ $(pwrp_obj)/%.o : %.c
($(pwrp_obj)/%.o) : %.c
@ echo "cc ar $(notdir $(source))"
@ $(cc) $(cflags) $(csetos) $(cinc) -c -o $% $(source)
@ ar r $(target) $%
@ ar -Ur $(target) $%
$(pwrp_obj)/%.o : %.cpp
@ echo "cc $(notdir $(source))"
......@@ -45,7 +45,7 @@ $(pwrp_obj)/%.o : %.cpp
($(pwrp_obj)/%.o) : %.cpp
@ echo "cc ar $(notdir $(source))"
@ $(cxx) $(cxxflags) $(csetos) $(cinc) -c -o $% $(source)
@ ar r $(target) $%
@ ar -Ur $(target) $%
$(pwrp_obj)/%.o : %.for
@ echo "fortran77 $(notdir $(source))"
......@@ -54,7 +54,7 @@ $(pwrp_obj)/%.o : %.for
($(pwrp_obj)/%.o) : %.for
@ echo "fortran77 ar $(notdir $(source))"
@ $(f77) $(f77flags) $(f77inc) -c -o $% $(source)
@ ar r $(target) $%
@ ar -Ur $(target) $%
$(pwrp_inc)/%.h: %.msg
@ echo "Msg to h $(source)"
......
This diff is collapsed.
......@@ -191,7 +191,13 @@ int rtt_alarm_send(char* alarm_text, int alarm_prio)
break;
case 'I':
mh_msg.EventType = mh_eEvent_Info;
mh_msg.EventFlags = mh_mEventFlags_InfoWindow;
mh_msg.EventFlags |= mh_mEventFlags_InfoWindow;
mh_msg.EventFlags |= mh_mEventFlags_Ack;
break;
case 'S':
mh_msg.EventType = mh_eEvent_InfoSuccess;
mh_msg.EventFlags |= mh_mEventFlags_InfoWindow;
mh_msg.EventFlags |= mh_mEventFlags_Ack;
break;
default:
mh_msg.EventPrio = mh_eEventPrio_A;
......
......@@ -67,7 +67,11 @@ typedef enum {
sev_eMsgType_ExportNodeUp,
sev_eMsgType_ExportItemsRequest,
sev_eMsgType_ExportItems,
sev_eMsgType_ExportData
sev_eMsgType_ExportData,
sev_eMsgType_EventsItemsRequest,
sev_eMsgType_EventsItems,
sev_eMsgType_EventsGetRequest,
sev_eMsgType_EventsGet
} sev_eMsgType;
typedef enum {
......@@ -79,8 +83,35 @@ typedef enum {
sev_eEventType_Cancel
} sev_eEventType;
typedef enum {
sev_mEventType_Ack = 1,
sev_mEventType_Block = 2,
sev_mEventType_Cancel = 4,
sev_mEventType_CancelBlock = 8,
sev_mEventType_Missing = 16,
sev_mEventType_Reblock = 32,
sev_mEventType_Return = 64,
sev_mEventType_Unblock = 128,
sev_mEventType_InfoSuccess = 256,
sev_mEventType_Alarm = 512,
sev_mEventType_MaintenanceAlarm = 1024,
sev_mEventType_SystemAlarm = 2048,
sev_mEventType_UserAlarm1 = 4096,
sev_mEventType_UserAlarm2 = 8192,
sev_mEventType_UserAlarm3 = 16384,
sev_mEventType_UserAlarm4 = 32768,
sev_mEventType_Info = 65536
} sev_mEventType;
typedef enum {
sev_mEventPrio_A = 1,
sev_mEventPrio_B = 2,
sev_mEventPrio_C = 4,
sev_mEventPrio_D = 8
} sev_mEventPrio;
typedef struct {
sev_eEventType type;
unsigned int type;
unsigned int eventprio;
unsigned int eventid_nix;
unsigned int eventid_birthtime;
......@@ -273,6 +304,57 @@ typedef struct {
sev_sExportItem Items[1];
} sev_sMsgExportItems;
typedef struct {
pwr_tOid oid;
pwr_tOName oname;
net_sTime storagetime;
net_sTime creatime;
pwr_tString80 description;
pwr_tMask options;
} sev_sEventsItem;
typedef struct {
pwr_tUInt16 Type;
pwr_tUInt16 Version;
pwr_tStatus Status;
unsigned int NumItems;
sev_sEventsItem Items[1];
} sev_sMsgEventsItems;
typedef struct {
pwr_tUInt16 Type;
pwr_tUInt16 Version;
pwr_tOid Oid;
net_sTime StartTime;
net_sTime EndTime;
pwr_tUInt32 EventTypeMask;
pwr_tUInt32 EventPrioMask;
pwr_tString80 EventText;
pwr_tOName EventName;
pwr_tUInt32 MaxEvents;
} sev_sMsgEventsGetRequest;
typedef struct {
net_sTime Time;
pwr_tUInt32 EventType;
pwr_tUInt32 EventPrio;
pwr_tOid SupObjectOid;
pwr_tUInt32 SupObjectOffset;
pwr_tUInt32 SupObjectSize;
pwr_tString80 EventText;
pwr_tOName EventName;
mh_sEventId EventId;
} sev_sEvents;
typedef struct {
pwr_tUInt16 Type;
pwr_tUInt16 Version;
pwr_tOid Oid;
pwr_tStatus Status;
int NumEvents;
sev_sEvents Events[1];
} sev_sMsgEventsGet;
#ifdef __cplusplus
}
......
......@@ -639,3 +639,225 @@ int sevcli_delete_item(
qcom_Free(sts, rmsg);
return 1;
}
/**
* @brief Fetches a list with the stored eventlists of the server.
* @return pwr_tStatus
*/
int sevcli_get_eventsitemlist(pwr_tStatus* sts, sevcli_tCtx ctx,
sevcli_sEventsItem** list, unsigned int* cnt)
{
sev_sMsgAny* msg;
qcom_sQid tgt;
qcom_sPut put;
pwr_tStatus lsts;
int tmo = 10000;
qcom_sGet get;
sevcli_sEventsItem* lp;
int i;
if (ctx->server)
tgt.nid = ctx->server;
else
tgt.nid = ctx->qid.nid;
tgt.qix = sev_eProcSevServer;
put.reply = ctx->qid;
put.type.b = (qcom_eBtype)sev_cMsgClass;
put.type.s = (qcom_eStype)sev_eMsgType_EventsItemsRequest;
put.msg_id = ctx->msg_id++;
put.size = sizeof(*msg);
put.allocate = 0;
msg = (sev_sMsgAny*)qcom_Alloc(sts, put.size);
put.data = msg;
msg->Type = sev_eMsgType_EventsItemsRequest;
msg->Version = sev_cNetVersion;
if (!qcom_Put(sts, &tgt, &put)) {
qcom_Free(&lsts, put.data);
return 0;
}
sev_sMsgEventsItems* rmsg;
memset(&get, 0, sizeof(get));
for (;;) {
rmsg = (sev_sMsgEventsItems*)qcom_Get(sts, &ctx->qid, &get, tmo);
if (*sts == QCOM__TMO || !rmsg) {
return 0;
}
if (get.type.b == sev_cMsgClass
&& get.type.s == (qcom_eStype)sev_eMsgType_EventsItems)
break;
qcom_Free(sts, rmsg);
}
*sts = rmsg->Status;
if (EVEN(*sts))
return 0;
int item_cnt = rmsg->NumItems;
unsigned int data_size = (item_cnt * sizeof(sevcli_sEventsItem));
lp = (sevcli_sEventsItem*)malloc(data_size);
sevcli_sEventsItem* lp2 = lp;
sev_sEventsItem* itemPtr = ((sev_sMsgEventsItems*)rmsg)->Items;
for (i = 0; i < item_cnt; i++) {
lp->oid = itemPtr->oid;
strncpy(lp->oname, itemPtr->oname, sizeof(lp->oname));
strncpy(lp->description, itemPtr->description, sizeof(lp->description));
lp->storagetime = net_NetTimeToDeltaTime(&itemPtr->storagetime);
lp->options = itemPtr->options;
lp->creatime = net_NetTimeToTime(&itemPtr->creatime);
itemPtr++;
lp++;
}
qcom_Free(sts, rmsg);
*cnt = item_cnt;
*list = lp2;
*sts = SEV__SUCCESS;
return 1;
}
/**
* @brief Fetch stored historical events for an events item.
*
* @return pwr_tStatus
*/
int sevcli_get_events(pwr_tStatus* sts, sevcli_tCtx ctx, pwr_tOid oid,
pwr_tTime starttime, pwr_tTime endtime, pwr_tUInt32 eventtypemask,
pwr_tUInt32 eventpriomask, pwr_tString80 eventtext, pwr_tOName eventname,
unsigned int maxevents, sevcli_sEvents **list, unsigned int* cnt)
{
sev_sMsgEventsGetRequest* msg;
qcom_sQid tgt;
qcom_sPut put;
static int tmo = 0;
qcom_sGet get;
pwr_tStatus lsts;
sevcli_sEvents *lp;
sev_sEvents *ip;
int i;
if (tmo == 0) {
int value;
char value_str[20];
int nr;
if (cnf_get_value("sevTimeout", value_str, sizeof(value_str))) {
nr = sscanf(value_str, "%d", &value);
if (nr != 1)
tmo = 30000;
else
tmo = 1000 * value;
} else
tmo = 30000;
}
if (ctx->server)
tgt.nid = ctx->server;
else
tgt.nid = ctx->qid.nid;
tgt.qix = sev_eProcSevServer;
put.reply = ctx->qid;
put.type.b = (qcom_eBtype)sev_cMsgClass;
put.type.s = (qcom_eStype)sev_eMsgType_EventsGetRequest;
put.msg_id = ctx->msg_id++;
put.size = sizeof(*msg);
put.allocate = 0;
msg = (sev_sMsgEventsGetRequest*)qcom_Alloc(sts, put.size);
put.data = msg;
msg->Type = sev_eMsgType_EventsGetRequest;
msg->Version = sev_cNetVersion;
msg->Oid = oid;
msg->StartTime = net_TimeToNetTime(&starttime);
msg->EndTime = net_TimeToNetTime(&endtime);
msg->EventTypeMask = eventtypemask;
msg->EventPrioMask = eventpriomask;
strncpy(msg->EventText, eventtext, sizeof(msg->EventText));
strncpy(msg->EventName, eventname, sizeof(msg->EventName));
msg->MaxEvents = maxevents;
// Empty queue
sev_sMsgEventsGet* rmsg;
memset(&get, 0, sizeof(get));
for (;;) {
rmsg = (sev_sMsgEventsGet*)qcom_Get(sts, &ctx->qid, &get, 0);
if (!rmsg)
break;
qcom_Free(sts, rmsg);
}
if (!qcom_Put(sts, &tgt, &put)) {
qcom_Free(&lsts, put.data);
return 0;
}
memset(&get, 0, sizeof(get));
for (;;) {
rmsg = (sev_sMsgEventsGet*)qcom_Get(sts, &ctx->qid, &get, tmo);
if (*sts == QCOM__TMO || !rmsg) {
return 0;
}
if (get.type.b == sev_cMsgClass
&& get.type.s == (qcom_eStype)sev_eMsgType_EventsGet
&& cdh_ObjidIsEqual(oid, rmsg->Oid))
break;
qcom_Free(sts, rmsg);
}
*sts = rmsg->Status;
if (EVEN(*sts)) {
qcom_Free(&lsts, rmsg);
return 0;
}
if (rmsg->NumEvents == 0) {
qcom_Free(sts, rmsg);
*sts = SEV__NOPOINTS;
return 0;
}
int item_cnt = rmsg->NumEvents;
*list = calloc(item_cnt, sizeof(sevcli_sEventsItem));
lp = *list;
ip = rmsg->Events;
for (i = 0; i < item_cnt; i++) {
lp->Time = net_NetTimeToTime(&ip->Time);
lp->EventType = ip->EventType;
lp->EventPrio = ip->EventPrio;
lp->SupObjectOid = ip->SupObjectOid;
lp->SupObjectSize = ip->SupObjectSize;
strncpy(lp->EventText, ip->EventText, sizeof(lp->EventText));
strncpy(lp->EventName, ip->EventName, sizeof(lp->EventName));
lp->EventId = ip->EventId;
lp++;
ip++;
}
*cnt = item_cnt;
qcom_Free(&lsts, rmsg);
*sts = SEV__SUCCESS;
return 1;
}
......@@ -43,6 +43,7 @@
/*@{*/
#include "rt_qcom.h"
#include "rt_mh_net.h"
#ifdef __cplusplus
extern "C" {
......@@ -85,6 +86,27 @@ typedef struct {
sevcli_sHistAttr attr[1]; /**< Array of attribute data */
} sevcli_sHistItem;
typedef struct {
pwr_tOid oid; /**< Object identity */
pwr_tAName oname; /**< Object name */
pwr_tDeltaTime storagetime; /**< Storage time from SevHist object */
pwr_tTime creatime; /**< Creation time */
pwr_tString80 description; /**< Description */
pwr_tMask options; /**< Options from SevHist object */
} sevcli_sEventsItem;
typedef struct {
pwr_tTime Time;
pwr_tUInt32 EventType;
pwr_tUInt32 EventPrio;
pwr_tOid SupObjectOid;
pwr_tUInt32 SupObjectOffset;
pwr_tUInt32 SupObjectSize;
pwr_tString80 EventText;
pwr_tOName EventName;
mh_sEventId EventId;
} sevcli_sEvents;
int sevcli_init(pwr_tStatus* sts, sevcli_tCtx* ctx);
int sevcli_close(pwr_tStatus* sts, sevcli_tCtx ctx);
void sevcli_set_servernid(sevcli_tCtx ctx, pwr_tNid nid);
......@@ -101,6 +123,12 @@ int sevcli_get_objectitemdata(pwr_tStatus* sts, sevcli_tCtx ctx, pwr_tOid oid,
char* aname, pwr_tTime starttime, pwr_tTime endtime, int numpoints,
pwr_tTime** tbuf, void** vbuf, int* rows, sevcli_sHistAttr** histattr,
int* numattributes);
int sevcli_get_eventsitemlist(pwr_tStatus* sts, sevcli_tCtx ctx,
sevcli_sEventsItem** list, unsigned int* cnt);
int sevcli_get_events(pwr_tStatus* sts, sevcli_tCtx ctx, pwr_tOid oid,
pwr_tTime starttime, pwr_tTime endtime, pwr_tUInt32 eventtypemask,
pwr_tUInt32 eventpriomask, pwr_tString80 eventtext, pwr_tOName eventname,
unsigned int maxevents, sevcli_sEvents **list, unsigned int* cnt);
/** @} */
......
......@@ -176,6 +176,11 @@ XttMultiViewQt::XttMultiViewQt(void* mv_parent_ctx, const char* mv_name,
comp_widget = std::vector<QWidget*>(rows * cols);
exchange_widget = std::vector<QWidget*>(rows * cols);
exchange_widget_layout = std::vector<QHBoxLayout*>(rows * cols);
for (int i = 0; i < rows * cols; i++) {
exchange_widget_layout[i] = new QHBoxLayout(toplevel);
exchange_widget[i]
= layout_to_widget(exchange_widget_layout[i]);
}
QHBoxLayout* col_widget_box = new QHBoxLayout();
QSplitter* col_widget_pane = new QSplitter();
......@@ -680,8 +685,6 @@ XttMultiViewQt::XttMultiViewQt(void* mv_parent_ctx, const char* mv_name,
if (mv.Action[idx].Options
& pwr_mMultiViewElemOptionsMask_Exchangeable) {
exchange_widget[idx]
= layout_to_widget(exchange_widget_layout[idx]);
if (comp_widget[idx]) {
add_expanding(exchange_widget_layout[idx],
comp_widget[idx]);
......@@ -1296,4 +1299,4 @@ void XttMultiViewQt::signal_send(char* signalname)
((XttMultiViewQt*) views[i].data)->signal_send(signalname);
}
}
}
\ No newline at end of file
}
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