Current master branch contains a huge bug fixes commit from PR#14, which might introduce some new bugs. If the master branch went wrong, you may check release 0.4.1 as a backup.
OPC Core Component x64
is NECESSARY if you want to build x64 project, I bundled the 3.0.105.1
version (seems more popular).hostname
, then input server ID
, it should
work.hostname
instead of IP address
for reasons below.
services.msc
COPCCLint::init
and COPCClinet::stop
in every thread. There are two method to init, in one application,
different thread could use different method.
COPCClient::init(MULTITHREADED)
to init thread OLE, then the COPCxxx
created in the thread
could be accessed from other thread that is also inited with MULTITHREADED
.COPCClient::init()
to init thread OLE, but all COPCxxx
created in the thread can't be
accessed from different thread.COPCClient::init()
in main thread (the
UI thread)
. (See MSDN)
.Date: 2024-06-18
Date: 2021-10-10
Date: 2017-07-07
Date: 2017-04-13
Add a convenience class to connect local server in sync I/O mode
// connect local server
LocalSyncOPCCLient* client = new LocalSyncOPCCLient;
client->Init();
if (client->Connect("Matrikon.OPC.Simulation.1"))
{
// sync write and sync read
client->WriteUint16("Bucket Brigade.UInt2", 998);
std::cout << client->ReadUint16("Bucket Brigade.UInt2");
// disconnect and stop
client->DisConnect();
client->Stop();
delete client;
}
* You could rewrite or override the member function `IsOPCConnectedPLC()` to make connection more safety
* You could rewrite or override the member function `ItemNameFilter(std::string)` to avoid adding useless items
* Since there are too
many [Variant type](https://msdn.microsoft.com/en-us/library/windows/desktop/ms221627(v=vs.85).aspx), I only add
three basic I/O functions as a guidence, it should help you to add what you need
Date:2016-12-13
COPCClient::init()
and COPCClient::stop()
in every thread.Date:2016-07-01
Date:2016-05-31
OPC Core Component 3.0.106
.