From c0691f0adcec71f58cf443825536d0d90ba514b3 Mon Sep 17 00:00:00 2001 From: Sven Zehl Date: Tue, 27 Sep 2016 15:48:27 +0200 Subject: [PATCH] Cleaning --- hmac_python_wrapper/hmac_example.py | 13 ++++++------- hmac_python_wrapper/hmac_python_wrapper.py | 8 ++++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/hmac_python_wrapper/hmac_example.py b/hmac_python_wrapper/hmac_example.py index bb7d65a..f59ac34 100644 --- a/hmac_python_wrapper/hmac_example.py +++ b/hmac_python_wrapper/hmac_example.py @@ -25,15 +25,14 @@ if __name__ == "__main__": - B. time slots 5-8 can be used by any best effort traffic towards STA with MAC address 34:13:e8:24:77:be - B. the other time slots are guard time slots, i.e. blocked from being used ''' - log = logging.getLogger() + log.setLevel(logging.INFO) handler = logging.StreamHandler() handler.setLevel(logging.INFO) formatter = logging.Formatter("%(levelname)s - %(message)s") handler.setFormatter(formatter) log.addHandler(handler) - # configuration of hybrid MAC dstHWAddr = "34:13:e8:24:77:be" # STA destination MAC address total_slots = 10 @@ -61,10 +60,10 @@ if __name__ == "__main__": # install MAC Processor if mac.install_mac_processor(): log.info('HMAC is running ...') - log.info('HMAC conf: %s' % mac.printConfiguration()) + mac.printConfiguration() - # wait 10 seconds - time.sleep(10) + # wait 20 seconds + time.sleep(20) log.info('Update HMAC with new configuration ...') @@ -86,9 +85,9 @@ if __name__ == "__main__": # update MAC Processor if mac.update_mac_processor(): log.info('HMAC is updated ...') - log.info('HMAC new conf: %s' % mac.printConfiguration()) + mac.printConfiguration() - time.sleep(10) + time.sleep(20) log.info("Stopping HMAC") diff --git a/hmac_python_wrapper/hmac_python_wrapper.py b/hmac_python_wrapper/hmac_python_wrapper.py index 5b92a03..b416f89 100644 --- a/hmac_python_wrapper/hmac_python_wrapper.py +++ b/hmac_python_wrapper/hmac_python_wrapper.py @@ -105,11 +105,11 @@ class HybridTDMACSMAMac(object): Return the MAC configuration serialized as string. :return: ''' - s = '[' + self.log.info('[') for ii in range(self.getNumSlots()): - s = s + str(ii) + ': ' + self.getAccessPolicy(ii).printConfiguration() + "\n" - s = s + ']' - return s + nline = str(ii) + ': ' + self.getAccessPolicy(ii).printConfiguration() + self.log.info(nline) + self.log.info(']') def install_mac_processor(self):