Commits

Anonymous committed 908bd43

typos and name conventions fixed

Comments (0)

Files changed (1)

 '''
 Usage here
 '''
-from test.bugs.pr233 import target
+
 from threading import Thread
 import logging
 import os
 import base64
 import time
 import xml.etree.ElementTree as ET
-import threading
 import bluetooth
-import Queue
 
 from os.path import join, getsize
 from subprocess import call
      from the previous execution
      """
     def __init__(self):
-        __output = open("data.xml","w+")
+        self.__output = open("data.xml","w+")
 
     """
     When an object is destroyed, close the data.xml file
     msg = a string with xml data to put in data.xml
     """
     @syncronized(lock)
-    def updateFile(self,msg):
+    def update_file(self,msg):
         self.__output.write(msg + "\n")
 
 
     @syncronized(lock)
-    def cleanData(self):
+    def clean_data(self):
         self.__output.close()
         self.__output = open("data.xml","w")
 
-    def openLog(logpath):
+    def open_log(self, logpath):
         logger = logging.getLogger(logpath)
         hdlr = logging.FileHandler('log.txt')
         formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
     """
 
     def upload_data():
-        logger = openLog('bluebat.client.file_uploader')
+        logger = open_log('bluebat.client.file_uploader')
         
         server = "bluebat.elet.polimi.it"
         port = 5168
                 buf = o.read()
                 o.close()
 
-                cleanData()
+                clean_data()
                 s.send(buf)
                 s.close() # equivalente a s.shutdown?
 
     def merge_data_sobexsrv():
-        logger = openLog('bluebat.client.sobexsrv')
+        logger = open_log('bluebat.client.sobexsrv')
 
         while(1):
             time.sleep(5)            
 
 
 
-    def process_client(client, protocol, port, addr):
-        logger = openLog('bluebat.client.communication')
+    def process_client(self, client, protocol, port, addr):
+        logger = open_log('bluebat.client.communication')
 
         e = base64.b64encode(buf) #encode the file
 
         return 0
 
         
-    def Rf_thread(i):
-        logger = openLog('bluebat.Rfthread')
+    def rf_thread(self, i):
+        logger = open_log('bluebat.Rfthread')
 
         server_sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM )
         port = i
 
 
 
-    def L2_thread(i):
-        logger = openLog('bluebat.L2thread')
+    def l2_thread(self, i):
+        logger = open_log('bluebat.L2thread')
 
         server_sock=bluetooth.BluetoothSocket( bluetooth.L2CAP )
 
             assert False, "UnhandledOption"
             
     #continue program execution here
-    logger = openLog('bluebat.main')    
+    logger = open_log('bluebat.main')
     logger.info("starting")
 
+    rfcomm = list()
     for i in range(1,31):
         rfcomm.append(i)
 
     logger.info("Rfcomm {0}".format(rfcomm))
 
     i = 0x1001 # it should be possible to write like this
+    l2cap = list()
     while(i<0x10FF):
         l2cap.append(i)
         i = i + 1
     # create threads and run them
     # Start the two thread groups:
     for x in range ( len(rfcomm) ):
-        t= Thread(target=Rf_thread, args=i)
+        t= Thread(target=rf_thread, args=i)
         t.daemon = True
         t.start()
 
     for y in range ( len(l2cap) ):
-        u= Thread(target=L2_thread, args=i)
+        u= Thread(target=l2_thread, args=i)
         u.daemon = True
         u.start()
   
 
     p = "/tmp/sobexfiles"
     # create /tmp/sobexfiles if it doesn't exist
-    d = os.path.dirname(f)
+    d = os.path.dirname(p)
     if not os.path.exists(d):
         os.makedirs(d)