Exemple #1
0
def point_graph(cn, nextc):
    err = check.contain(cn.pr, ["id_point", "datas"])
    if not err[0]:
        return cn.toret.add_error(err[1], err[2])

    use = floteur(cn.private["user"].id)
    err = use.graph_point(cn.pr["id_point"], cn.pr["datas"])
    return cn.call_next(nextc, err)
Exemple #2
0
def points_infos(cn, nextc):
    cn.pr = check.setnoneopt(cn.pr, [
        "id_points", "period_start", "period_end", "longlat", "range", "limit"
    ])
    use = floteur(cn.private["user"].id)
    err = use.infos_points(cn.pr["id_points"], cn.pr["period_start"],
                           cn.pr["period_end"], cn.pr["longlat"],
                           cn.pr["range"], cn.pr["limit"])
    return cn.call_next(nextc, err)
Exemple #3
0
def point_rename(cn, nextc):
    err = check.contain(cn.pr, ["id_point", "surname"])
    if not err[0]:
        return cn.toret.add_error(err[1], err[2])
    cn.pr = err[1]

    use = floteur(cn.private["user"].id)
    err = use.rename(cn.pr["id_point"], cn.pr["surname"])
    return cn.call_next(nextc, err)
Exemple #4
0
def point_share(cn, nextc):
    err = check.contain(cn.pr, ["id_points", "email"])
    if not err[0]:
        return cn.toret.add_error(err[1], err[2])
    cn.pr = err[1]

    use = floteur(cn.private["user"].id)
    err = use.share(cn.pr["id_points"], cn.pr["email"])
    return cn.call_next(nextc, err)
Exemple #5
0
def pdf_report(cn, nextc):
    err = check.contain(cn.pr, ["points_id", "period_start", "period_end"])
    if not err[0]:
        return cn.toret.add_error(err[1], err[2])
    cn.pr = err[1]

    use = pdf_doc()
    err = use.report(floteur(), cn.pr["points_id"], cn.pr["period_start"],
                     cn.pr["period_end"])
    return cn.call_next(nextc, err)
Exemple #6
0
def point_infos(cn, nextc):
    err = check.contain(cn.pr, ["id_point"])
    if not err[0]:
        return cn.toret.add_error(err[1], err[2])
    cn.pr = err[1]
    cn.pr = check.setnoneopt(cn.pr, ["period_start", "period_end", "limit"])
    use = floteur(cn.private["user"].id)
    err = use.infos_point(cn.pr["id_point"], cn.pr["period_start"],
                          cn.pr["period_end"], cn.pr["limit"])
    return cn.call_next(nextc, err)
Exemple #7
0
def point_add(cn, nextc):
    err = check.contain(cn.pr, ["id_sigfox"])
    if not err[0]:
        return cn.toret.add_error(err[1], err[2])
    cn.pr = err[1]
    cn.pr = check.setnoneopt(cn.pr, ["lng", "lat"])

    use = floteur(cn.private["user"].id)
    err = use.add(cn.pr["id_sigfox"], cn.pr["lat"], cn.pr["lng"])
    return cn.call_next(nextc, err)
Exemple #8
0
def sigfox_data_add(cn, nextc):
    err = check.contain(cn.pr, ["data", "device"])
    if not err[0]:
        return cn.toret.add_error(err[1], err[2])
    cn.pr = err[1]
    decompressed = decompress(cn.pr["data"])
    if not decompressed["lat_sign"]:
        decompressed["lat"] = "-" + decompressed["lat"]
    if not decompressed["lng_sign"]:
        decompressed["lng"] = "-" + decompressed["lng"]
    use = floteur()
    err = use.adddata(cn.pr["device"], "", decompressed["ph"],
                      decompressed["turbidity"], decompressed["redox"],
                      decompressed["temp"], {
                          "lat": decompressed["lat"],
                          "lng": decompressed["lng"]
                      })
    return cn.call_next(nextc, err)
Exemple #9
0
def data_add(cn, nextc):
    err = check.contain(cn.pr, ["data", "sigfox_id", "point_id"])
    if not err[0]:
        return cn.toret.add_error(err[1], err[2])
    cn.pr = err[1]
    err = check.contain(cn.pr["data"], ["data", "pos"], "data")
    if not err[0]:
        return cn.toret.add_error(err[1], err[2])
    cn.pr["data"] = err[1]
    err = check.contain(cn.pr["data"]["data"],
                        ["ph", "turbidity", "redox", "temp"], "data.data")
    if not err[0]:
        return cn.toret.add_error(err[1], err[2])
    cn.pr["data"]["data"] = err[1]

    use = floteur()
    err = use.adddata(cn.pr["sigfox_id"], cn.pr["point_id"],
                      cn.pr["data"]["data"]["ph"],
                      cn.pr["data"]["data"]["turbidity"],
                      cn.pr["data"]["data"]["redox"],
                      cn.pr["data"]["data"]["temp"], cn.pr["data"]["pos"])
    return cn.call_next(nextc, err)
Exemple #10
0
def points_shared(cn, nextc):
    use = floteur(cn.private["user"].id)
    err = use.my_shares()
    return cn.call_next(nextc, err)