summaryrefslogtreecommitdiffstats
path: root/Src/PyCatcher/src/pyCatcherModel.py
diff options
context:
space:
mode:
Diffstat (limited to 'Src/PyCatcher/src/pyCatcherModel.py')
-rw-r--r--Src/PyCatcher/src/pyCatcherModel.py59
1 files changed, 47 insertions, 12 deletions
diff --git a/Src/PyCatcher/src/pyCatcherModel.py b/Src/PyCatcher/src/pyCatcherModel.py
index 5de6234..0d5fb91 100644
--- a/Src/PyCatcher/src/pyCatcherModel.py
+++ b/Src/PyCatcher/src/pyCatcherModel.py
@@ -21,7 +21,7 @@ class BaseStationInformation:
self.evaluation = 'NYE'
def get_list_model(self):
- return (self.provider, str(self.arfcn), str(self.rxlev), self.evaluation, self.discovery_time)
+ return self.provider, str(self.arfcn), str(self.rxlev), self.evaluation, self.discovery_time
def get_neighbour_arfcn(self):
neighbours = self.system_info_t2[3:19]
@@ -31,11 +31,11 @@ class BaseStationInformation:
for value in neighbours:
bin_representation += str(bin(int(value, 16))[2:].zfill(8))
- '''
- >>> for i, bit in enumerate(reversed(a)):
-... if bit == '1':
-... print i
- '''
+
+ # for i, bit in enumerate(reversed(a)):
+ # if bit == '1':
+ # print i
+
for x in xrange(1,125):
index = 0-x
bit = bin_representation[index]
@@ -48,9 +48,30 @@ class BaseStationInformation:
def get_neighbour_arfcn_bis(self):
pass
-
- def create_lof(self):
- pass
+
+ def create_report(self):
+ report_params = '''------- Base Station Parameters -----------
+Country: %s
+Provider: %s
+ARFCN: %s
+rxlev: %s
+BSIC: %s
+LAC: %s
+Cell ID: %s
+Neighbours: %s
+Evaluation: %s\n
+'''%(self.country,self.provider, self.arfcn, self.rxlev, self.bsic, self.lac, self.cell, ', '.join(map(str,self.get_neighbour_arfcn())),self.evaluation)
+
+ report_rules ='------- Rule Results -----------\n'
+ for key in self.rules_report.keys():
+ report_rules += str(key) + ': ' + str(self.rules_report[key])
+ report_rules +='\n\n'
+ report_raw = '''------- Raw Information -----------
+SystemInfo_2: %s
+SystemInfo_2ter: %s
+SystemInfo_2bis: %s
+'''%(' '.join(self.system_info_t2), ' '.join(self.system_info_t2ter), ' '.join(self.system_info_t2bis))
+ return report_params + report_rules + report_raw
class BaseStationInformationList:
def __init__(self):
@@ -70,19 +91,19 @@ class BaseStationInformationList:
code = ''
filtered_list = self._base_station_list
- if found_filter == None:
+ if found_filter is None:
print_neighbours = True
else:
print_neighbours = not found_filter.is_active
- if filters != None:
+ if filters is not None:
for filter in filters:
if filter.is_active:
filtered_list = filter.execute(filtered_list)
for station in filtered_list:
code += str(station.arfcn) + r' [color=red]; '
- if(print_neighbours):
+ if print_neighbours:
for neighbour in station.get_neighbour_arfcn():
code += str(station.arfcn) + r' -> ' + str(neighbour) + r'; '
#TODO: make printing the source a fixed option
@@ -93,4 +114,18 @@ class BaseStationInformationList:
store.clear()
for item in self._base_station_list:
store.append(item.get_list_model())
+
+ def create_report(self, arfcn):
+ for item in self._base_station_list:
+ if item.arfcn == int(arfcn):
+ return item.create_report()
+
+ def evaluate(self, rules, evaluator):
+ for station in self._base_station_list:
+ rule_results = {}
+ for rule in rules:
+ if rule.is_active:
+ rule_results[rule.identifier] = rule.check(station.arfcn, self._base_station_list)
+ station.rules_report = rule_results.copy()
+ station.evaluation = evaluator.evaluate(rule_results)
\ No newline at end of file