summaryrefslogtreecommitdiff
path: root/test-cli/test/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test/helpers')
-rw-r--r--test-cli/test/helpers/plc.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/test-cli/test/helpers/plc.py b/test-cli/test/helpers/plc.py
index c9ef774..069058d 100644
--- a/test-cli/test/helpers/plc.py
+++ b/test-cli/test/helpers/plc.py
@@ -6,6 +6,7 @@ from sh import Command
from test.helpers.gpio import gpio
import time
+
class dcpPLC(object):
__nReset = None
__Phy = None
@@ -40,7 +41,6 @@ class dcpPLC(object):
self.__nRest = gpio('69', 'out', '1')
self.__nRest = gpio('75', 'out', '1')
-
def SaveFirmware(self, firmare):
self.setSaveFirmwareMode()
try:
@@ -50,26 +50,33 @@ class dcpPLC(object):
return False, "plc flash firmware failed {} ".format(Error.exit_code)
return True, ''
- def set_plc (self, var, value, password):
+ def set_plc(self, var, value, password):
try:
res = self.__myConfigTool("-o", "SET", "-p", "{}={}".format(var, value), "-w", "{}".format(password))
print(res)
except ErrorReturnCode as Error:
- return False, "set var failed {} {}".format(var,Error.exit_code)
+ return False, "set var failed {} {}".format(var, Error.exit_code)
return True, ''
- def set_plc2 (self, var1, value1, var2, value2, password):
+ def set_plc2(self, var1, value1, var2, value2, password):
try:
- res = self.__myConfigTool("-o", "SET", "-p", "{}={}".format(var1, value1), "-p", "{}={}".format(var2, value2), "-w", "{}".format(password))
+ res = self.__myConfigTool("-o", "SET", "-p", "{}={}".format(var1, value1), "-p",
+ "{}={}".format(var2, value2), "-w", "{}".format(password))
print(res)
except ErrorReturnCode as Error:
return False, "set var failed {}".format(Error.exit_code)
return True, ''
-
- def get_plc (self, var, value, password):
+ def get_plc(self, var, value, password):
try:
self.__myConfigTool("-o", "GET", "-p", "{}".format(var), '{}'.format(value), "-w", "{}".format(password))
except ErrorReturnCode as Error:
- return False, "set var failed {} {}".format(var,Error.exit_code)
+ return False, "set var failed {} {}".format(var, Error.exit_code)
return True, ''
+
+ def discover(self):
+ try:
+ self.__myConfigTool("-o", "DISCOVER")
+ except ErrorReturnCode:
+ return False
+ return True