资源简介
ge VC opc server source code
,适宜OPC 服务器编程学习
代码片段和文件信息
#include “stdafx.h“
#include “Item.h“
#include “opcda.h“
#include se.h>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNCREATE(CItem Cobject)
CItem::CItem()
{
Handle = NULL;
VariantInit(&Value);
Quality = OPC_QUALITY_UNCERTAIN;
Name.Empty();
Connected = FALSE;
}
CItem::~CItem()
{
VariantClear(&Value);
Name.ReleaseBuffer();
}
void CItem::ReadFromDevice()
{
//if not connected no need to read from device
if (!Connected) return;
//Read value from hardware
//in this sample we just do some simple simulation
switch (Value.vt)
{
case VT_BOOL: //BOOL
Value.boolVal = !Value.boolVal;
break;
case VT_I2: //SHORT
Value.iVal += 1;
break;
case VT_UI2: //WORD
Value.uiVal += 1;
break;
case VT_I4: //LONG
Value.lVal += 1;
break;
case VT_UI4: //DWORD
Value.ulVal += 1;
break;
case VT_R4: //Float
Value.fltVal += 0.01f;
break;
case VT_R8: //Double
Value.dblVal += 0.02f;
break;
case VT_BSTR: //String
int n = rand();
SysFreeString(Value.bstrVal);
if ( n > 0x7000 )
Value.bstrVal = SysAllocString(L“This is a string test.“);
else if ( n>0x6000 )
Value.bstrVal = SysAllocString(L“http://www.eehoo.net“);
else if ( n>0x5000 )
Value.bstrVal = SysAllocString(L“Knight.OPC.Server.RDK“);
else if ( n>0x4000 )
Value.bstrVal = SysAllocString(L“eehoo Technology“);
else if ( n>0x3000 )
Value.bstrVal = SysAllocString(L“sales@eehoo.net“);
else if ( n>0x2000 )
Value.bstrVal = SysAllocString(L“Knight.OPC.Server.Test“);
else if ( n>0x1000 )
Value.bstrVal = SysAllocString(L“opc@eehoo.net“);
else
Value.bstrVal = SysAllocString(L“You‘re welcome!“);
break;
}//end switch
//setting quality
Quality = OPC_QUALITY_GOOD;
//setting timestamp
SYSTEMTIME sysTime;
GetSystemTime(&sysTime);
SystemTimeToFileTime(&sysTime&this->TimeStamp);
}
void CItem::WriteToDevice(VARIANT *pVar)
{
//Write value to your hardware
//in this sample we just do some simple simulation
VariantClear(&Value);
VariantCopy(&ValuepVar);
//setting quality
Quality = OPC_QUALITY_GOOD;
//setting timestamp
SYSTEMTIME sysTime;
GetSystemTime(&sysTime);
SystemTimeToFileTime(&sysTime&this->TimeStamp);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2003-04-09 17:31 help\
目录 0 2003-04-09 17:31 help\chn\
文件 300949 2002-11-01 10:20 help\chn\KOSRDK_chn.pdf
目录 0 2003-04-09 17:31 help\enu\
文件 42227 2002-11-01 10:48 help\enu\KOSRDK.chm
文件 3429 2003-04-10 16:26 license.txt
文件 5025 2003-04-10 16:38 license_chn.txt
目录 0 2003-04-09 17:31 opcdist\
文件 158560 1999-03-01 11:27 opcdist\APRXDIST.EXE
文件 73728 2002-10-21 15:54 opcdist\opccomn_ps.dll
文件 81920 2002-10-21 15:54 opcdist\OPCENUM.EXE
文件 118784 2001-04-26 11:19 opcdist\opchda_ps.dll
文件 77824 1999-03-02 13:55 opcdist\opcproxy.dll
文件 45056 1999-06-03 11:15 opcdist\opc_aeps.dll
文件 1085 2002-10-21 09:34 opcdist\readme.txt
文件 4819 2003-04-10 16:32 readme.txt
目录 0 2003-04-09 17:31 release\
文件 237568 2003-04-02 18:03 release\KOSRDK.dll
文件 6374 2003-04-02 18:03 release\KOSRDK.lib
文件 7587 2003-04-02 18:07 release\KOSRDKapi.h
文件 93689 1999-04-08 17:52 release\opcda.h
目录 0 2003-04-09 17:31 samples\
目录 0 2003-04-09 17:31 samples\bin\
目录 0 2003-04-09 17:31 samples\bin\KOSSerial\
文件 28672 2002-11-25 14:18 samples\bin\KOSSerial\ComDeviceSimulator.exe
文件 36864 2002-11-25 14:30 samples\bin\KOSSerial\KOSSerial.exe
文件 1960 2002-11-25 14:54 samples\bin\KOSSerial\ReadMe_chn.txt
文件 2062 2002-11-26 15:26 samples\bin\KOSSerial\ReadMe_enu.txt
文件 155648 2002-12-10 11:37 samples\bin\KOSVB.exe
文件 45056 2002-12-10 15:45 samples\bin\KOSVC.exe
文件 40960 2002-12-03 16:43 samples\bin\KOSVC2.exe
............此处省略77个文件信息
相关资源
- Complete and robust no-fit polygon generation
- GoogleTakeOutImageDownloader_source.zip
- MAC.icc & LUTmanager 苹果配色方案及LUTm
- vc 内存中加载运行exe
- VMware Horizon View6 注册机 keygen
- fme 2012的licgen.exe
- O2S.Components.PDFRender4NET 4.5.1破解去水印
- SpeedTest_DelphiXE4 PerlRegEx 和 官方的 Re
- Protege新手入门教程(推理篇)
- wintreetagger.exe
- TDC-GP22-激光测距仪应用指南及.pdf
- 模仿发送Http的Get、Post请求
- VC ++ Gzip解压缩代码
- 图像识别vc代码,验证码识别
- OPC 基金组织最新Opc Server源码
- wtopcsvr.dll使用手册
- gerber.txt
- QGIS-OSGeo4W-3.10.0-2-Setup-x86_64
- image2lcd_V4.0破解版
- LegacyImageEffects资源包.rar
- TMS320VC5509TMS320VC5509电路原理图--Altiu
- GA change PID
- OPCProxy.dll等相关支持库
- fme2012 licgen.exe
- 进程间通信设计。用msgget(),msgs
- FusionWidgets 之AngularGauge.swf已破解
- A Re-configurable FTL (Flash Translation la<
- 使用log算子实现的图像边缘检测
- Easyui+MVC动态生成按钮管理权限
- Beckhoff_KEY_V2.4
评论
共有 条评论