예제 #1
0
class SurawaRessource(RESTResource):
    
    
    def __init__(self):
        RESTResource.__init__(self)
        # init hardware interface class
        self.bb = SurawaBone()
        
        
    def handle_GET(self, *vpath, **params):
        if len(vpath) == 2 and  len(params) == 0 and vpath[0] == "brightness" and vpath[1] == "value":
            return self.bb.getPhotoresistorValue()
#            return "1249" # debug purpose  
        else:
            retval = "Path Elements:<br/>" + '<br/>'.join(vpath)
            query = ['%s=>%s' % (k,v) for k,v in params.items()]
            retval += "<br/>Query String Elements:<br/>" + \
                '<br/>'.join(query)
            return "UNKNOWN ressource</br>"+ \
                "DEBUG : " + str(len(vpath))+" "+ str(vpath)+"</br>"+\
                retval
예제 #2
0
 def __init__(self):
     RESTResource.__init__(self)
     # init hardware interface class
     self.bb = SurawaBone()