summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/30-07-2011/DeviceAddressClass.py
diff options
context:
space:
mode:
Diffstat (limited to 'For Weekly Test/30-07-2011/DeviceAddressClass.py')
-rw-r--r--For Weekly Test/30-07-2011/DeviceAddressClass.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/For Weekly Test/30-07-2011/DeviceAddressClass.py b/For Weekly Test/30-07-2011/DeviceAddressClass.py
new file mode 100644
index 0000000..21c9dc0
--- /dev/null
+++ b/For Weekly Test/30-07-2011/DeviceAddressClass.py
@@ -0,0 +1,37 @@
+class DeviceAddress:
+
+ def __init__(self):
+ self.add = None
+ self.num = None
+ self.portAdd = ''
+
+ def findDevice(self, device):
+ file = open('DeviceAddress.txt', 'r')
+
+ for line in file:
+
+ first = line.find('[')
+ second= line.find(']') # search for position
+ find = line[first+1:second]
+
+ stop = line.find(':')
+ IPAddress =line[stop+1:]
+ stop2 = IPAddress.find(':')
+
+ number = IPAddress[stop2+1:]
+ stop3 = number.find(':')
+
+ portAddress = number[stop3+1:]
+ stop4 = portAddress.find(':')
+
+
+ if find == device:
+ print device
+ self.add = IPAddress[0:stop2]
+ self.num = number[0:stop3]
+ if stop4 <> -1:
+ self.portAdd = portAddress[0:stop4]
+ break
+
+
+ file.close()