package com.openxc.measurements;

import java.util.Locale;

import com.openxc.units.State;
import com.openxc.units.KeylessEntryCode;

public class KeylessEntryProgrammingCommand extends BaseMeasurement<
        State<KeylessEntryProgrammingCommand.Command>> {
    public final static String ID = "keyless_entry_command";

    public enum Command {
        ADD,
        ERASE,
        AUTHENTICATE
    }

    public KeylessEntryProgrammingCommand(State<Command> command,
            KeylessEntryCode code) {
        super(command, code);
    }

    public KeylessEntryProgrammingCommand(Command command,
            String code) {
        super(new State<Command>(command), new KeylessEntryCode(code));
    }

    public KeylessEntryProgrammingCommand(String command, String code) {
        this(Command.valueOf(command.toUpperCase(Locale.US)), code);
    }

    @Override
    public String getSerializedValue() {
        return getValue().enumValue().toString();
    }

    @Override
    public String getGenericName() {
        return ID;
    }
}

@@ -77,20 +77,31 @@
 c.units.
-Stat
+KeylessEntryCod
 e;%0Aimpor
@@ -119,31 +119,20 @@
 c.units.
-KeylessEntryCod
+Stat
 e;%0A%0Apubl
@@ -694,32 +694,144 @@
 (code));%0A    %7D%0A%0A
+    public KeylessEntryProgrammingCommand(Command command) %7B%0A        super(new State%3CCommand%3E(command));%0A    %7D%0A%0A
     public Keyle
@@ -1067,32 +1067,215 @@
 tring();%0A    %7D%0A%0A
+    @Override%0A    public String getEvent() %7B%0A        return (String) super.getEvent();%0A    %7D%0A%0A    @Override%0A    public String getSerializedEvent() %7B%0A        return getEvent();%0A    %7D%0A%0A
     @Override%0A  

Add proper event serialization for KeylessEntryProgrammingCommand.