嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 5 元微信扫码支付:5 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
OPC XML-DA规范的WEB接口,允许具有开发能力的用户可以通过C#或者Java访问网关
XMLWrapper.OPC_XML_DA_WrapperService service = new XMLWrapper.OPC_XML_DA_WrapperService();
service.Url = txtUrl.Text;
ReadRequestItemList iList = new ReadRequestItemList();
RequestOptions Options = new RequestOptions
{
ReturnItemTime = true,
ReturnItemName = true,
LocaleID = "en-US",
ClientRequestHandle = ""
};
iList.Items = new ReadRequestItem[m_list.Count];
for (int i = 0; i < m_list.Count; i )
{
iList.Items[i] = new ReadRequestItem();
iList.Items[i].ClientItemHandle = i.ToString();
iList.Items[i].ItemName = m_list[i].OPCName;
}
ReplyItemList rVal;
OPCError[] Errors;
ReplyBase reply;
try
{
reply = service.Read(Options, iList, out rVal, out Errors);
if (rVal.Items.Count() > 0)
{
foreach (ItemValue it in rVal.Items)
{
int n = Convert.ToInt32(it.ClientItemHandle.ToString());
m_list[n].OPCValue = it.Value.ToString();
m_list[n].OPCTime = DateTime.Now.ToString();
}
dataGridView1.Refresh();
}
}
catch (Exception excp)
{
MessageBox.Show(excp.Message);
}
finally
{
}