求助:OPC客户端对服务器自己添加的组和项的连接! 点击:2221 | 回复:10



cwb_2000

    
  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 4回
  • 年度积分:0
  • 历史总积分:20
  • 注册:2003年1月02日
发表于:2003-08-11 16:18:00
楼主
我现在学习开发OPC服务器和客户端,碰到一个问题,我往客户端往服务器添加组和项对象的时候是可以的,但是我不知道怎么建立和服务器已经存在的组和项对象的连接。 我是这么来做的,使用IOPCBrowseServerAddressSpace.BrowseOPCItemIDs获得IEnumString来浏览服务器的项对象,能够浏览到一个LPOLESTR也不清楚是项的全名还是项的路径,然后我就使用IOPCItemMgt.AddItems添加项对象,这样不行,只是添加一个新的项对象而不是与原来的连接,不知道怎么解决,希望各位大侠不吝赐教!感激不尽!我的E-mail:cwb_2000@hotmail.com



acoma

  • 精华:0帖
  • 求助:0帖
  • 帖子:6帖 | 7回
  • 年度积分:0
  • 历史总积分:25
  • 注册:2002年8月08日
发表于:2003-05-02 16:01:00
1楼
我这段时间在看资料,不知道回得对不对 不过我们可以探讨 我觉得连接应该是在IConnectionPoint里进行的把 看MSDN里的一个说明,IConnectionPoint:Advise就是在connection point 和client sink之间建立连接的 不知道你用的是哪个版本的DA,我看的是2.05的

cwb_2000

  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 4回
  • 年度积分:0
  • 历史总积分:20
  • 注册:2003年1月02日
发表于:2003-05-04 13:28:00
2楼
我使用的是1.0版本,我觉得服务器方自己建立的组和项应该是公共组,不知道是不是,如果是的话,那么要建立与组对象的连接就应该是使用公共组的接口了。 因为我的师兄做了一个DEMO版的服务器,我也搞不清楚怎么和它自己建立的组建立连接。师兄又走掉了,所以比较麻烦,谢谢你。我们可以再探讨!

acoma

  • 精华:0帖
  • 求助:0帖
  • 帖子:6帖 | 7回
  • 年度积分:0
  • 历史总积分:25
  • 注册:2002年8月08日
发表于:2003-05-05 10:56:00
3楼
公共组可以有Server和Client创建,资料上说Client创建的是private,然后再转化为Public,所以我想Server创建的应该是Public了。不知道1。0上有没有这个接口:IOPCServerPublicGroups, 可以用它的一个函数GetPublicGroupByName来取得和组的连接,返回一个指向该组的指针 呵呵,试试看!by the way,你用什么工具开发?

cwb_2000

  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 4回
  • 年度积分:0
  • 历史总积分:20
  • 注册:2003年1月02日
发表于:2003-05-05 11:29:00
4楼
这个我知道的,我用的也是2.05版本,但是师兄做的是1.0的版本。 这两天比较忙,没有时间试一试这个接口,等过几天试过之后再和你探讨结果,呵呵! 我用的是Visual C++ 6.0,你呢?

qzhang2

  • 精华:1帖
  • 求助:0帖
  • 帖子:10帖 | 28回
  • 年度积分:0
  • 历史总积分:73
  • 注册:2003年3月31日
发表于:2003-05-08 13:02:00
5楼
我找到这段内容好像就是答案。 I think there is a general misunderstanding about the architecture of an OPC Server. The address space of the OPC Server that you can see via the browse interface is (normally) only the offline information about the available Items of the OPC Server. The browse interface allows the client to choose the items that are required for the data transfer. To read and write the data of Items the OPC Client needs to add an OPCGroup object to the OPCServer object. The group object is the container for the Items. The client must use the ItemIDs (result from browsing and IOPCBrowseServerAddressSpace::GetItemID) to add the items to the Group. !!!!!!!!!! The Client must create the groups and only the client has access that creates the group. The groups are also completely independent from the address space. The server has no groups other than the client added groups !!!!!!!!!! The client must use the ServerHandles which are returned at the AddItems call to read and write the data of the items. Only the items which are added to groups by a client are available online.

cwb_2000

  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 4回
  • 年度积分:0
  • 历史总积分:20
  • 注册:2003年1月02日
发表于:2003-05-16 15:07:00
6楼
我已经连接上了,查找以后再使用ADDITEM函数,以前连不上是因为我使用的组名和项名是用中文的,在字符转换的过程中出了点问题,现在已经解决了。不好意思,最近忙着英语的期末考,一直没怎么弄。 你们有没有OPC基金会提供的2.05版的接口的源代码?有的话能不能给我一份?先谢过了。

gongkongedit

  • 精华:1099帖
  • 求助:0帖
  • 帖子:14392帖 | 54470回
  • 年度积分:0
  • 历史总积分:622
  • 注册:2008年9月08日
发表于:2003-05-16 18:26:00
7楼
你们有没有OPC基金会提供的2.05版的接口的源代码?有的话能不能给我一份?先谢过了。 email: cn_rabbit@163.net

小流氓

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 14回
  • 年度积分:0
  • 历史总积分:64
  • 注册:2002年9月15日
发表于:2003-06-29 18:19:00
8楼
你们有没有OPC基金会提供的2.05版的接口的源代码?有的话能不能给我一份?谢谢!! liuweili1978@sohu.com

gongkongedit

  • 精华:1099帖
  • 求助:0帖
  • 帖子:14392帖 | 54470回
  • 年度积分:0
  • 历史总积分:622
  • 注册:2008年9月08日
发表于:2003-07-23 16:41:00
9楼
给我一份! crgcyr@etang.com

whaud

  • 精华:0帖
  • 求助:0帖
  • 帖子:8帖 | 6回
  • 年度积分:0
  • 历史总积分:39
  • 注册:2002年10月10日
发表于:2003-08-11 16:18:00
10楼
能否也给我寄一份。谢谢。whai99@sina.com

热门招聘
相关主题

官方公众号

智造工程师