/protocols/ss7/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/parameter/RegistrationStatusImpl.java
http://mobicents.googlecode.com/ · Java · 76 lines · 38 code · 12 blank · 26 comment · 0 complexity · 107675154792375d7da9f9e424dc9e67 MD5 · raw file
- /*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
- package org.mobicents.protocols.ss7.m3ua.impl.parameter;
- import org.mobicents.protocols.ss7.m3ua.parameter.Parameter;
- import org.mobicents.protocols.ss7.m3ua.parameter.RegistrationStatus;
- /**
- *
- * @author amit bhayani
- *
- */
- public class RegistrationStatusImpl extends ParameterImpl implements
- RegistrationStatus {
- private int status;
- public RegistrationStatusImpl(byte[] data) {
- this.status = 0;
- this.status |= data[0] & 0xFF;
- this.status <<= 8;
- this.status |= data[1] & 0xFF;
- this.status <<= 8;
- this.status |= data[2] & 0xFF;
- this.status <<= 8;
- this.status |= data[3] & 0xFF;
- this.tag = Parameter.Registration_Status;
- }
- public RegistrationStatusImpl(int status) {
- this.tag = Parameter.Registration_Status;
- this.status = status;
- }
- @Override
- protected byte[] getValue() {
- byte[] data = new byte[4];
- data[0] = (byte) (status >>> 24);
- data[1] = (byte) (status >>> 16);
- data[2] = (byte) (status >>> 8);
- data[3] = (byte) (status);
- return data;
- }
- public int getStatus() {
- return this.status;
- }
- @Override
- public String toString() {
- return String.format("RegistrationStatus status=%d", status);
- }
- }