예제 #1
0
class ModeList(Resource):
    
    def __init__(self):
        self.reqparse = reqparse.RequestParser()
        self.reqparse.add_argument('mode', type = str, location = 'json', required=True)
        self.conn = Conn()
        super(ModeList, self).__init__()

    """ Get the current Mode of a given UAV """
    def get(self, id, uav_id):
        return {"mode": "%s" % (self.conn.getMode())}

    """Set Mode for a given UAV"""
    def post(self, id, uav_id):
        mode = request.json['mode']
        response = self.conn.setMode(mode)
        if (response):
            return {"mode": "%s" % (response)}, 202
        else:
            return { "message": "Bad Request - Invalid Mode", "status": 400 }
예제 #2
0
 def __init__(self):
     self.reqparse = reqparse.RequestParser()
     self.reqparse.add_argument('mode', type = str, location = 'json', required=True)
     self.conn = Conn()
     super(ModeList, self).__init__()
예제 #3
0
 def __init__(self):
     self.conn = Conn()
예제 #4
0
class Battery(Resource):
    def __init__(self):
        self.conn = Conn()

    def get (self, id, uav_id):
        return {"battery": "%s" % (self.conn.getBattery())}