-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.cpp
More file actions
72 lines (61 loc) · 1.65 KB
/
client.cpp
File metadata and controls
72 lines (61 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "client.h"
// Client* Client::p_instance = NULL;
void Client::writePV(QString name, QString value)
{
if(!_writePV(name, value.toStdString().c_str(), DBF_STRING))
{
QMessageBox::warning(NULL, "Error writing to PV", "Could not write the value to PV: " + name);
return;
}
}
void Client::writePV(QString name, int value)
{
if(!_writePV(name, &value, DBF_INT))
{
QMessageBox::warning(NULL, "Error writing to PV", "Could not write the value to PV: " + name);
return;
}
}
void Client::writePV(QString name, double value)
{
if(!_writePV(name, &value, DBF_DOUBLE))
{
QMessageBox::warning(NULL, "Error writing to PV", "Could not write the value to PV: " + name);
return;
}
}
void Client::writePV(QString name, unsigned value)
{
if(!_writePV(name, &value, DBF_LONG))
{
QMessageBox::warning(NULL, "Error writing to PV", "Could not write the value to PV: " + name);
return;
}
}
void Client::writeArray(QString name, void *data, unsigned long size)
{
int status;
chid pvID;
ca_search(name.toStdString().c_str(), &pvID);
status = ca_pend_io(1);
if(status != ECA_NORMAL)
{
QMessageBox::warning(NULL, "Error writing to PV", "Could not write the value to PV: " + name);
return;
}
ca_array_put(DBF_LONG, size, pvID, data);
return;
}
bool Client::_writePV(QString name, const void* value, int type)
{
int status;
chid pvID;
ca_search(name.toStdString().c_str(), &pvID);
status = ca_pend_io(1);
if(status != ECA_NORMAL)
{
return false;
}
ca_put(type, pvID, value);
return true;
}