コード例 #1
0
ファイル: camera.py プロジェクト: pi2grupo3/sav
 def move_(self,steps, diraction):  
     if( diraction == "left" ):        
         if( not self.canMoveLeft() ):
             log.info("Impossível mover a câmera...")            
             return False        
     elif( diraction == "right" ):
         if( not self.canMoveRight() ):
             log.info("Impossível mover a câmera...")            
             return False        
     
     if( diraction == "right" or diraction == "left"  or diraction == "hold"):            
         data = json.dumps({'camera':{"go_to_position":diraction} })
         req = url.Request(self.urlServer)
         req.add_header('Content-Type', 'application/json')        
         return  url.urlopen(req, data)     
         
     else:
         return False         
コード例 #2
0
ファイル: main.py プロジェクト: pi2grupo3/sav
from utils.generic import log
from utils.booter import Boot

from communication.webserver import MyHandler
from mainloop import MainLoopHTTPServer

from algorithm.hmt import HMT

from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from SocketServer import ThreadingMixIn

if __name__ == "__main__":

    # boot
    conf = Boot()
    conf.disclamer()

    log = log(conf.getProperty("log_file"))
    log.info("Preparando o programa... ")

    try:
        log.info("Abrindo o servidor de video")
        server = MainLoopHTTPServer((conf.getProperty("ip"), 8080), MyHandler)
        server.init(conf, log)

        log.info("Programa iniciado com sucesso ")
        server.serve_forever()
    except KeyboardInterrupt:
        server.socket.close()
        log.info("Programa finalizado com sucesso ")