def __init__(self, host, port):
     """
     Initializes the element by opening a socket to the android SMSServer
     Does not do any exception handling.
     
     host is the host on which the android SMS server is listening
     port is the port on which the android SMS server is listening
     """
     SMSPipelineElement.__init__(self, 'android connector', 'android device')
     
     self.port = port
     self.host  = host
     
     # Making the connection
     # We don't catch the error here, we
     # leave that as an exercise to the caller
     android_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     android_socket.connect((self.host, self.port))      
     logger.log(self, "connected to android device on on host %s port %d" % (host, port))
     
     # Obtain mock file objects for the socket
     # And the TextParser to parse the text message
     self.out_ = android_socket.makefile(mode = 'w')
     self.in_ = android_socket.makefile()
     self.socket_ = android_socket
     self.text_parser = TextParser(self.in_)
     
     # Used to avoid double closing
     self.closed = False       
Beispiel #2
0
 def __init__(self, url, key):
     SMSPipelineElement.__init__(self, 'django connector', 'django')
     threading.Thread.__init__(self)
     
     self.url = url
     self.key = key        
     logger.log(self, "created with device key %s and url %s" % (key, url))
     
     self.sms_queue = collections.deque()
Beispiel #3
0
 def __init__(self, url, key):
     """
     Initialzes the Element
     url is the url for requests.
     key is a string to include as a parameter to every request
     """
     SMSPipelineElement.__init__(self, 'django connector', 'django')
     
     self.url = url
     self.key = key        
     logger.log(self, "created with device key %s and url %s" % (key, url))
     
     # create an empty queue for SMSs
     self.sms_queue = collections.deque()
 def __init__(self, host, port):
     
     SMSPipelineElement.__init__(self, 'android connector', 'android device')
     self.port = port
     self.host  = host
     
     #lets try to connect
     android_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     android_socket.connect((self.host, self.port))      
     logger.log(self, "connected to android device on on host %s port %d" % (host, port))
     
     self.out_ = android_socket.makefile(mode = 'w')
     self.in_ = android_socket.makefile()
     self.socket_ = android_socket
     self.closed = False
     
     self.text_parser = TextParser(self.in_)       
Beispiel #5
0
 def __init__(self):
     """Initalizes the Element"""
     SMSPipelineElement.__init__(self, 'terminal', 'terminal')
     logger.log(self, "terminal SMS device initialized. exit by writing DO:QUIT after 'To:'")