コード例 #1
0
def sendsmsoh(username,status):
    msg1=''
    print(status)
    if str(status).lower() == 'high':
       msg1="HIGH Value of Alcohol"
    elif str(status).lower() == 'low':
        msg1 ="Low value of Alcohol"
    elif str(status).lower() == "medium":
        msg1 ="Moderate Value of Alcohol"
       
    sms1 = Sms(msg=msg1,user=username)
    send_status =  sms1.Send()
    if send_status[0]:
            if mongo.MessageSaved(msg=msg1,user=username,status=True,time=send_status[1]) != None:
                return jsonify({'sent':msg1})
    else:
        return make_response(jsonify({"msg":msg1}),404)               
コード例 #2
0
def sendsms(username,status,speed):
    speed1 = int(speed)
    msg1=''
    print(status)
    if status == 'on':
        if speed1 >= 50 and speed1 <= 60:
            msg1 = "falldetected with moderate risk"
        elif speed1 > 60:
            msg1 = "falldetected with high risk"
        elif speed1 < 50:
            msg1 = "falldetected with low risk"
        print(speed1, msg1)
        sms1 = Sms(msg=msg1,user=username)
        send_status =  sms1.Send()
        if send_status[0]:
            if mongo.MessageSaved(msg=msg1,user=username,status=True,time=send_status[1]) != None:
                return jsonify({'sent':msg1})
        
    return make_response(jsonify({"msg":msg1}),404)