Пример #1
0
def checkForTriggers(locationLog, alert):
    alert_exist = False

    if str(alert.type) == str(Alert.SPEED_ALERT):
        if locationLog.speed >= alert.max_speed:
            alert_exist = True

    if str(alert.type) == str(Alert.GEOFENCE_ALERT):
        if PacketParser.is_out_of_area(locationLog, alert):
            alert_exist = True

    if str(alert.type) == str(Alert.SCHEDULE_ALERT):
        if PacketParser.is_in_time_slot(locationLog.timestamp, alert.schedule_profile.schedule_bit_field):
            alert_exist = True

    # print "checkForTriggers returned " + str(alert_exist)
            
    return alert_exist