コード例 #1
0
class ReceiverServer(threading.Thread):
    """
        The ReceiverServer class makes use of the GAORfidReceiver protocol
        classes to continually accept connections from RFID Receivers and then
        delegate handling of those connections to another thread which will
        handle parsing and offering data to the queue.
    """
    def __init__(self,queue,t,n):
        """
            Constructs a server which will continually accept connections.
            When a connection is received the RFID receiver will be initially
            configured to query at a rate of 't' seconds and take 'n' samples
            per gain level.  See ReceiverConnection class for details.
            
            For each observation made the observation will be offered to the
            queue 'queue'. 
        """
        self.server = Server()
        self.server.connect()
        
        self.queue = queue
        self.rate = t
        self.count = n
        
        threading.Thread.__init__(self)
    
    def run(self):
        
        while True:
            drv = self.server.getNextConnection()

            thread = ReceiverConnection(driver=drv,queue=self.queue,t=self.rate,n=self.count)
            thread.start()
コード例 #2
0
    def __init__(self, queue, t, n):
        """
            Constructs a server which will continually accept connections.
            When a connection is received the RFID receiver will be initially
            configured to query at a rate of 't' seconds and take 'n' samples
            per gain level.  See ReceiverConnection class for details.
            
            For each observation made the observation will be offered to the
            queue 'queue'. 
        """
        self.server = Server()
        self.server.connect()

        self.queue = queue
        self.rate = t
        self.count = n

        threading.Thread.__init__(self)
コード例 #3
0
class ReceiverServer(threading.Thread):
    """
        The ReceiverServer class makes use of the GAORfidReceiver protocol
        classes to continually accept connections from RFID Receivers and then
        delegate handling of those connections to another thread which will
        handle parsing and offering data to the queue.
    """
    def __init__(self, queue, t, n):
        """
            Constructs a server which will continually accept connections.
            When a connection is received the RFID receiver will be initially
            configured to query at a rate of 't' seconds and take 'n' samples
            per gain level.  See ReceiverConnection class for details.
            
            For each observation made the observation will be offered to the
            queue 'queue'. 
        """
        self.server = Server()
        self.server.connect()

        self.queue = queue
        self.rate = t
        self.count = n

        threading.Thread.__init__(self)

    def run(self):

        while True:
            drv = self.server.getNextConnection()

            thread = ReceiverConnection(driver=drv,
                                        queue=self.queue,
                                        t=self.rate,
                                        n=self.count)
            thread.start()
コード例 #4
0
 def __init__(self,queue,t,n):
     """
         Constructs a server which will continually accept connections.
         When a connection is received the RFID receiver will be initially
         configured to query at a rate of 't' seconds and take 'n' samples
         per gain level.  See ReceiverConnection class for details.
         
         For each observation made the observation will be offered to the
         queue 'queue'. 
     """
     self.server = Server()
     self.server.connect()
     
     self.queue = queue
     self.rate = t
     self.count = n
     
     threading.Thread.__init__(self)
コード例 #5
0
 
 rate  = float(optlist.get("--receiver-rate", 1))
 count = int(optlist.get("--receiver-samples", 100))
     
 if not id:
     usage("No tag specified.")
 if pos < 0:
     usage("Position not specified or is invalid")
     
 ## Open a writer object for this tag, retrieve the actual id for the alias
 ##-------------------------------------------------------------------------
 writer = CalibrationFileWriter("Tag%s.cali" % id)
 
 if id in known_tags.keys():
     id = known_tags.get(id)
 
 print "INFO: Starting Server"
 serv = Server()
 serv.connect()
 
 ## Wait until the maximum number of connections has been reached
 for i in range( len(known_hosts.keys()) ):
     con = serv.getNextConnection()
     print "INFO: Connected by receiver %s on port %d" % (con.addr, con.port)
     
     thread = CalibrationThread(id,pos,writer,con,rate,count)
     thread.start()
     
 print "INFO: Maximum connections reached."
 
 
コード例 #6
0
    rate = float(optlist.get("--receiver-rate", 1))
    count = int(optlist.get("--receiver-samples", 100))

    if not id:
        usage("No tag specified.")
    if pos < 0:
        usage("Position not specified or is invalid")

    ## Open a writer object for this tag, retrieve the actual id for the alias
    ##-------------------------------------------------------------------------
    writer = CalibrationFileWriter("Tag%s.cali" % id)

    if id in known_tags.keys():
        id = known_tags.get(id)

    print "INFO: Starting Server"
    serv = Server()
    serv.connect()

    ## Wait until the maximum number of connections has been reached
    for i in range(len(known_hosts.keys())):
        con = serv.getNextConnection()
        print "INFO: Connected by receiver %s on port %d" % (con.addr,
                                                             con.port)

        thread = CalibrationThread(id, pos, writer, con, rate, count)
        thread.start()

    print "INFO: Maximum connections reached."