Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iproperties due to failure of map() function, Fix OpenOPCService failure to start issues #12

Merged
merged 3 commits into from
Nov 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/OpenOPC.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ def iproperties(self, tags, id=None):
count, property_id, descriptions, datatypes = self._opc.QueryAvailableProperties(tag)

# Remove bogus negative property id (not sure why this sometimes happens)
tag_properties = map(None, property_id, descriptions)
tag_properties = list(map(lambda x, y: (x, y), property_id, descriptions))
property_id = [p for p, d in tag_properties if p > 0]
descriptions = [d for p, d in tag_properties if p > 0]

Expand Down Expand Up @@ -973,9 +973,9 @@ def iproperties(self, tags, id=None):
else:
tag_properties = [values]
else:
tag_properties = map(None, property_id, values)
tag_properties = list(map(lambda x, y: (x, y), property_id, values))
else:
tag_properties = map(None, property_id, descriptions, values)
tag_properties = list(map(lambda x, y, z: (x, y, z), property_id, descriptions, values))
tag_properties.insert(0, (0, 'Item ID (virtual property)', tag))

if include_name: tag_properties.insert(0, (0, tag))
Expand Down
11 changes: 6 additions & 5 deletions src/OpenOPCService.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#Pyro4.config.SERIALIZER='marshal'

opc_class = OpenOPC.OPC_CLASS
opc_gate_host = os.environ['OPC_GATE_HOST']
opc_gate_port = int(os.environ['OPC_GATE_PORT'])
opc_gate_host = "localhost"
opc_gate_port = 7766

def getvar(env_var):
"""Read system environment variable from registry"""
Expand All @@ -49,9 +49,9 @@ def getvar(env_var):
# Get env vars directly from the Registry since a reboot is normally required
# for the Local System account to inherit these.

#if getvar('OPC_CLASS'): opc_class = getvar('OPC_CLASS')
#if getvar('OPC_GATE_HOST'): opc_gate_host = getvar('OPC_GATE_HOST')
#if getvar('OPC_GATE_PORT'): opc_gate_port = int(getvar('OPC_GATE_PORT'))
if getvar('OPC_CLASS'): opc_class = getvar('OPC_CLASS')
if getvar('OPC_GATE_HOST'): opc_gate_host = getvar('OPC_GATE_HOST')
if getvar('OPC_GATE_PORT'): opc_gate_port = int(getvar('OPC_GATE_PORT'))

@Pyro4.expose # needed for version 4.55
class opc(object):
Expand Down Expand Up @@ -159,3 +159,4 @@ def SvcDoRun(self):
daemon.shutdown()
else:
win32serviceutil.HandleCommandLine(OpcService)