This commit is contained in:
Michael Davidsaver
2021-05-11 13:08:10 -07:00
parent af936c0ec3
commit 6267202fd4
6 changed files with 105 additions and 5 deletions
+36
View File
@@ -0,0 +1,36 @@
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvxs is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/** The short example of a server.
*/
#include <iostream>
#include <pvxs/server.h>
#include <pvxs/sharedpv.h>
#include <pvxs/nt.h>
#include <pvxs/log.h>
int main(int argc, char* argv[]) {
using namespace pvxs;
// (Optional) configuring logging using $PVXS_LOG
logger_config_env();
// Use pre-defined NTScalar structure w/ double for primary value field.
Value initial = nt::NTScalar{TypeCode::Float64}.create();
initial["value"] = 42.0;
// Storage and access for network visible Process Variable
server::SharedPV pv(server::SharedPV::buildMailbox());
pv.open(initial);
server::Config::fromEnv() // Configure a server using $EPICS_PVAS_* or $EPICS_PVA_*
.build()
.addPV("my:pv:name", pv) // add (and name) one local PV
.run(); // run until SIGINT
return 0;
}