/* 
 * Copyright (c) 2016 Michal Marasz.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Michal Marasz - initial API and implementation and/or initial documentation
 */
package pl.ekozefir.mobile.serial.centralstate.value;

import com.google.common.collect.ImmutableMap;
import java.util.Map;
import pl.ekozefir.mobile.serial.centralstate.Response;
import pl.ekozefir.mobile.serial.centralstate.MobileParser;

/**
 *
 * @author Michal Marasz  
 */
public class AlertMessageParser implements MobileParser {

    private static final Map<Integer, String> values = ImmutableMap.<Integer, String>builder().
            put(0, "AWARIA_BRAK").
            put(1, "AWARIA_CZUJNIKA").
            put(2, "AWARIA_BAZY").
            put(3, "AWARIA_TK_NAW").
            put(4, "AWARIA_TK_WYW").
            put(5, "AWARIA_BOT").
            put(6, "AWARIA_ZNW").
            put(7, "AWARIA_POLACZEN").
            put(8, "AWARIA_PRZEGRZANIE").
            put(9, "AWARIA_FILTR").
            put(10, "AWARIA_FAKTURA_1").
            put(11, "AWARIA_FAKTURA_2").
            put(12, "AWARIA_ODSZRANIANIA").
            put(13, "AWARIA_ROTOR").
            put(53, "AWARIA_POLACZENIA").
            build();
    private static final int byteNumber = 41;

    @Override
    public ParsedValue parse(Response response) {
        return new ParsedValue(values.get(response.convertByteOfNumberToInt(byteNumber)));
    }

}

@@ -844,19 +844,18 @@
 0, %22
-AWARIA_BRAK
+NO_FAILURE
 %22).%0A
@@ -878,23 +878,34 @@
 1, %22
-AWARIA_CZUJNIKA
+TEMPERATURE_SENSOR_FAILURE
 %22).%0A
@@ -928,19 +928,26 @@
 2, %22
-AWARIA_BAZY
+MAIN_BOARD_FAILURE
 %22).%0A
@@ -970,21 +970,26 @@
 3, %22
-AWARIA_TK_NAW
+SUPPLY_FAN_FAILURE
 %22).%0A
@@ -1012,21 +1012,27 @@
 4, %22
-AWARIA_TK_WYW
+EXTRACT_FAN_FAILURE
 %22).%0A
@@ -1055,18 +1055,34 @@
 5, %22
-AWARIA_BOT
+THERMAL_PROTECTION_ENABLED
 %22).%0A
@@ -1105,57 +1105,107 @@
 6, %22
-A
 WA
-RIA_ZNW%22).%0A            put(7, %22AWARIA_POLACZEN
+TER_HEATER_ANTIFROST_PROTECTION_ENABLED%22).%0A            put(7, %22CONNECTION_WITH_MAIN_BOARD_FAILURE
 %22).%0A
@@ -1228,26 +1228,19 @@
 8, %22
-AWARIA_PRZEGRZANIE
+OVERHEATING
 %22).%0A
@@ -1263,19 +1263,20 @@
 9, %22
-AWARIA
+CHANGE
 _FILT
+E
 R%22).
@@ -1297,28 +1297,30 @@
 ut(1
-0, %22AWARIA_FAKTURA_1
+2, %22DEFROSTING_FAILURE
 %22).%0A
@@ -1340,28 +1340,36 @@
 ut(1
-1, %22AWARIA_FAKTURA_2
+3, %22ROTARY_EXCHANGER_FAILURE
 %22).%0A
@@ -1389,31 +1389,35 @@
 ut(1
-2, %22AWARIA_ODSZRANIANIA
+4, %22FIRE_PROTECTION_ENABLED
 %22).%0A
@@ -1436,67 +1436,40 @@
 put(
-1
+5
 3, %22
-AWARIA_ROTOR%22).%0A            put(53, %22AWARIA_POLACZENIA
+EKOTOUCH_CONNECTION_FAILURE
 %22).%0A

Update message alerts