Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
9d007f29
Commit
9d007f29
authored
Sep 18, 2008
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More sev work done
parent
996259a8
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
752 additions
and
219 deletions
+752
-219
sev/exe/sev_ini/src/ini.c
sev/exe/sev_ini/src/ini.c
+2
-2
sev/exe/sev_server/src/sev_server.cpp
sev/exe/sev_server/src/sev_server.cpp
+65
-32
sev/exe/sev_server/src/sev_server.h
sev/exe/sev_server/src/sev_server.h
+3
-2
sev/exe/sev_xtt/gtk/xtt_tbl_gtk.cpp
sev/exe/sev_xtt/gtk/xtt_tbl_gtk.cpp
+14
-14
sev/exe/sev_xtt/gtk/xtt_tbl_gtk.h
sev/exe/sev_xtt/gtk/xtt_tbl_gtk.h
+3
-3
sev/exe/sev_xtt/src/xtt_tbl.cpp
sev/exe/sev_xtt/src/xtt_tbl.cpp
+9
-6
sev/exe/sev_xtt/src/xtt_tbl.h
sev/exe/sev_xtt/src/xtt_tbl.h
+4
-4
sev/exe/sev_xtt/src/xtt_tblnav.cpp
sev/exe/sev_xtt/src/xtt_tblnav.cpp
+59
-31
sev/lib/sev/src/sev_db.h
sev/lib/sev/src/sev_db.h
+30
-13
sev/lib/sev/src/sev_dbms.cpp
sev/lib/sev/src/sev_dbms.cpp
+545
-101
sev/lib/sev/src/sev_dbms.h
sev/lib/sev/src/sev_dbms.h
+18
-11
No files found.
sev/exe/sev_ini/src/ini.c
View file @
9d007f29
/*
* Proview $Id: ini.c,v 1.
1 2008-09-05 08:38:58
claes Exp $
* Proview $Id: ini.c,v 1.
2 2008-09-18 14:37:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -416,7 +416,7 @@ void ini_ProcTable (
pp
->
flags
.
b
.
qmon
=
1
;
pp
->
proc
.
flags
.
b
.
system
=
1
;
pp
=
ini_ProcInsert
(
sts
,
cp
,
"pwr_sev_server"
,
"pwr_sev_server_%d"
,
0
,
1
,
"sev_server"
,
cPrio_sev_server
,
0
,
""
);
pp
=
ini_ProcInsert
(
sts
,
cp
,
"pwr_sev_server"
,
"pwr_sev_server_%d"
,
0
,
1
,
"sev_server"
,
cPrio_sev_server
,
0
,
"
-n
"
);
pp
->
proc
.
flags
.
b
.
system
=
1
;
...
...
sev/exe/sev_server/src/sev_server.cpp
View file @
9d007f29
/*
* Proview $Id: sev_server.cpp,v 1.
2 2008-09-05 08:38:58
claes Exp $
* Proview $Id: sev_server.cpp,v 1.
3 2008-09-18 14:37:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -26,14 +26,18 @@
#include "rt_qcom.h"
#include "rt_qcom_msg.h"
#include "rt_ini_event.h"
#include "rt_gdh.h"
#include "sev_server.h"
#include "rt_sev_net.h"
#include "sev_dbms.h"
#include "rt_sev_msg.h"
#include "rt_pwr_msg.h"
#include "rt_errh.h"
#include "pwr_baseclasses.h"
#define sev_cGarbageInterval 120
int
sev_server
::
init
()
int
sev_server
::
init
(
int
noneth
)
{
qcom_sNode
node
;
pwr_tNid
nid
;
...
...
@@ -44,13 +48,28 @@ int sev_server::init()
m_db
->
get_items
(
&
m_sts
);
for
(
unsigned
int
i
=
0
;
i
<
m_db
->
m_items
.
size
();
i
++
)
{
sev_item_key
items_key
(
m_db
->
m_items
[
i
].
oid
,
m_db
->
m_items
[
i
].
aname
);
sev_item_key
items_key
(
m_db
->
m_items
[
i
].
oid
,
m_db
->
m_items
[
i
].
a
ttr
[
0
].
a
name
);
m_item_key
[
items_key
]
=
i
;
}
qcom_Init
(
&
m_sts
,
&
aid
,
"sev_server"
);
if
(
EVEN
(
m_sts
))
throw
co_error
(
m_sts
);
m_noneth
=
noneth
;
if
(
!
m_noneth
)
{
// Check server config object
pwr_tOid
conf_oid
;
sts
=
gdh_Init
(
"sev_server"
);
if
(
EVEN
(
m_sts
))
throw
co_error
(
m_sts
);
sts
=
gdh_GetClassList
(
pwr_cClass_SevServer
,
&
conf_oid
);
if
(
EVEN
(
sts
))
{
errh_CErrLog
(
PWR__SRVNOTCONF
,
0
);
exit
(
0
);
}
}
// Create a queue to server
qcom_sQattr
attr
;
qcom_sQid
qid
;
...
...
@@ -188,13 +207,18 @@ int sev_server::send_itemlist( qcom_sQid tgt)
continue
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
oid
=
m_db
->
m_items
[
i
].
oid
;
strcpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
oname
,
m_db
->
m_items
[
i
].
oname
);
strcpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
aname
,
m_db
->
m_items
[
i
].
aname
);
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
storagetime
=
m_db
->
m_items
[
i
].
storagetime
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
type
=
m_db
->
m_items
[
i
].
vtyp
e
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
size
=
m_db
->
m_items
[
i
].
vsiz
e
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
creatime
=
m_db
->
m_items
[
i
].
creatim
e
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
modtime
=
m_db
->
m_items
[
i
].
modtim
e
;
strcpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
description
,
m_db
->
m_items
[
i
].
description
);
strcpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
unit
,
m_db
->
m_items
[
i
].
unit
);
strcpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
attr
[
0
].
aname
,
m_db
->
m_items
[
i
].
attr
[
0
].
aname
);
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
attrnum
=
m_db
->
m_items
[
i
].
attrnum
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
attr
[
0
].
type
=
m_db
->
m_items
[
i
].
attr
[
0
].
type
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
attr
[
0
].
size
=
m_db
->
m_items
[
i
].
attr
[
0
].
size
;
strcpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
attr
[
0
].
unit
,
m_db
->
m_items
[
i
].
attr
[
0
].
unit
);
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
scantime
=
m_db
->
m_items
[
i
].
scantime
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
deadband
=
m_db
->
m_items
[
i
].
deadband
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
idx
].
options
=
m_db
->
m_items
[
i
].
options
;
idx
++
;
}
...
...
@@ -268,7 +292,6 @@ int sev_server::mainloop()
clock_gettime
(
CLOCK_REALTIME
,
&
currenttime
);
if
(
time_Acomp
(
&
currenttime
,
&
next_garco
)
==
1
)
{
printf
(
"Run garbage collector
\n
"
);
garbage_collector
();
time_Aadd
(
&
next_garco
,
&
next_garco
,
&
garco_interval
);
}
...
...
@@ -277,7 +300,6 @@ int sev_server::mainloop()
switch
(
get
.
type
.
b
)
{
case
sev_cMsgClass
:
printf
(
"Message received
\n
"
);
switch
(
get
.
type
.
s
)
{
case
sev_eMsgType_NodeUp
:
request_items
(
get
.
reply
.
nid
);
...
...
@@ -333,16 +355,22 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size)
}
for
(
int
i
=
0
;
i
<
item_cnt
;
i
++
)
{
printf
(
"Received: %s.%s
\n
"
,
msg
->
Items
[
i
].
oname
,
msg
->
Items
[
i
].
aname
);
if
(
!
m_db
->
check_item
(
&
m_sts
,
msg
->
Items
[
i
].
oid
,
msg
->
Items
[
i
].
oname
,
msg
->
Items
[
i
].
aname
,
msg
->
Items
[
i
].
storagetime
,
msg
->
Items
[
i
].
type
,
msg
->
Items
[
i
].
size
,
msg
->
Items
[
i
].
description
,
msg
->
Items
[
i
].
unit
,
msg
->
Items
[
i
].
scantime
,
&
idx
))
{
m_db
->
add_item
(
&
m_sts
,
msg
->
Items
[
i
].
oid
,
msg
->
Items
[
i
].
oname
,
msg
->
Items
[
i
].
aname
,
msg
->
Items
[
i
].
storagetime
,
msg
->
Items
[
i
].
type
,
msg
->
Items
[
i
].
size
,
msg
->
Items
[
i
].
description
,
msg
->
Items
[
i
].
unit
,
msg
->
Items
[
i
].
scantime
,
&
idx
);
// Deadband requires id variable
if
(
msg
->
Items
[
i
].
options
&
pwr_mSevOptionsMask_UseDeadBand
)
msg
->
Items
[
i
].
options
|=
pwr_mSevOptionsMask_ReadOptimized
;
// printf( "Received: %s.%s\n", msg->Items[i].oname, msg->Items[i].attr[0].aname);
if
(
!
m_db
->
check_item
(
&
m_sts
,
msg
->
Items
[
i
].
oid
,
msg
->
Items
[
i
].
oname
,
msg
->
Items
[
i
].
attr
[
0
].
aname
,
msg
->
Items
[
i
].
storagetime
,
msg
->
Items
[
i
].
attr
[
0
].
type
,
msg
->
Items
[
i
].
attr
[
0
].
size
,
msg
->
Items
[
i
].
description
,
msg
->
Items
[
i
].
attr
[
0
].
unit
,
msg
->
Items
[
i
].
scantime
,
msg
->
Items
[
i
].
deadband
,
msg
->
Items
[
i
].
options
,
&
idx
))
{
m_db
->
add_item
(
&
m_sts
,
msg
->
Items
[
i
].
oid
,
msg
->
Items
[
i
].
oname
,
msg
->
Items
[
i
].
attr
[
0
].
aname
,
msg
->
Items
[
i
].
storagetime
,
msg
->
Items
[
i
].
attr
[
0
].
type
,
msg
->
Items
[
i
].
attr
[
0
].
size
,
msg
->
Items
[
i
].
description
,
msg
->
Items
[
i
].
attr
[
0
].
unit
,
msg
->
Items
[
i
].
scantime
,
msg
->
Items
[
i
].
deadband
,
msg
->
Items
[
i
].
options
,
&
idx
);
sev_item_key
item_key
(
msg
->
Items
[
i
].
oid
,
msg
->
Items
[
i
].
aname
);
sev_item_key
item_key
(
msg
->
Items
[
i
].
oid
,
msg
->
Items
[
i
].
a
ttr
[
0
].
a
name
);
m_item_key
[
item_key
]
=
idx
;
}
...
...
@@ -352,9 +380,9 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size)
}
printf
(
"---- Node up ----
\n
"
);
for
(
iterator_refid
it
=
m_refid
.
begin
();
it
!=
m_refid
.
end
();
it
++
)
{
printf
(
"Refid: %d,%d Name %s
\n
"
,
it
->
first
.
id
.
nid
,
it
->
first
.
id
.
rix
,
m_db
->
m_items
[
it
->
second
].
oname
);
}
// for ( iterator_refid it = m_refid.begin(); it != m_refid.end(); it++)
//
printf( "Refid: %d,%d Name %s\n", it->first.id.nid, it->first.id.rix, m_db->m_items[it->second].oname);
return
1
;
}
...
...
@@ -371,8 +399,7 @@ int sev_server::receive_histdata( sev_sMsgHistDataStore *msg, unsigned int size)
}
unsigned
int
idx
=
it
->
second
;
m_db
->
store_value
(
&
m_sts
,
m_db
->
m_items
[
idx
].
oid
,
m_db
->
m_items
[
idx
].
aname
,
m_db
->
m_items
[
idx
].
vtype
,
msg
->
Time
,
&
dp
->
data
,
dp
->
size
);
m_db
->
store_value
(
&
m_sts
,
idx
,
0
,
msg
->
Time
,
&
dp
->
data
,
dp
->
size
);
dp
=
(
sev_sHistData
*
)((
char
*
)
dp
+
sizeof
(
*
dp
)
-
sizeof
(
dp
->
data
)
+
dp
->
size
);
}
...
...
@@ -401,12 +428,13 @@ int sev_server::send_histdata( qcom_sQid tgt, sev_sMsgHistDataGetRequest *rmsg,
if
(
ODD
(
m_sts
))
{
idx
=
it
->
second
;
m_db
->
get_values
(
&
m_sts
,
rmsg
->
Oid
,
rmsg
->
AName
,
m_db
->
m_items
[
idx
].
vtype
,
m_db
->
m_items
[
idx
].
vsize
,
m_db
->
m_items
[
idx
].
scantime
,
m_db
->
get_values
(
&
m_sts
,
rmsg
->
Oid
,
m_db
->
m_items
[
idx
].
options
,
m_db
->
m_items
[
idx
].
deadband
,
rmsg
->
AName
,
m_db
->
m_items
[
idx
].
attr
[
0
].
type
,
m_db
->
m_items
[
idx
].
attr
[
0
].
size
,
m_db
->
m_items
[
idx
].
scantime
,
&
rmsg
->
StartTime
,
&
rmsg
->
EndTime
,
rmsg
->
NumPoints
,
&
tbuf
,
&
vbuf
,
&
rows
);
}
if
(
ODD
(
m_sts
))
msize
=
rows
*
(
sizeof
(
pwr_tTime
)
+
m_db
->
m_items
[
idx
].
v
size
)
+
sizeof
(
*
msg
)
-
sizeof
(
msg
->
Data
);
msize
=
rows
*
(
sizeof
(
pwr_tTime
)
+
m_db
->
m_items
[
idx
].
attr
[
0
].
size
)
+
sizeof
(
*
msg
)
-
sizeof
(
msg
->
Data
);
else
msize
=
sizeof
(
*
msg
);
...
...
@@ -425,14 +453,14 @@ int sev_server::send_histdata( qcom_sQid tgt, sev_sMsgHistDataGetRequest *rmsg,
strncpy
(
msg
->
AName
,
rmsg
->
AName
,
sizeof
(
msg
->
AName
));
if
(
ODD
(
m_sts
))
{
msg
->
NumPoints
=
rows
;
msg
->
VType
=
m_db
->
m_items
[
idx
].
v
type
;
msg
->
VSize
=
m_db
->
m_items
[
idx
].
v
size
;
msg
->
VType
=
m_db
->
m_items
[
idx
].
attr
[
0
].
type
;
msg
->
VSize
=
m_db
->
m_items
[
idx
].
attr
[
0
].
size
;
}
msg
->
Status
=
m_sts
;
if
(
ODD
(
m_sts
)
&&
rows
)
{
memcpy
(
&
msg
->
Data
,
tbuf
,
sizeof
(
pwr_tTime
)
*
rows
);
memcpy
(
(
char
*
)
&
msg
->
Data
+
sizeof
(
pwr_tTime
)
*
rows
,
vbuf
,
m_db
->
m_items
[
idx
].
v
size
*
rows
);
memcpy
(
(
char
*
)
&
msg
->
Data
+
sizeof
(
pwr_tTime
)
*
rows
,
vbuf
,
m_db
->
m_items
[
idx
].
attr
[
0
].
size
*
rows
);
}
if
(
!
qcom_Put
(
&
sts
,
&
tgt
,
&
put
))
{
qcom_Free
(
&
sts
,
put
.
data
);
...
...
@@ -455,17 +483,22 @@ void sev_server::garbage_collector()
time_Asub
(
&
limit
,
&
currenttime
,
&
m_db
->
m_items
[
i
].
storagetime
);
m_db
->
delete_old_data
(
&
m_sts
,
m_db
->
m_items
[
i
].
oid
,
m_db
->
m_items
[
i
].
aname
,
limit
);
m_db
->
delete_old_data
(
&
m_sts
,
m_db
->
m_items
[
i
].
oid
,
m_db
->
m_items
[
i
].
attr
[
0
].
aname
,
m_db
->
m_items
[
i
].
options
,
limit
);
}
}
int
main
(
)
int
main
(
int
argc
,
char
*
argv
[]
)
{
sev_server
srv
;
sev_dbms_env
*
env
;
pwr_tFileName
envname
;
char
socket
[
200
];
int
noneth
=
0
;
if
(
argc
>
1
&&
strcmp
(
argv
[
1
],
"-n"
)
==
0
)
noneth
=
1
;
sprintf
(
envname
,
"$pwrp_db/%s.db"
,
sev_dbms_env
::
dbName
());
dcli_translate_filename
(
envname
,
envname
);
...
...
@@ -486,7 +519,7 @@ int main()
srv
.
m_db
=
new
sev_dbms
(
env
);
srv
.
init
();
srv
.
init
(
noneth
);
srv
.
connect
();
srv
.
mainloop
();
}
sev/exe/sev_server/src/sev_server.h
View file @
9d007f29
/*
* Proview $Id: sev_server.h,v 1.
2 2008-09-05 08:38:58
claes Exp $
* Proview $Id: sev_server.h,v 1.
3 2008-09-18 14:37:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -79,8 +79,9 @@ class sev_server {
map
<
sev_item_key
,
unsigned
int
>
m_item_key
;
unsigned
int
m_msg_id
;
sev_db
*
m_db
;
int
m_noneth
;
int
init
();
int
init
(
int
noneth
);
int
connect
();
int
request_items
(
pwr_tNid
nid
);
int
sev_server
::
mainloop
();
...
...
sev/exe/sev_xtt/gtk/xtt_tbl_gtk.cpp
View file @
9d007f29
/*
* Proview $Id: xtt_tbl_gtk.cpp,v 1.
2 2008-09-05 08:38:58
claes Exp $
* Proview $Id: xtt_tbl_gtk.cpp,v 1.
3 2008-09-18 14:37:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -43,7 +43,7 @@
#include "xtt_tbl_gtk.h"
#include "xtt_tblnav_gtk.h"
#include "xtt_
ds
hist_gtk.h"
#include "xtt_
sev
hist_gtk.h"
void
XttTblGtk
::
message
(
char
severity
,
char
*
message
)
{
...
...
@@ -162,14 +162,14 @@ void XttTblGtk::activate_help_proview( GtkWidget *w, gpointer data)
xtt
->
activate_help_proview
();
}
void
XttTblGtk
::
activate_open
ds
hist
(
GtkWidget
*
w
,
gpointer
data
)
void
XttTblGtk
::
activate_open
sev
hist
(
GtkWidget
*
w
,
gpointer
data
)
{
XttTbl
*
xtt
=
(
XttTbl
*
)
data
;
if
(
!
xtt
->
is_authorized
())
return
;
xtt
->
activate_open
ds
hist
();
xtt
->
activate_open
sev
hist
();
}
void
XttTblGtk
::
activate_delete_item
(
GtkWidget
*
w
,
gpointer
data
)
...
...
@@ -202,7 +202,7 @@ void XttTblGtk::activate_list_layout( GtkWidget *w, gpointer data)
xtt
->
tblnav
->
show_list
();
}
Xtt
DsHist
*
XttTblGtk
::
ds
hist_new
(
pwr_tOid
oid
,
char
*
aname
)
Xtt
SevHist
*
XttTblGtk
::
sev
hist_new
(
pwr_tOid
oid
,
char
*
aname
)
{
GtkWidget
*
w
;
pwr_tStatus
sts
;
...
...
@@ -213,7 +213,7 @@ XttDsHist *XttTblGtk::dshist_new( pwr_tOid oid, char *aname)
oidv
[
1
]
=
pwr_cNOid
;
strncpy
(
anamev
[
0
],
aname
,
sizeof
(
anamev
[
0
]));
return
new
Xtt
DsHistGtk
(
(
void
*
)
this
,
toplevel
,
"Ds
Hist"
,
&
w
,
oidv
,
anamev
,
return
new
Xtt
SevHistGtk
(
(
void
*
)
this
,
toplevel
,
"Sev
Hist"
,
&
w
,
oidv
,
anamev
,
sevcli
,
&
sts
);
}
...
...
@@ -344,8 +344,8 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid,
// Functions entry
GtkWidget
*
functions_open
dshist
=
gtk_menu_item_new_with_mnemonic
(
"_Open Ds
Hist"
);
g_signal_connect
(
functions_open
dshist
,
"activate"
,
G_CALLBACK
(
activate_opends
hist
),
this
);
GtkWidget
*
functions_open
sevhist
=
gtk_menu_item_new_with_mnemonic
(
"_Open Sev
Hist"
);
g_signal_connect
(
functions_open
sevhist
,
"activate"
,
G_CALLBACK
(
activate_opensev
hist
),
this
);
GtkWidget
*
functions_command
=
gtk_menu_item_new_with_mnemonic
(
CoWowGtk
::
translate_utf8
(
"Co_mmand"
));
g_signal_connect
(
functions_command
,
"activate"
,
...
...
@@ -358,7 +358,7 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid,
g_signal_connect
(
functions_delete_item
,
"activate"
,
G_CALLBACK
(
activate_delete_item
),
this
);
GtkMenu
*
functions_menu
=
(
GtkMenu
*
)
g_object_new
(
GTK_TYPE_MENU
,
NULL
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
functions_menu
),
functions_open
ds
hist
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
functions_menu
),
functions_open
sev
hist
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
functions_menu
),
functions_command
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
functions_menu
),
functions_delete_item
);
...
...
@@ -432,13 +432,13 @@ XttTblGtk::XttTblGtk( GtkWidget *a_parent_wid,
// Toolbar
GtkToolbar
*
tools
=
(
GtkToolbar
*
)
g_object_new
(
GTK_TYPE_TOOLBAR
,
NULL
);
GtkWidget
*
tools_open
ds
hist
=
gtk_button_new
();
GtkWidget
*
tools_open
sev
hist
=
gtk_button_new
();
dcli_translate_filename
(
fname
,
"$pwr_exe/xtt_meth_trend.png"
);
gtk_container_add
(
GTK_CONTAINER
(
tools_open
ds
hist
),
gtk_container_add
(
GTK_CONTAINER
(
tools_open
sev
hist
),
gtk_image_new_from_file
(
fname
));
g_signal_connect
(
tools_open
dshist
,
"clicked"
,
G_CALLBACK
(
activate_opends
hist
),
this
);
g_object_set
(
tools_open
ds
hist
,
"can-focus"
,
FALSE
,
NULL
);
gtk_toolbar_append_widget
(
tools
,
tools_open
ds
hist
,
CoWowGtk
::
translate_utf8
(
"Open hist item"
),
""
);
g_signal_connect
(
tools_open
sevhist
,
"clicked"
,
G_CALLBACK
(
activate_opensev
hist
),
this
);
g_object_set
(
tools_open
sev
hist
,
"can-focus"
,
FALSE
,
NULL
);
gtk_toolbar_append_widget
(
tools
,
tools_open
sev
hist
,
CoWowGtk
::
translate_utf8
(
"Open hist item"
),
""
);
GtkWidget
*
tools_zoom_in
=
gtk_button_new
();
dcli_translate_filename
(
fname
,
"$pwr_exe/xtt_zoom_in.png"
);
...
...
sev/exe/sev_xtt/gtk/xtt_tbl_gtk.h
View file @
9d007f29
/*
* Proview $Id: xtt_tbl_gtk.h,v 1.
2 2008-09-05 08:38:58
claes Exp $
* Proview $Id: xtt_tbl_gtk.h,v 1.
3 2008-09-18 14:37:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -49,7 +49,7 @@ class XttTblGtk : public XttTbl {
CoWowEntryGtk
*
cmd_entry
;
void
message
(
char
severity
,
char
*
message
);
Xtt
DsHist
*
ds
hist_new
(
pwr_tOid
oid
,
char
*
aname
);
Xtt
SevHist
*
sev
hist_new
(
pwr_tOid
oid
,
char
*
aname
);
CoLogin
*
login_new
(
char
*
wl_name
,
char
*
wl_groupname
,
void
(
*
wl_bc_success
)(
void
*
),
...
...
@@ -63,7 +63,7 @@ class XttTblGtk : public XttTbl {
static
void
activate_login
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_logout
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_close
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_open
ds
hist
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_open
sev
hist
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_delete_item
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_tree_layout
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_list_layout
(
GtkWidget
*
w
,
gpointer
data
);
...
...
sev/exe/sev_xtt/src/xtt_tbl.cpp
View file @
9d007f29
/*
* Proview $Id: xtt_tbl.cpp,v 1.
2 2008-09-05 08:38:58
claes Exp $
* Proview $Id: xtt_tbl.cpp,v 1.
3 2008-09-18 14:37:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -118,13 +118,16 @@ void XttTbl::activate_print()
system
(
cmd
);
}
void
XttTbl
::
activate_open
ds
hist
()
void
XttTbl
::
activate_open
sev
hist
()
{
sevcli_sHistItem
*
hi
;
tblnav
->
get_select
(
&
hi
);
if
(
!
tblnav
->
get_select
(
&
hi
))
{
message
(
'E'
,
"Select an storage item"
);
return
;
}
dshist_new
(
hi
->
oid
,
hi
->
aname
);
sevhist_new
(
hi
->
oid
,
hi
->
attr
[
0
].
aname
);
}
void
XttTbl
::
delete_item_yes
(
void
*
ctx
,
void
*
data
)
...
...
@@ -134,7 +137,7 @@ void XttTbl::delete_item_yes( void *ctx, void *data)
pwr_tStatus
sts
;
printf
(
"Deleting %s
\n
"
,
hi
->
oname
);
sevcli_delete_item
(
&
sts
,
tbl
->
sevcli
,
hi
->
oid
,
hi
->
aname
);
sevcli_delete_item
(
&
sts
,
tbl
->
sevcli
,
hi
->
oid
,
hi
->
a
ttr
[
0
].
a
name
);
if
(
EVEN
(
sts
))
{
tbl
->
message
(
'E'
,
"Delete error"
);
return
;
...
...
@@ -154,7 +157,7 @@ void XttTbl::activate_delete_item()
return
;
}
sprintf
(
msg
,
"Do you really wan't to delete all stored data for item
\n\n
%s.%s
\n
"
,
hi
->
oname
,
hi
->
aname
);
sprintf
(
msg
,
"Do you really wan't to delete all stored data for item
\n\n
%s.%s
\n
"
,
hi
->
oname
,
hi
->
a
ttr
[
0
].
a
name
);
wow
->
DisplayQuestion
(
this
,
"Confirm Delete Item"
,
msg
,
delete_item_yes
,
0
,
hi
);
}
...
...
sev/exe/sev_xtt/src/xtt_tbl.h
View file @
9d007f29
/*
* Proview $Id: xtt_tbl.h,v 1.
2 2008-09-05 08:38:58
claes Exp $
* Proview $Id: xtt_tbl.h,v 1.
3 2008-09-18 14:37:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -31,7 +31,7 @@
class
TblNav
;
class
Xtt
Ds
Hist
;
class
Xtt
Sev
Hist
;
class
CoLogin
;
class
CoWow
;
...
...
@@ -55,7 +55,7 @@ class XttTbl {
int
quiet
;
virtual
void
message
(
char
severity
,
char
*
message
)
{}
virtual
Xtt
DsHist
*
ds
hist_new
(
pwr_tOid
oid
,
char
*
aname
)
{
return
0
;}
virtual
Xtt
SevHist
*
sev
hist_new
(
pwr_tOid
oid
,
char
*
aname
)
{
return
0
;}
virtual
CoLogin
*
login_new
(
char
*
wl_name
,
char
*
wl_groupname
,
void
(
*
wl_bc_success
)(
void
*
),
...
...
@@ -67,7 +67,7 @@ class XttTbl {
void
open_login
();
void
logout
();
void
activate_print
();
void
activate_open
ds
hist
();
void
activate_open
sev
hist
();
void
activate_delete_item
();
void
activate_zoom_in
();
void
activate_zoom_out
();
...
...
sev/exe/sev_xtt/src/xtt_tblnav.cpp
View file @
9d007f29
/*
* Proview $Id: xtt_tblnav.cpp,v 1.
2 2008-09-05 08:38:58
claes Exp $
* Proview $Id: xtt_tblnav.cpp,v 1.
3 2008-09-18 14:37:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -25,6 +25,8 @@
#include <stdlib.h>
#include <vector.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_dcli.h"
...
...
@@ -585,7 +587,7 @@ void TblNav::delete_item( sevcli_sHistItem *hi)
continue
;
if
(
tree
[
i
].
item
&&
cdh_ObjidIsEqual
(
tree
[
i
].
item
->
oid
,
hi
->
oid
)
&&
strcmp
(
tree
[
i
].
item
->
a
name
,
hi
->
aname
)
==
0
)
{
strcmp
(
tree
[
i
].
item
->
a
ttr
[
0
].
aname
,
hi
->
attr
[
0
].
aname
)
==
0
)
{
tree
[
i
].
deleted
=
1
;
}
}
...
...
@@ -601,7 +603,7 @@ void TblNav::delete_item( sevcli_sHistItem *hi)
case
tblnav_eItemType_TreeLocal
:
{
ItemLocal
*
item
=
(
ItemLocal
*
)
baseitem
;
if
(
cdh_ObjidIsEqual
(
hi
->
oid
,
item
->
item
.
oid
)
&&
strcmp
(
hi
->
a
name
,
item
->
item
.
aname
)
==
0
)
{
strcmp
(
hi
->
a
ttr
[
0
].
aname
,
item
->
item
.
attr
[
0
]
.
aname
)
==
0
)
{
brow_DeleteNode
(
brow
->
ctx
,
item
->
node
);
found
=
1
;
}
...
...
@@ -628,7 +630,7 @@ ItemLocal::ItemLocal( TblNav *tblnav, sevcli_sHistItem *xitem,
strcpy
(
aname
,
item
.
oname
);
strcat
(
aname
,
"."
);
strcat
(
aname
,
item
.
aname
);
strcat
(
aname
,
item
.
a
ttr
[
0
].
a
name
);
brow_SetAnnotation
(
node
,
0
,
aname
,
strlen
(
aname
));
brow_SetAnnotation
(
node
,
1
,
item
.
description
,
strlen
(
item
.
description
));
}
...
...
@@ -650,6 +652,7 @@ int ItemLocal::open_attributes( TblNav *tblnav, double x, double y)
}
else
{
char
value
[
256
];
char
txt
[
80
];
brow_SetNodraw
(
tblnav
->
brow
->
ctx
);
...
...
@@ -662,39 +665,64 @@ int ItemLocal::open_attributes( TblNav *tblnav, double x, double y)
new
ItemLocalAttr
(
tblnav
,
"Object"
,
item
.
oname
,
node
,
flow_eDest_IntoLast
);
new
ItemLocalAttr
(
tblnav
,
"Attribute"
,
item
.
aname
,
node
,
flow_eDest_IntoLast
);
time_DtoAscii
(
&
item
.
storagetime
,
0
,
value
,
sizeof
(
value
));
new
ItemLocalAttr
(
tblnav
,
"StorageTime"
,
value
,
node
,
flow_eDest_IntoLast
);
switch
(
item
.
type
)
{
case
pwr_eType_Int64
:
strcpy
(
value
,
"Int64"
);
break
;
case
pwr_eType_Int32
:
strcpy
(
value
,
"Int32"
);
break
;
case
pwr_eType_Int16
:
strcpy
(
value
,
"Int16"
);
break
;
case
pwr_eType_Int8
:
strcpy
(
value
,
"Int8"
);
break
;
case
pwr_eType_UInt64
:
strcpy
(
value
,
"UInt64"
);
break
;
case
pwr_eType_UInt32
:
strcpy
(
value
,
"UInt32"
);
break
;
case
pwr_eType_UInt16
:
strcpy
(
value
,
"UInt16"
);
break
;
case
pwr_eType_UInt8
:
strcpy
(
value
,
"UInt8"
);
break
;
case
pwr_eType_Boolean
:
strcpy
(
value
,
"Boolean"
);
break
;
case
pwr_eType_Char
:
strcpy
(
value
,
"Char"
);
break
;
case
pwr_eType_Float32
:
strcpy
(
value
,
"Float32"
);
break
;
case
pwr_eType_Float64
:
strcpy
(
value
,
"Float64"
);
break
;
case
pwr_eType_String
:
strcpy
(
value
,
"String"
);
break
;
case
pwr_eType_Time
:
strcpy
(
value
,
"Time"
);
break
;
case
pwr_eType_DeltaTime
:
strcpy
(
value
,
"DeltaTime"
);
break
;
default:
strcpy
(
value
,
"Unknown"
);
}
new
ItemLocalAttr
(
tblnav
,
"DataType"
,
value
,
node
,
flow_eDest_IntoLast
);
time_AtoAscii
(
&
item
.
creatime
,
time_eFormat_DateAndTime
,
value
,
sizeof
(
value
));
new
ItemLocalAttr
(
tblnav
,
"CreationTime"
,
value
,
node
,
flow_eDest_IntoLast
);
sprintf
(
value
,
"%d"
,
item
.
size
);
new
ItemLocalAttr
(
tblnav
,
"DataSize"
,
value
,
node
,
flow_eDest_IntoLast
);
new
ItemLocalAttr
(
tblnav
,
"Unit"
,
item
.
unit
,
node
,
flow_eDest_IntoLast
);
time_AtoAscii
(
&
item
.
modtime
,
time_eFormat_DateAndTime
,
value
,
sizeof
(
value
));
new
ItemLocalAttr
(
tblnav
,
"ModificationTime"
,
value
,
node
,
flow_eDest_IntoLast
);
sprintf
(
value
,
"%f"
,
item
.
scantime
);
new
ItemLocalAttr
(
tblnav
,
"ScanTime"
,
value
,
node
,
flow_eDest_IntoLast
);
strcpy
(
value
,
""
);
if
(
item
.
options
&
pwr_mSevOptionsMask_PosixTime
)
strcat
(
value
,
" PosixTime"
);
if
(
item
.
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
strcat
(
value
,
" HighTimeResolution"
);
if
(
item
.
options
&
pwr_mSevOptionsMask_ReadOptimized
)
strcat
(
value
,
" ReadOptimized"
);
if
(
item
.
options
&
pwr_mSevOptionsMask_UseDeadBand
)
strcat
(
value
,
" UseDeadBand"
);
new
ItemLocalAttr
(
tblnav
,
"Options"
,
value
,
node
,
flow_eDest_IntoLast
);
sprintf
(
value
,
"%f"
,
item
.
deadband
);
new
ItemLocalAttr
(
tblnav
,
"Deadband"
,
value
,
node
,
flow_eDest_IntoLast
);
for
(
int
i
=
0
;
i
<
1
;
i
++
)
{
sprintf
(
txt
,
"Attr[%d].Name"
,
i
);
new
ItemLocalAttr
(
tblnav
,
txt
,
item
.
attr
[
0
].
aname
,
node
,
flow_eDest_IntoLast
);
switch
(
item
.
attr
[
0
].
type
)
{
case
pwr_eType_Int64
:
strcpy
(
value
,
"Int64"
);
break
;
case
pwr_eType_Int32
:
strcpy
(
value
,
"Int32"
);
break
;
case
pwr_eType_Int16
:
strcpy
(
value
,
"Int16"
);
break
;
case
pwr_eType_Int8
:
strcpy
(
value
,
"Int8"
);
break
;
case
pwr_eType_UInt64
:
strcpy
(
value
,
"UInt64"
);
break
;
case
pwr_eType_UInt32
:
strcpy
(
value
,
"UInt32"
);
break
;
case
pwr_eType_UInt16
:
strcpy
(
value
,
"UInt16"
);
break
;
case
pwr_eType_UInt8
:
strcpy
(
value
,
"UInt8"
);
break
;
case
pwr_eType_Boolean
:
strcpy
(
value
,
"Boolean"
);
break
;
case
pwr_eType_Char
:
strcpy
(
value
,
"Char"
);
break
;
case
pwr_eType_Float32
:
strcpy
(
value
,
"Float32"
);
break
;
case
pwr_eType_Float64
:
strcpy
(
value
,
"Float64"
);
break
;
case
pwr_eType_String
:
strcpy
(
value
,
"String"
);
break
;
case
pwr_eType_Time
:
strcpy
(
value
,
"Time"
);
break
;
case
pwr_eType_DeltaTime
:
strcpy
(
value
,
"DeltaTime"
);
break
;
default:
strcpy
(
value
,
"Unknown"
);
}
sprintf
(
txt
,
"Attr[%d].DataType"
,
i
);
new
ItemLocalAttr
(
tblnav
,
txt
,
value
,
node
,
flow_eDest_IntoLast
);
sprintf
(
txt
,
"Attr[%d].DataSize"
,
i
);
sprintf
(
value
,
"%d"
,
item
.
attr
[
0
].
size
);
new
ItemLocalAttr
(
tblnav
,
txt
,
value
,
node
,
flow_eDest_IntoLast
);
sprintf
(
txt
,
"Attr[%d].Unit"
,
i
);
new
ItemLocalAttr
(
tblnav
,
txt
,
item
.
attr
[
0
].
unit
,
node
,
flow_eDest_IntoLast
);
}
brow_SetOpen
(
node
,
tblnav_mOpen_Attributes
);
brow_ResetNodraw
(
tblnav
->
brow
->
ctx
);
brow_Redraw
(
tblnav
->
brow
->
ctx
,
node_y
);
...
...
@@ -747,7 +775,7 @@ ItemTreeLocal::ItemTreeLocal( TblNav *tblnav, sevcli_sHistItem *xitem, int index
else
strcpy
(
aname
,
item
.
oname
);
strcat
(
aname
,
"."
);
strcat
(
aname
,
item
.
aname
);
strcat
(
aname
,
item
.
a
ttr
[
0
].
a
name
);
brow_SetAnnotation
(
node
,
0
,
aname
,
strlen
(
aname
));
}
...
...
@@ -828,7 +856,7 @@ void TblNav::build_tree()
strcpy
(
aname
,
itemlist
[
i
].
oname
);
strcat
(
aname
,
"."
);
strcat
(
aname
,
itemlist
[
i
].
aname
);
strcat
(
aname
,
itemlist
[
i
].
a
ttr
[
0
].
a
name
);
seg
=
dcli_parse
(
aname
,
"-"
,
""
,
(
char
*
)
name_array
,
sizeof
(
name_array
)
/
sizeof
(
name_array
[
0
]),
...
...
sev/lib/sev/src/sev_db.h
View file @
9d007f29
/*
* Proview $Id: sev_db.h,v 1.
2 2008-09-05 08:38:58
claes Exp $
* Proview $Id: sev_db.h,v 1.
3 2008-09-18 14:37:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -26,23 +26,37 @@
#include "pwr_class.h"
class
sev_attr
{
public:
pwr_tOName
aname
;
pwr_eType
type
;
unsigned
int
size
;
unsigned
int
elem
;
pwr_tString16
unit
;
};
class
sev_item
{
public:
sev_item
()
:
deleted
(
0
)
{}
sev_item
()
:
deadband_active
(
0
),
last_id
(
0
),
first_storage
(
1
),
deleted
(
0
)
{
memset
(
old_value
,
0
,
sizeof
(
old_value
));}
unsigned
int
id
;
char
tablename
[
256
];
pwr_tOid
oid
;
pwr_tOName
aname
;
pwr_tOName
oname
;
pwr_tTime
cretime
;
pwr_tTime
up
time
;
pwr_tTime
cre
a
time
;
pwr_tTime
mod
time
;
pwr_tDeltaTime
storagetime
;
pwr_eType
vtype
;
unsigned
int
vsize
;
pwr_tRefId
sevid
;
pwr_tString80
description
;
pwr_tString16
unit
;
pwr_tFloat32
scantime
;
pwr_tFloat32
deadband
;
pwr_tMask
options
;
int
deadband_active
;
unsigned
int
last_id
;
char
old_value
[
8
];
int
first_storage
;
unsigned
int
attrnum
;
sev_attr
attr
[
1
];
int
deleted
;
};
...
...
@@ -55,21 +69,24 @@ class sev_db {
virtual
~
sev_db
()
{}
virtual
int
check_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
oname
,
char
*
aname
,
pwr_tDeltaTime
storatetime
,
pwr_eType
type
,
unsigned
int
size
,
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
unsigned
int
*
idx
)
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
deadband
,
pwr_tMask
options
,
unsigned
int
*
idx
)
{
return
0
;}
virtual
int
add_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
oname
,
char
*
aname
,
pwr_tDeltaTime
storagetime
,
pwr_eType
type
,
unsigned
int
size
,
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
unsigned
int
*
idx
)
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
deadband
,
pwr_tMask
options
,
unsigned
int
*
idx
)
{
return
0
;}
virtual
int
delete_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
)
{
return
0
;}
virtual
int
store_value
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_eType
type
,
virtual
int
store_value
(
pwr_tStatus
*
sts
,
int
item_idx
,
int
attr_idx
,
pwr_tTime
time
,
void
*
buf
,
unsigned
int
size
)
{
return
0
;}
virtual
int
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_eType
type
,
virtual
int
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
)
{
return
0
;}
virtual
int
get_items
(
pwr_tStatus
*
sts
)
{
return
0
;}
virtual
int
delete_old_data
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_tTime
limit
)
{
return
0
;}
pwr_t
Mask
options
,
pwr_t
Time
limit
)
{
return
0
;}
};
#endif
sev/lib/sev/src/sev_dbms.cpp
View file @
9d007f29
/*
* Proview $Id: sev_dbms.cpp,v 1.
2 2008-09-05 08:38:58
claes Exp $
* Proview $Id: sev_dbms.cpp,v 1.
3 2008-09-18 14:37:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -17,13 +17,17 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#if defined PWRE_CONF_MYSQL
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <math.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "co_syi.h"
#include "co_cdh.h"
#include "co_dcli.h"
...
...
@@ -246,11 +250,13 @@ MYSQL *sev_dbms_env::createDb(void)
"uptime datetime,"
"cretime datetime,"
"storagetime int unsigned,"
"deadband float,"
"options int unsigned,"
"scantime float,"
"description varchar(80),"
"vtype int unsigned,"
"vsize int unsigned,"
"description varchar(80),"
"unit varchar(16),"
"scantime float);"
);
"unit varchar(16));"
);
rc
=
mysql_query
(
m_con
,
query
);
if
(
rc
)
printf
(
"Create items table: %s
\n
"
,
mysql_error
(
m_con
));
...
...
@@ -429,13 +435,52 @@ int sev_dbms_env::get_systemname()
}
int
sev_dbms
::
create_table
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
)
unsigned
int
size
,
pwr_tMask
options
,
float
deadband
)
{
char
query
[
200
];
char
timeformatstr
[
80
];
char
jumpstr
[
80
];
char
idtypestr
[
20
];
char
readoptstr
[
80
];
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
{
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
// Posix time, high resolution
strcpy
(
timeformatstr
,
"time int unsigned, ntime int unsigned"
);
strcpy
(
idtypestr
,
"bigint"
);
}
else
{
// Posix time, low resolution
strcpy
(
timeformatstr
,
"time int unsigned"
);
strcpy
(
idtypestr
,
"int"
);
}
}
else
{
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
// Sql time, high resolution
strcpy
(
timeformatstr
,
"time datetime not null, ntime int unsigned"
);
strcpy
(
idtypestr
,
"bigint"
);
}
else
{
// Sql time, low resolution
strcpy
(
timeformatstr
,
"time datetime not null"
);
strcpy
(
idtypestr
,
"int"
);
}
}
if
(
options
&
pwr_mSevOptionsMask_ReadOptimized
)
sprintf
(
readoptstr
,
"id %s unsigned not null primary key auto_increment,"
,
idtypestr
);
else
strcpy
(
readoptstr
,
""
);
if
(
options
&
pwr_mSevOptionsMask_UseDeadBand
)
strcpy
(
jumpstr
,
",jump tinyint unsigned"
);
else
strcpy
(
jumpstr
,
""
);
sprintf
(
query
,
"create table %s (
id int unsigned not null primary key auto_increment,
"
"
time datetime not null, value %s);"
,
oid_to_table
(
oid
,
aname
),
pwrtype_to_type
(
type
,
size
)
);
sprintf
(
query
,
"create table %s (
%s
"
"
%s, value %s %s);"
,
oid_to_table
(
oid
,
aname
),
readoptstr
,
timeformatstr
,
pwrtype_to_type
(
type
,
size
),
jumpstr
);
int
rc
=
mysql_query
(
m_env
->
con
(),
query
);
if
(
rc
)
{
...
...
@@ -464,20 +509,21 @@ int sev_dbms::delete_table( pwr_tStatus *sts, pwr_tOid oid, char *aname)
int
sev_dbms
::
store_item
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tOid
oid
,
char
*
oname
,
char
*
aname
,
pwr_tDeltaTime
storagetime
,
pwr_eType
vtype
,
unsigned
int
vsize
,
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
)
unsigned
int
vsize
,
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
deadband
,
pwr_tMask
options
)
{
char
query
[
800
];
char
timestr
[
40
];
pwr_tTime
cretime
;
pwr_tTime
cre
a
time
;
clock_gettime
(
CLOCK_REALTIME
,
&
cretime
);
time_AtoAscii
(
&
cretime
,
time_eFormat_NumDateAndTime
,
timestr
,
sizeof
(
timestr
));
clock_gettime
(
CLOCK_REALTIME
,
&
cre
a
time
);
time_AtoAscii
(
&
cre
a
time
,
time_eFormat_NumDateAndTime
,
timestr
,
sizeof
(
timestr
));
timestr
[
19
]
=
0
;
sprintf
(
query
,
"insert into items (id,tablename,vid,oix,oname,aname,uptime,cretime,storagetime,vtype,vsize,description,unit,scantime) "
"values (0,'%s',%d,%d,'%s','%s','%s','%s',%d,%d,%d,'%s','%s',%f);"
,
sprintf
(
query
,
"insert into items (id,tablename,vid,oix,oname,aname,uptime,cretime,storagetime,vtype,vsize,description,unit,scantime
,deadband,options
) "
"values (0,'%s',%d,%d,'%s','%s','%s','%s',%d,%d,%d,'%s','%s',%f
,%f,%d
);"
,
tablename
,
oid
.
vid
,
oid
.
oix
,
oname
,
aname
,
timestr
,
timestr
,
storagetime
.
tv_sec
,
vtype
,
vsize
,
description
,
unit
,
scantime
);
vsize
,
description
,
unit
,
scantime
,
deadband
,
options
);
int
rc
=
mysql_query
(
m_env
->
con
(),
query
);
if
(
rc
)
{
printf
(
"Store item: %s
\n
"
,
mysql_error
(
m_env
->
con
()));
...
...
@@ -511,7 +557,7 @@ int sev_dbms::get_items( pwr_tStatus *sts)
m_items
.
clear
();
char
query
[
300
];
sprintf
(
query
,
"select id,tablename,vid,oix,oname,aname,uptime,cretime,storagetime,vtype,vsize,description,unit,scantime "
sprintf
(
query
,
"select id,tablename,vid,oix,oname,aname,uptime,cretime,storagetime,vtype,vsize,description,unit,scantime
,deadband,options
"
"from items"
);
int
rc
=
mysql_query
(
m_env
->
con
(),
query
);
...
...
@@ -543,16 +589,18 @@ int sev_dbms::get_items( pwr_tStatus *sts)
item
.
oid
.
vid
=
strtoul
(
row
[
2
],
0
,
10
);
item
.
oid
.
oix
=
strtoul
(
row
[
3
],
0
,
10
);
strncpy
(
item
.
oname
,
row
[
4
],
sizeof
(
item
.
oname
));
strncpy
(
item
.
a
name
,
row
[
5
],
sizeof
(
item
.
aname
));
timestr_to_time
(
row
[
6
],
&
item
.
up
time
);
timestr_to_time
(
row
[
7
],
&
item
.
cretime
);
strncpy
(
item
.
a
ttr
[
0
].
aname
,
row
[
5
],
sizeof
(
item
.
attr
[
0
]
.
aname
));
timestr_to_time
(
row
[
6
],
&
item
.
mod
time
);
timestr_to_time
(
row
[
7
],
&
item
.
cre
a
time
);
item
.
storagetime
.
tv_sec
=
strtoul
(
row
[
8
],
0
,
10
);
item
.
storagetime
.
tv_nsec
=
0
;
item
.
v
type
=
(
pwr_eType
)
strtoul
(
row
[
9
],
0
,
10
);
item
.
v
size
=
strtoul
(
row
[
10
],
0
,
10
);
item
.
attr
[
0
].
type
=
(
pwr_eType
)
strtoul
(
row
[
9
],
0
,
10
);
item
.
attr
[
0
].
size
=
strtoul
(
row
[
10
],
0
,
10
);
strncpy
(
item
.
description
,
row
[
11
],
sizeof
(
item
.
description
));
strncpy
(
item
.
unit
,
row
[
12
],
sizeof
(
item
.
unit
));
strncpy
(
item
.
attr
[
0
].
unit
,
row
[
12
],
sizeof
(
item
.
attr
[
0
]
.
unit
));
item
.
scantime
=
atof
(
row
[
13
]);
item
.
deadband
=
atof
(
row
[
14
]);
item
.
options
=
strtoul
(
row
[
15
],
0
,
10
);
m_items
.
push_back
(
item
);
}
...
...
@@ -565,40 +613,277 @@ int sev_dbms::get_items( pwr_tStatus *sts)
return
1
;
}
int
sev_dbms
::
store_value
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_
eType
type
,
pwr_
tTime
time
,
void
*
buf
,
unsigned
int
size
)
int
sev_dbms
::
store_value
(
pwr_tStatus
*
sts
,
int
item_idx
,
int
attr_idx
,
pwr_tTime
time
,
void
*
buf
,
unsigned
int
size
)
{
char
query
[
200
];
char
bufstr
[
512
];
char
timstr
[
40
];
int
update_time_only
=
0
;
int
set_jump
=
0
;
if
(
!
m_items
[
item_idx
].
first_storage
)
{
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_UseDeadBand
)
{
if
(
m_items
[
item_idx
].
deadband_active
)
{
// Compare current value to old value
switch
(
m_items
[
item_idx
].
attr
[
attr_idx
].
type
)
{
case
pwr_eType_Float32
:
if
(
fabsf
(
*
(
pwr_tFloat32
*
)
buf
-
*
(
pwr_tFloat32
*
)
m_items
[
item_idx
].
old_value
)
<
m_items
[
item_idx
].
deadband
)
{
update_time_only
=
1
;
}
else
{
m_items
[
item_idx
].
deadband_active
=
0
;
*
(
pwr_tFloat32
*
)
m_items
[
item_idx
].
old_value
=
*
(
pwr_tFloat32
*
)
buf
;
}
break
;
case
pwr_eType_Float64
:
if
(
fabsf
(
*
(
pwr_tFloat64
*
)
buf
-
*
(
pwr_tFloat64
*
)
m_items
[
item_idx
].
old_value
)
<
m_items
[
item_idx
].
deadband
)
{
update_time_only
=
1
;
}
else
{
m_items
[
item_idx
].
deadband_active
=
0
;
*
(
pwr_tFloat64
*
)
m_items
[
item_idx
].
old_value
=
*
(
pwr_tFloat64
*
)
buf
;
}
break
;
case
pwr_eType_Int64
:
if
(
fabsf
(
*
(
pwr_tInt64
*
)
buf
-
*
(
pwr_tInt64
*
)
m_items
[
item_idx
].
old_value
)
<
m_items
[
item_idx
].
deadband
)
{
update_time_only
=
1
;
}
else
{
m_items
[
item_idx
].
deadband_active
=
0
;
*
(
pwr_tInt64
*
)
m_items
[
item_idx
].
old_value
=
*
(
pwr_tInt64
*
)
buf
;
}
break
;
case
pwr_eType_Int32
:
if
(
fabsf
(
*
(
pwr_tInt32
*
)
buf
-
*
(
pwr_tInt32
*
)
m_items
[
item_idx
].
old_value
)
<
m_items
[
item_idx
].
deadband
)
{
update_time_only
=
1
;
}
else
{
m_items
[
item_idx
].
deadband_active
=
0
;
*
(
pwr_tInt32
*
)
m_items
[
item_idx
].
old_value
=
*
(
pwr_tInt32
*
)
buf
;
}
break
;
case
pwr_eType_Int16
:
if
(
fabsf
(
*
(
pwr_tInt16
*
)
buf
-
*
(
pwr_tInt16
*
)
m_items
[
item_idx
].
old_value
)
<
m_items
[
item_idx
].
deadband
)
{
update_time_only
=
1
;
}
else
{
m_items
[
item_idx
].
deadband_active
=
0
;
*
(
pwr_tInt16
*
)
m_items
[
item_idx
].
old_value
=
*
(
pwr_tInt16
*
)
buf
;
}
break
;
case
pwr_eType_Int8
:
case
pwr_eType_Char
:
if
(
fabsf
(
*
(
pwr_tInt8
*
)
buf
-
*
(
pwr_tInt8
*
)
m_items
[
item_idx
].
old_value
)
<
m_items
[
item_idx
].
deadband
)
{
update_time_only
=
1
;
}
else
{
m_items
[
item_idx
].
deadband_active
=
0
;
*
(
pwr_tInt8
*
)
m_items
[
item_idx
].
old_value
=
*
(
pwr_tInt8
*
)
buf
;
}
break
;
case
pwr_eType_UInt64
:
if
(
fabsf
(
*
(
pwr_tUInt64
*
)
buf
-
*
(
pwr_tUInt64
*
)
m_items
[
item_idx
].
old_value
)
<
m_items
[
item_idx
].
deadband
)
{
update_time_only
=
1
;
}
else
{
m_items
[
item_idx
].
deadband_active
=
0
;
*
(
pwr_tUInt64
*
)
m_items
[
item_idx
].
old_value
=
*
(
pwr_tUInt64
*
)
buf
;
}
break
;
case
pwr_eType_UInt32
:
case
pwr_eType_Boolean
:
if
(
fabsf
(
*
(
pwr_tUInt32
*
)
buf
-
*
(
pwr_tUInt32
*
)
m_items
[
item_idx
].
old_value
)
<
m_items
[
item_idx
].
deadband
)
{
update_time_only
=
1
;
}
else
{
m_items
[
item_idx
].
deadband_active
=
0
;
*
(
pwr_tUInt32
*
)
m_items
[
item_idx
].
old_value
=
*
(
pwr_tUInt32
*
)
buf
;
}
break
;
case
pwr_eType_UInt16
:
if
(
fabsf
(
*
(
pwr_tUInt16
*
)
buf
-
*
(
pwr_tUInt16
*
)
m_items
[
item_idx
].
old_value
)
<
m_items
[
item_idx
].
deadband
)
{
update_time_only
=
1
;
}
else
{
m_items
[
item_idx
].
deadband_active
=
0
;
*
(
pwr_tUInt16
*
)
m_items
[
item_idx
].
old_value
=
*
(
pwr_tUInt16
*
)
buf
;
}
break
;
case
pwr_eType_UInt8
:
if
(
fabsf
(
*
(
pwr_tUInt8
*
)
buf
-
*
(
pwr_tUInt8
*
)
m_items
[
item_idx
].
old_value
)
<
m_items
[
item_idx
].
deadband
)
{
update_time_only
=
1
;
}
else
{
m_items
[
item_idx
].
deadband_active
=
0
;
*
(
pwr_tUInt8
*
)
m_items
[
item_idx
].
old_value
=
*
(
pwr_tUInt8
*
)
buf
;
}
break
;
default:
;
}
}
else
{
// Compare current value to old value
switch
(
m_items
[
item_idx
].
attr
[
attr_idx
].
type
)
{
case
pwr_eType_Float32
:
if
(
fabsf
(
*
(
pwr_tFloat32
*
)
buf
-
*
(
pwr_tFloat32
*
)
m_items
[
item_idx
].
old_value
)
<
m_items
[
item_idx
].
deadband
)
{
m_items
[
item_idx
].
deadband_active
=
1
;
set_jump
=
1
;
}
*
(
pwr_tFloat32
*
)
m_items
[
item_idx
].
old_value
=
*
(
pwr_tFloat32
*
)
buf
;
break
;
default:
;
}
}
}
if
(
set_jump
&&
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_UseDeadBand
))
{
sprintf
(
query
,
"update %s set jump = 1 where id = %d"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
m_items
[
item_idx
].
last_id
);
int
rc
=
mysql_query
(
m_env
->
con
(),
query
);
if
(
rc
)
printf
(
"Update jump: %s
\n
"
,
mysql_error
(
m_env
->
con
()));
}
}
else
m_items
[
item_idx
].
first_storage
=
0
;
*
sts
=
time_AtoAscii
(
&
time
,
time_eFormat_NumDateAndTime
,
timstr
,
sizeof
(
timstr
));
if
(
EVEN
(
*
sts
))
return
0
;
timstr
[
19
]
=
0
;
*
sts
=
cdh_AttrValueToString
(
type
,
buf
,
bufstr
,
sizeof
(
bufstr
));
*
sts
=
cdh_AttrValueToString
(
m_items
[
item_idx
].
attr
[
attr_idx
].
type
,
buf
,
bufstr
,
sizeof
(
bufstr
));
if
(
EVEN
(
*
sts
))
return
0
;
switch
(
type
)
{
case
pwr_eType_String
:
sprintf
(
query
,
"insert into %s (time, value) values ('%s','%s')"
,
oid_to_table
(
oid
,
aname
),
timstr
,
bufstr
);
break
;
default:
sprintf
(
query
,
"insert into %s (time, value) values ('%s',%s)"
,
oid_to_table
(
oid
,
aname
),
timstr
,
bufstr
);
if
(
!
update_time_only
)
{
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_PosixTime
)
{
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
// Posix time, high resolution
switch
(
m_items
[
item_idx
].
attr
[
attr_idx
].
type
)
{
case
pwr_eType_String
:
sprintf
(
query
,
"insert into %s (time, ntime, value) values (%lu,%lu,'%s')"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
time
.
tv_sec
,
time
.
tv_nsec
,
bufstr
);
break
;
default:
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_UseDeadBand
)
sprintf
(
query
,
"insert into %s (time, ntime, value, jump) values (%lu,%lu,%s,%d)"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
time
.
tv_sec
,
time
.
tv_nsec
,
bufstr
,
set_jump
);
else
sprintf
(
query
,
"insert into %s (time, ntime, value) values (%lu,%lu,%s)"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
time
.
tv_sec
,
time
.
tv_nsec
,
bufstr
);
}
}
else
{
// Posix time, low resolution
switch
(
m_items
[
item_idx
].
attr
[
attr_idx
].
type
)
{
case
pwr_eType_String
:
sprintf
(
query
,
"insert into %s (time, value) values (%lu,'%s')"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
time
.
tv_sec
,
bufstr
);
break
;
default:
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_UseDeadBand
)
sprintf
(
query
,
"insert into %s (time, value, jump) values (%lu,%s,%d)"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
time
.
tv_sec
,
bufstr
,
set_jump
);
else
sprintf
(
query
,
"insert into %s (time, value) values (%lu,%s)"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
time
.
tv_sec
,
bufstr
);
}
}
}
else
{
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
// Sql time, high resolution
switch
(
m_items
[
item_idx
].
attr
[
attr_idx
].
type
)
{
case
pwr_eType_String
:
sprintf
(
query
,
"insert into %s (time, ntime, value) values ('%s',%lu,'%s')"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
timstr
,
time
.
tv_nsec
,
bufstr
);
break
;
default:
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_UseDeadBand
)
sprintf
(
query
,
"insert into %s (time, ntime, value, jump) values ('%s',%lu,%s,%d)"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
timstr
,
time
.
tv_nsec
,
bufstr
,
set_jump
);
else
sprintf
(
query
,
"insert into %s (time, ntime, value) values ('%s',%lu,%s)"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
timstr
,
time
.
tv_nsec
,
bufstr
);
}
}
else
{
// Sql time, low resolution
switch
(
m_items
[
item_idx
].
attr
[
attr_idx
].
type
)
{
case
pwr_eType_String
:
sprintf
(
query
,
"insert into %s (time, value) values ('%s','%s')"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
timstr
,
bufstr
);
break
;
default:
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_UseDeadBand
)
sprintf
(
query
,
"insert into %s (time, value, jump) values ('%s',%s,%d)"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
timstr
,
bufstr
,
set_jump
);
else
sprintf
(
query
,
"insert into %s (time, value) values ('%s',%s)"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
timstr
,
bufstr
);
}
}
}
int
rc
=
mysql_query
(
m_env
->
con
(),
query
);
if
(
rc
)
{
printf
(
"Store value: %s
\n
"
,
mysql_error
(
m_env
->
con
()));
*
sts
=
SEV__DBERROR
;
return
0
;
}
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_ReadOptimized
)
m_items
[
item_idx
].
last_id
=
mysql_insert_id
(
m_env
->
con
());
}
int
rc
=
mysql_query
(
m_env
->
con
(),
query
);
if
(
rc
)
{
printf
(
"Store value: %s
\n
"
,
mysql_error
(
m_env
->
con
()));
*
sts
=
SEV__DBERROR
;
return
0
;
else
{
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_PosixTime
)
{
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
// Posix time, high resolution
sprintf
(
query
,
"update %s set time = %lu, ntime = %lu where id = %d"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
time
.
tv_sec
,
time
.
tv_nsec
,
m_items
[
item_idx
].
last_id
);
}
else
{
// Posix time, low resolution
sprintf
(
query
,
"update %s set time = %lu where id = %d"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
time
.
tv_sec
,
m_items
[
item_idx
].
last_id
);
}
}
else
{
if
(
m_items
[
item_idx
].
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
// Sql time, high resolution
sprintf
(
query
,
"update %s set time = '%s', ntime = %lu where id = %d"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
timstr
,
time
.
tv_nsec
,
m_items
[
item_idx
].
last_id
);
}
else
{
// Sql time, low resolution
sprintf
(
query
,
"update %s set time = '%s' where id = %d"
,
oid_to_table
(
m_items
[
item_idx
].
oid
,
m_items
[
item_idx
].
attr
[
attr_idx
].
aname
),
timstr
,
m_items
[
item_idx
].
last_id
);
}
}
int
rc
=
mysql_query
(
m_env
->
con
(),
query
);
if
(
rc
)
{
printf
(
"Update value: %s
\n
"
,
mysql_error
(
m_env
->
con
()));
*
sts
=
SEV__DBERROR
;
return
0
;
}
}
*
sts
=
SEV__SUCCESS
;
return
1
;
}
int
sev_dbms
::
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_eType
type
,
int
sev_dbms
::
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
)
...
...
@@ -610,6 +895,10 @@ int sev_dbms::get_values( pwr_tStatus *sts, pwr_tOid oid, char *aname, pwr_eType
int
div
;
pwr_tDeltaTime
dt
;
pwr_tTime
stime
,
etime
;
char
column_part
[
80
];
char
orderby_part
[
80
];
char
jumpstr
[
40
];
char
where_part
[
200
];
if
(
starttime
&&
starttime
->
tv_sec
==
0
&&
starttime
->
tv_nsec
==
0
)
starttime
=
0
;
...
...
@@ -707,45 +996,114 @@ int sev_dbms::get_values( pwr_tStatus *sts, pwr_tOid oid, char *aname, pwr_eType
endtimstr
[
19
]
=
0
;
}
if
(
starttime
&&
endtime
)
{
if
(
div
==
1
)
sprintf
(
query
,
"select time, value from %s where time >= '%s' and time <= '%s' order by time"
,
oid_to_table
(
oid
,
aname
),
starttimstr
,
endtimstr
);
else
sprintf
(
query
,
"select time, value from %s where id %% %d = 0 and time >= '%s' and time <= '%s' order by time"
,
oid_to_table
(
oid
,
aname
),
div
,
starttimstr
,
endtimstr
);
}
else
if
(
starttime
)
{
if
(
div
==
1
)
sprintf
(
query
,
"select time, value from %s where time >= '%s' order by time"
,
oid_to_table
(
oid
,
aname
),
starttimstr
);
// Column part
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
strcpy
(
column_part
,
"time,ntime,value"
);
else
strcpy
(
column_part
,
"time,value"
);
if
(
options
&
pwr_mSevOptionsMask_UseDeadBand
)
strcpy
(
jumpstr
,
"or jump = 1"
);
else
strcpy
(
jumpstr
,
""
);
// 'order by' part
if
(
options
&
pwr_mSevOptionsMask_ReadOptimized
)
strcpy
(
orderby_part
,
"id"
);
else
{
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
strcpy
(
orderby_part
,
"time,ntime"
);
else
sprintf
(
query
,
"select time, value from %s where id %% %d = 0 and time >= '%s' order by time"
,
oid_to_table
(
oid
,
aname
),
div
,
starttimstr
);
strcpy
(
orderby_part
,
"time"
);
}
else
if
(
endtime
)
{
if
(
div
==
1
)
sprintf
(
query
,
"select time, value from %s where time <= '%s' order by time"
,
oid_to_table
(
oid
,
aname
),
endtimstr
);
else
sprintf
(
query
,
"select time, value from %s where id %% %d = 0 and time <= '%s' order by time"
,
oid_to_table
(
oid
,
aname
),
div
,
endtimstr
);
// 'where' part
if
(
options
&
pwr_mSevOptionsMask_ReadOptimized
)
{
if
(
starttime
&&
endtime
)
{
if
(
div
==
1
)
{
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
where_part
,
"where time >= %lu and time <= %lu"
,
starttime
->
tv_sec
,
endtime
->
tv_sec
);
else
sprintf
(
where_part
,
"where time >= '%s' and time <= '%s'"
,
starttimstr
,
endtimstr
);
}
else
{
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
where_part
,
"where (id %% %d = 0 %s) and time >= %lu and time <= %lu"
,
div
,
jumpstr
,
starttime
->
tv_sec
,
endtime
->
tv_sec
);
else
sprintf
(
where_part
,
"where (id %% %d = 0 %s) and time >= '%s' and time <= '%s'"
,
div
,
jumpstr
,
starttimstr
,
endtimstr
);
}
}
else
if
(
starttime
)
{
if
(
div
==
1
)
{
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
where_part
,
"where time >= %lu"
,
starttime
->
tv_sec
);
else
sprintf
(
where_part
,
"where time >= '%s'"
,
starttimstr
);
}
else
{
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
where_part
,
"where (id %% %d = 0 %s) and time >= %lu"
,
div
,
jumpstr
,
starttime
->
tv_sec
);
else
sprintf
(
where_part
,
"where (id %% %d = 0 %s) and time >= '%s'"
,
div
,
jumpstr
,
starttimstr
);
}
}
else
if
(
endtime
)
{
if
(
div
==
1
)
{
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
where_part
,
"where time <= %lu"
,
endtime
->
tv_sec
);
else
sprintf
(
where_part
,
"where time <= '%s'"
,
endtimstr
);
}
else
{
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
where_part
,
"where (id %% %d = 0 %s) and time <= %lu"
,
div
,
jumpstr
,
endtime
->
tv_sec
);
else
sprintf
(
where_part
,
"where (id %% %d = 0 %s) and time <= '%s'"
,
div
,
jumpstr
,
endtimstr
);
}
}
else
{
if
(
div
==
1
)
strcpy
(
where_part
,
""
);
else
sprintf
(
where_part
,
"where id %% %d = 0 %s"
,
div
,
jumpstr
);
}
}
else
{
if
(
div
==
1
)
sprintf
(
query
,
"select time, value from %s order by time"
,
oid_to_table
(
oid
,
aname
));
// Not read optimized
if
(
starttime
&&
endtime
)
{
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
where_part
,
"where time >= %lu and time <= %lu"
,
starttime
->
tv_sec
,
endtime
->
tv_sec
);
else
sprintf
(
where_part
,
"where time >= '%s' and time <= '%s'"
,
starttimstr
,
endtimstr
);
}
else
if
(
starttime
)
{
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
where_part
,
"where time >= %lu"
,
starttime
->
tv_sec
);
else
sprintf
(
where_part
,
"where time >= '%s'"
,
starttimstr
);
}
else
if
(
endtime
)
{
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
where_part
,
"where time <= %lu"
,
endtime
->
tv_sec
);
else
sprintf
(
where_part
,
"where time <= '%s'"
,
endtimstr
);
}
else
sprintf
(
query
,
"select time, value from %s where id %% %d = 0 order by time"
,
oid_to_table
(
oid
,
aname
),
div
);
}
strcpy
(
where_part
,
""
);
}
sprintf
(
query
,
"select %s from %s %s order by %s"
,
column_part
,
oid_to_table
(
oid
,
aname
),
where_part
,
orderby_part
);
rc
=
mysql_query
(
m_env
->
con
(),
query
);
if
(
rc
)
{
printf
(
"Get Values: %s
\n
"
,
mysql_error
(
m_env
->
con
()));
*
sts
=
SEV__DBERROR
;
return
0
;
}
result
=
mysql_store_result
(
m_env
->
con
());
if
(
!
result
)
{
printf
(
"GetValues Result Error
\n
"
);
...
...
@@ -754,29 +1112,104 @@ int sev_dbms::get_values( pwr_tStatus *sts, pwr_tOid oid, char *aname, pwr_eType
}
int
rows
=
mysql_num_rows
(
result
);
int
bufrows
=
rows
;
*
tbuf
=
(
pwr_tTime
*
)
calloc
(
bufrows
,
sizeof
(
pwr_tTime
));
*
vbuf
=
calloc
(
bufrows
,
size
);
int
bcnt
=
0
;
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
if
(
div
>
1
)
mysql_data_seek
(
result
,
i
);
if
(
options
&
pwr_mSevOptionsMask_ReadOptimized
)
{
row
=
mysql_fetch_row
(
result
);
if
(
!
row
)
break
;
*
tbuf
=
(
pwr_tTime
*
)
calloc
(
bufrows
,
sizeof
(
pwr_tTime
));
*
vbuf
=
calloc
(
bufrows
,
size
);
int
bcnt
=
0
;
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
int
j
=
0
;
// if ( div > 1)
// mysql_data_seek( result, i);
row
=
mysql_fetch_row
(
result
);
if
(
!
row
)
break
;
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
{
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
// Posix time, high resolution
(
*
tbuf
)[
bcnt
].
tv_sec
=
strtoul
(
row
[
j
++
],
0
,
10
);
(
*
tbuf
)[
bcnt
].
tv_nsec
=
strtoul
(
row
[
j
++
],
0
,
10
);
}
else
// Posix time, low resolution
(
*
tbuf
)[
bcnt
].
tv_sec
=
strtoul
(
row
[
j
++
],
0
,
10
);
}
else
{
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
// Sql time, high resolution
timestr_to_time
(
row
[
j
++
],
&
(
*
tbuf
)[
bcnt
]);
(
*
tbuf
)[
bcnt
].
tv_nsec
=
strtoul
(
row
[
j
++
],
0
,
10
);
}
else
// Sql time, low resolution
timestr_to_time
(
row
[
j
++
],
&
(
*
tbuf
)[
bcnt
]);
}
cdh_StringToAttrValue
(
type
,
row
[
j
++
],
((
char
*
)
*
vbuf
)
+
bcnt
*
size
);
bcnt
++
;
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
printf
(
"%5d %5d %s.%9s %s
\n
"
,
i
,
bcnt
,
row
[
0
],
row
[
1
],
row
[
2
]);
else
printf
(
"%5d %5d %s %s
\n
"
,
i
,
bcnt
,
row
[
0
],
row
[
1
]);
}
printf
(
"bcnt %d bufrows %d
\n
"
,
bcnt
,
bufrows
);
*
bsize
=
bcnt
;
mysql_free_result
(
result
);
}
else
{
timestr_to_time
(
row
[
0
],
&
(
*
tbuf
)[
bcnt
]);
cdh_StringToAttrValue
(
type
,
row
[
1
],
((
char
*
)
*
vbuf
)
+
bcnt
*
size
);
*
tbuf
=
(
pwr_tTime
*
)
calloc
(
bufrows
,
sizeof
(
pwr_tTime
));
*
vbuf
=
calloc
(
bufrows
,
size
);
int
bcnt
=
0
;
for
(
int
i
=
0
;
i
<
rows
;
i
+=
div
)
{
int
j
=
0
;
if
(
div
>
1
)
mysql_data_seek
(
result
,
i
);
bcnt
++
;
printf
(
"%5d %5d %s %s
\n
"
,
i
,
bcnt
,
row
[
0
],
row
[
1
]);
row
=
mysql_fetch_row
(
result
);
if
(
!
row
)
break
;
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
{
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
// Posix time, high resolution
(
*
tbuf
)[
bcnt
].
tv_sec
=
strtoul
(
row
[
j
++
],
0
,
10
);
(
*
tbuf
)[
bcnt
].
tv_nsec
=
strtoul
(
row
[
j
++
],
0
,
10
);
}
else
// Posix time, low resolution
(
*
tbuf
)[
bcnt
].
tv_sec
=
strtoul
(
row
[
j
++
],
0
,
10
);
}
else
{
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
{
// Sql time, high resolution
timestr_to_time
(
row
[
j
++
],
&
(
*
tbuf
)[
bcnt
]);
(
*
tbuf
)[
bcnt
].
tv_nsec
=
strtoul
(
row
[
j
++
],
0
,
10
);
}
else
// Sql time, low resolution
timestr_to_time
(
row
[
j
++
],
&
(
*
tbuf
)[
bcnt
]);
}
cdh_StringToAttrValue
(
type
,
row
[
j
++
],
((
char
*
)
*
vbuf
)
+
bcnt
*
size
);
bcnt
++
;
if
(
options
&
pwr_mSevOptionsMask_HighTimeResolution
)
printf
(
"%5d %5d %s.%9s %s
\n
"
,
i
,
bcnt
,
row
[
0
],
row
[
1
],
row
[
2
]);
else
printf
(
"%5d %5d %s %s
\n
"
,
i
,
bcnt
,
row
[
0
],
row
[
1
]);
}
printf
(
"bcnt %d bufrows %d
\n
"
,
bcnt
,
bufrows
);
*
bsize
=
bcnt
;
mysql_free_result
(
result
);
}
printf
(
"bcnt %d bufrows %d
\n
"
,
bcnt
,
bufrows
);
*
bsize
=
bcnt
;
mysql_free_result
(
result
);
*
sts
=
SEV__SUCCESS
;
return
1
;
}
...
...
@@ -784,7 +1217,8 @@ int sev_dbms::get_values( pwr_tStatus *sts, pwr_tOid oid, char *aname, pwr_eType
int
sev_dbms
::
check_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
oname
,
char
*
aname
,
pwr_tDeltaTime
storagetime
,
pwr_eType
type
,
unsigned
int
size
,
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
unsigned
int
*
idx
)
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
deadband
,
pwr_tMask
options
,
unsigned
int
*
idx
)
{
char
timestr
[
40
];
pwr_tTime
uptime
;
...
...
@@ -798,7 +1232,7 @@ int sev_dbms::check_item( pwr_tStatus *sts, pwr_tOid oid, char *oname, char *ana
continue
;
if
(
cdh_ObjidIsEqual
(
oid
,
m_items
[
i
].
oid
)
&&
cdh_NoCaseStrcmp
(
aname
,
m_items
[
i
].
aname
)
==
0
)
{
cdh_NoCaseStrcmp
(
aname
,
m_items
[
i
].
a
ttr
[
0
].
a
name
)
==
0
)
{
char
query
[
400
];
sprintf
(
query
,
"update items set "
);
...
...
@@ -806,9 +1240,9 @@ int sev_dbms::check_item( pwr_tStatus *sts, pwr_tOid oid, char *oname, char *ana
sprintf
(
&
query
[
strlen
(
query
)],
"storagetime=%d,"
,
storagetime
.
tv_sec
);
if
(
strcmp
(
oname
,
m_items
[
i
].
oname
)
!=
0
)
sprintf
(
&
query
[
strlen
(
query
)],
"oname=
\'
%s
\'
,"
,
oname
);
if
(
type
!=
m_items
[
i
].
v
type
)
if
(
type
!=
m_items
[
i
].
attr
[
0
].
type
)
sprintf
(
&
query
[
strlen
(
query
)],
"type=%d,"
,
type
);
if
(
size
!=
m_items
[
i
].
v
size
)
if
(
size
!=
m_items
[
i
].
attr
[
0
].
size
)
sprintf
(
&
query
[
strlen
(
query
)],
"size=%d"
,
size
);
sprintf
(
&
query
[
strlen
(
query
)],
"uptime=
\'
%s
\'
"
,
timestr
);
sprintf
(
&
query
[
strlen
(
query
)],
"where id=%d;"
,
m_items
[
i
].
id
);
...
...
@@ -830,17 +1264,18 @@ int sev_dbms::check_item( pwr_tStatus *sts, pwr_tOid oid, char *oname, char *ana
int
sev_dbms
::
add_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
oname
,
char
*
aname
,
pwr_tDeltaTime
storagetime
,
pwr_eType
type
,
unsigned
int
size
,
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
unsigned
int
*
idx
)
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
deadband
,
pwr_tMask
options
,
unsigned
int
*
idx
)
{
char
tablename
[
256
];
strcpy
(
tablename
,
oid_to_table
(
oid
,
aname
));
store_item
(
sts
,
tablename
,
oid
,
oname
,
aname
,
storagetime
,
type
,
size
,
description
,
unit
,
scantime
);
scantime
,
deadband
,
options
);
if
(
EVEN
(
*
sts
))
return
0
;
create_table
(
sts
,
oid
,
aname
,
type
,
size
);
create_table
(
sts
,
oid
,
aname
,
type
,
size
,
options
,
deadband
);
if
(
EVEN
(
*
sts
))
return
0
;
sev_item
item
;
...
...
@@ -849,15 +1284,17 @@ int sev_dbms::add_item( pwr_tStatus *sts, pwr_tOid oid, char *oname, char *aname
strncpy
(
item
.
tablename
,
tablename
,
sizeof
(
item
.
tablename
));
item
.
oid
=
oid
;
strncpy
(
item
.
oname
,
oname
,
sizeof
(
item
.
oname
));
strncpy
(
item
.
a
name
,
aname
,
sizeof
(
item
.
aname
));
clock_gettime
(
CLOCK_REALTIME
,
&
item
.
cretime
);
item
.
uptime
=
item
.
cre
time
;
strncpy
(
item
.
a
ttr
[
0
].
aname
,
aname
,
sizeof
(
item
.
attr
[
0
]
.
aname
));
clock_gettime
(
CLOCK_REALTIME
,
&
item
.
cre
a
time
);
item
.
modtime
=
item
.
crea
time
;
item
.
storagetime
=
storagetime
;
item
.
v
type
=
type
;
item
.
v
size
=
size
;
item
.
attr
[
0
].
type
=
type
;
item
.
attr
[
0
].
size
=
size
;
strncpy
(
item
.
description
,
description
,
sizeof
(
item
.
description
));
strncpy
(
item
.
unit
,
unit
,
sizeof
(
item
.
unit
));
strncpy
(
item
.
attr
[
0
].
unit
,
unit
,
sizeof
(
item
.
attr
[
0
]
.
unit
));
item
.
scantime
=
scantime
;
item
.
deadband
=
deadband
;
item
.
options
=
options
;
m_items
.
push_back
(
item
);
*
idx
=
m_items
.
size
()
-
1
;
...
...
@@ -882,7 +1319,7 @@ int sev_dbms::delete_item( pwr_tStatus *sts, pwr_tOid oid, char *aname)
if
(
m_items
[
i
].
deleted
)
continue
;
if
(
cdh_ObjidIsEqual
(
m_items
[
i
].
oid
,
oid
)
&&
cdh_NoCaseStrcmp
(
m_items
[
i
].
aname
,
aname
)
==
0
)
{
cdh_NoCaseStrcmp
(
m_items
[
i
].
a
ttr
[
0
].
a
name
,
aname
)
==
0
)
{
m_items
[
i
].
deleted
=
1
;
break
;
}
...
...
@@ -891,7 +1328,8 @@ int sev_dbms::delete_item( pwr_tStatus *sts, pwr_tOid oid, char *aname)
return
1
;
}
int
sev_dbms
::
delete_old_data
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_tTime
limit
)
int
sev_dbms
::
delete_old_data
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_tMask
options
,
pwr_tTime
limit
)
{
char
query
[
300
];
char
timstr
[
40
];
...
...
@@ -900,8 +1338,12 @@ int sev_dbms::delete_old_data( pwr_tStatus *sts, pwr_tOid oid, char *aname, pwr_
if
(
EVEN
(
*
sts
))
return
0
;
timstr
[
19
]
=
0
;
sprintf
(
query
,
"delete from %s where time < '%s';"
,
oid_to_table
(
oid
,
aname
),
timstr
);
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
query
,
"delete from %s where time < %lu;"
,
oid_to_table
(
oid
,
aname
),
limit
.
tv_sec
);
else
sprintf
(
query
,
"delete from %s where time < '%s';"
,
oid_to_table
(
oid
,
aname
),
timstr
);
int
rc
=
mysql_query
(
m_env
->
con
(),
query
);
if
(
rc
)
{
...
...
@@ -998,3 +1440,5 @@ char *sev_dbms::pwrtype_to_type( pwr_eType type, unsigned int size)
}
return
stype
;
}
#endif
sev/lib/sev/src/sev_dbms.h
View file @
9d007f29
/*
* Proview $Id: sev_dbms.h,v 1.
2 2008-09-05 08:38:58
claes Exp $
* Proview $Id: sev_dbms.h,v 1.
3 2008-09-18 14:37:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -19,6 +19,7 @@
#ifndef sev_dbms_h
#define sev_dbms_h
#if defined PWRE_CONF_MYSQL
#include <vector.h>
...
...
@@ -105,24 +106,29 @@ class sev_dbms : public sev_db {
int
check_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
oname
,
char
*
aname
,
pwr_tDeltaTime
storagetime
,
pwr_eType
type
,
unsigned
int
size
,
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
unsigned
int
*
idx
);
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
deadband
,
pwr_tMask
options
,
unsigned
int
*
idx
);
int
add_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
oname
,
char
*
aname
,
pwr_tDeltaTime
storagetime
,
pwr_eType
type
,
unsigned
int
size
,
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
unsigned
int
*
idx
);
int
store_value
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_eType
type
,
pwr_tTime
time
,
void
*
buf
,
unsigned
int
size
);
int
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
delete_old_data
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_tTime
limit
);
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
deadband
,
pwr_tMask
options
,
unsigned
int
*
idx
);
int
store_value
(
pwr_tStatus
*
sts
,
int
item_idx
,
int
attr_idx
,
pwr_tTime
time
,
void
*
buf
,
unsigned
int
size
);
int
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
delete_old_data
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_tMask
options
,
pwr_tTime
limit
);
int
delete_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
);
int
get_items
(
pwr_tStatus
*
sts
);
int
create_table
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
);
int
create_table
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tMask
options
,
float
deadband
);
int
delete_table
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
);
int
store_item
(
pwr_tStatus
*
sts
,
char
*
tabelname
,
pwr_tOid
oid
,
char
*
oname
,
char
*
aname
,
pwr_tDeltaTime
storagetime
,
pwr_eType
vtype
,
unsigned
int
vsize
,
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
);
char
*
description
,
char
*
unit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
deadband
,
pwr_tMask
options
);
int
remove_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
);
char
*
oid_to_table
(
pwr_tOid
oid
,
char
*
aname
);
char
*
pwrtype_to_type
(
pwr_eType
type
,
unsigned
int
size
);
...
...
@@ -130,3 +136,4 @@ class sev_dbms : public sev_db {
};
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment