Commit b4efccbe authored by yogesh.m's avatar yogesh.m

update

parent 92af4aaf
......@@ -33,7 +33,4 @@ while (True):
message = bytesAddressPair[0]
datatype,value,ns,nodeid = message.decode().split("&")
print(nodeid)
if(datatype=="<class 'float'>"):
opua.write_opcua_value(sock,int(ns), int(nodeid), 11)
if(datatype=="<class 'int'>"):
opua.write_opcua_value(sock,int(ns), int(nodeid), 6)
\ No newline at end of file
opua.write_opcua_value(sock,int(ns), int(nodeid), value,datatype)
......@@ -12,6 +12,7 @@ class opcua_pack():
self.Security_Token_Id = 1
self.identifier_string = ""
self.int_chunk_seq = 5
self.float_chunk_seq = 4
def helf(self,address):
......@@ -449,7 +450,8 @@ class opcua_pack():
print(sock.recv(1024))
return sock
def write_opcua_value(self,sock,ns,nodeid,val):
print(self.SecureChannelId, self.TokenId, self.identifier_string, self.int_chunk_seq, ns, nodeid, val, "<class 'int'>")
sock.sendall(self.write_request(self.SecureChannelId, self.TokenId, self.identifier_string, self.int_chunk_seq, ns, nodeid, val, "<class 'int'>"))
print(sock.recv(1024))
def write_opcua_value(self,sock,ns,nodeid,val,datatype):
if(datatype=="<class 'float'>")
sock.sendall(self.write_request(self.SecureChannelId, self.TokenId, self.identifier_string, self.int_chunk_seq, ns, nodeid, val, datatype))
else:
sock.sendall(self.write_request(self.SecureChannelId, self.TokenId, self.identifier_string, self.float_chunk_seq, ns,nodeid, val, datatype))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment