/*
 * Copyright (c) 2014 aleon GmbH.
 * 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:
 *    Markus Rathgeb - initial API and implementation and/or initial documentation
 */
package eu.aleon.aleoncean.packet.radio.userdata;

import eu.aleon.aleoncean.packet.radio.RadioPacket4BS;

/**
 *
 * @author Markus Rathgeb <maggu2810@gmail.com>
 */
public class UserData4BS extends UserData {

    public static final int DATA_LENGTH = 4;

    public UserData4BS() {
        super(DATA_LENGTH);
    }

    public UserData4BS(final byte[] data) {
        super(data);
        assert data.length == DATA_LENGTH;
    }

    public boolean isTeachIn() {
        return isTeachIn(getUserData());
    }

    public static boolean isTeachIn(final byte[] userData) {
        return getDataBit(userData, 0, 3) == 0;
    }

    @Override
    public RadioPacket4BS generateRadioPacket() {
        final RadioPacket4BS packet = new RadioPacket4BS();
        packet.setUserDataRaw(getUserData());
        return packet;
    }

}

@@ -640,16 +640,247 @@
 H = 4;%0A%0A
+    private static final int TEACH_IN_DB = 0;%0A    private static final int TEACH_IN_BIT = 3;%0A%0A    public static boolean isTeachIn(final byte%5B%5D userData) %7B%0A        return getDataBit(userData, TEACH_IN_DB, TEACH_IN_BIT) == 0;%0A    %7D%0A%0A
     publ
@@ -894,24 +894,24 @@
 Data4BS() %7B%0A
-
         supe
@@ -1140,33 +1140,24 @@
  public 
-static boolean is
+void set
 TeachIn(
@@ -1159,38 +1159,38 @@
 chIn(final b
-yte%5B%5D userData
+oolean teachIn
 ) %7B%0A        
@@ -1185,32 +1185,25 @@
 ) %7B%0A        
-return g
+s
 etDataBit(us
@@ -1204,28 +1204,51 @@
 Bit(
-userData, 0, 3) == 0
+TEACH_IN_DB, TEACH_IN_BIT, teachIn ? 0 : 1)
 ;%0A  

Add function to modify teach-in bit