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

update

parent 92af4aaf
...@@ -33,7 +33,4 @@ while (True): ...@@ -33,7 +33,4 @@ while (True):
message = bytesAddressPair[0] message = bytesAddressPair[0]
datatype,value,ns,nodeid = message.decode().split("&") datatype,value,ns,nodeid = message.decode().split("&")
print(nodeid) print(nodeid)
if(datatype=="<class 'float'>"): opua.write_opcua_value(sock,int(ns), int(nodeid), value,datatype)
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
...@@ -12,6 +12,7 @@ class opcua_pack(): ...@@ -12,6 +12,7 @@ class opcua_pack():
self.Security_Token_Id = 1 self.Security_Token_Id = 1
self.identifier_string = "" self.identifier_string = ""
self.int_chunk_seq = 5 self.int_chunk_seq = 5
self.float_chunk_seq = 4
def helf(self,address): def helf(self,address):
...@@ -449,7 +450,8 @@ class opcua_pack(): ...@@ -449,7 +450,8 @@ class opcua_pack():
print(sock.recv(1024)) print(sock.recv(1024))
return sock return sock
def write_opcua_value(self,sock,ns,nodeid,val): def write_opcua_value(self,sock,ns,nodeid,val,datatype):
print(self.SecureChannelId, self.TokenId, self.identifier_string, self.int_chunk_seq, ns, nodeid, val, "<class 'int'>") if(datatype=="<class 'float'>")
sock.sendall(self.write_request(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, datatype))
print(sock.recv(1024)) 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