Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Python Programming Language

making a opc client in Python and use opc server Events


Hi all
I have a sample code to implement opc client in Python. i use a
file .py making by makepy with pythonwin for Com Interface.
i can get all server in machine, connect to server opc, disconnect,
add group, add item, read, write item in server opc.

import win32com.client  # librairie pour utiliser l'interface COM/DCOM
from win32com.client import gencache
gencache.EnsureModule('{DFB83232-A952-11D2-A46B-00C04F796375}', 0, 1,
0)

for svr in opcserver.GetOPCServers():
    print svr

#connect to server OPC Demo Simulation from Matrikon
opcserver.Connect('Matrikon.OPC.Simulation.1')

# Instance object Groups
groups=opcserver.OPCGroups
#add group
group=groups.Add('Group1')

#instance onject Items
items=group.OPCItems
# add item in server opc
tem=items.AddItem('File1.item1',1)

#read item value
item.Read(win32com.client.constants.OPCDevice)

# write a new value
item.Write(100)

#read item value
item.Read(win32com.client.constants.OPCDevice)
#if no pb you have 100 :)

#Disconnect
#opcserver.Disconnect()

BUT, and BUT, i want to use a event from opc server for uodating item
value with this below class. And i don't konw how make it!!!!!!!!
help me plz

opcserver=win32com.client.Dispatch('OPC.Automation.1')
and now i want to use events from opc server. in a class:
class DIOPCGroupEvent:
class DIOPCGroupsEvent:
class DIOPCServerEvent:

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc