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 }
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__()
def __init__(self): self.conn = Conn()
class Battery(Resource): def __init__(self): self.conn = Conn() def get (self, id, uav_id): return {"battery": "%s" % (self.conn.getBattery())}