Definition of OPC UA object which represents a object to be mirrored in python This class mirrors it's UA counterpart and semi-configures itself according to the UA model (generally from XML)
| 71 | |
| 72 | |
| 73 | class MyObj(UaObject): |
| 74 | """ |
| 75 | Definition of OPC UA object which represents a object to be mirrored in python |
| 76 | This class mirrors it's UA counterpart and semi-configures itself according to the UA model (generally from XML) |
| 77 | """ |
| 78 | def __init__(self, opcua_server, ua_node): |
| 79 | |
| 80 | # properties and variables; must mirror UA model (based on browsename!) |
| 81 | self.MyVariable = 0 |
| 82 | self.MyProperty = 0 |
| 83 | self.MyClientWrite = 0 |
| 84 | |
| 85 | # init the UaObject super class to connect the python object to the UA object |
| 86 | super().__init__(opcua_server, ua_node) |
| 87 | |
| 88 | # local values only for use inside python |
| 89 | self.testval = 'python only' |
| 90 | |
| 91 | # If the object has other objects as children it is best to search by type and instantiate more |
| 92 | # mirrored python classes so that your UA object tree matches your python object tree |
| 93 | |
| 94 | # ADD CUSTOM OBJECT INITIALIZATION BELOW |
| 95 | # find children by type and instantiate them as sub-objects of this class |
| 96 | # NOT PART OF THIS EXAMPLE |
| 97 | |
| 98 | |
| 99 | if __name__ == "__main__": |
no outgoing calls
no test coverage detected