⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cycloc.java

📁 中国移动定位引擎的客户端
💻 JAVA
字号:
/**
* <p>Title: Smgp协议解析</p>
* <p>Description: SMGW 向MSP 下发短消息的操作包</p>
* <p>Company: 福富软件 </p>
* @author chenxin
* @version 1.0 $Date 2007-07-05
*/
package ffcs.lbp.le.message;

import java.io.IOException;
import java.nio.ByteBuffer;

import ffcs.lbp.MessageParseException;
import ffcs.lbp.le.message.tlv.TLVTable;
import ffcs.lbp.le.message.tlv.Tag;

public class CycLoc extends LeMessage {




	private int   Interval; 	
	private int  StartTime	;
	private int  StopTime	;
	private int  Duration;
	private TLVTable IsdnRange=null;

	

	

	private int lenInterval=4;
	private int lenStartTime=4;
	private int lenStopTime=4;
	private int lenDuration=4;
	private int lenMessageBody= lenInterval+lenStartTime
								+ lenStopTime + lenDuration;
	
	
	public CycLoc() {
        super(CycLoc);
    }
	
	
	
	
	
	public int getBodyLength() {
	    int len = lenMessageBody ;
	    if (IsdnRange!=null){
			len+=IsdnRange.getLength();
		}
              
        return len;
        
        
        
    }
	
	
	/**
     * 读取协议包的包体
     * @param buf ByteBuffer
     * @throws MessageParseException
     * @return boolean
     */
    protected boolean readBody(ByteBuffer buf) throws
            LeProtocolException{
    	Interval=buf.getInt();
		StartTime=buf.getInt();
		StopTime=buf.getInt();
		Duration=buf.getInt();
    	int len = PackLength -HEADER_LENGTH-getBodyLength();
        
    	if (len>0){
    	    byte[] byteTemp=new byte[len];
			buf.get(byteTemp);
			IsdnRange = new TLVTable();
			IsdnRange.readFrom(byteTemp,0,len);
    		}


    	return true;
    }


    /**
     * 读取协议包的包体
     * @param buf ByteBuffer
     * @return boolean
     */
    protected  boolean writeBody(ByteBuffer buf){
    	

    	return true;
    }

    /**
     * Convert this packet to a String. Not to be interpreted programmatically,
     * it's just dead handy for debugging!
     */
    public String toString() {

        StringBuffer sb=new StringBuffer("CycLoc:");
	    sb.append(super.toString());
	    

        
        sb.append("Interval");
        sb.append("=");
        sb.append(Interval);
        sb.append(" ");
        
        sb.append("StartTime");
        sb.append("=");
        sb.append(StartTime);
        sb.append(" ");
        
        sb.append("StopTime");
        sb.append("=");
        sb.append(StopTime);
        sb.append(" ");
        
        sb.append("Duration");
        sb.append("=");
        sb.append(Duration);
        sb.append(" ");
        
	    sb.append("IsdnRange");
        sb.append("=");
        if(IsdnRange!=null){
        sb.append(IsdnRange.toString());
        }
        sb.append(" ");

        
        return sb.toString();
        
    }





	public int getDuration() {
		return Duration;
	}





	public void setDuration(int duration) {
		Duration = duration;
	}





	public int getInterval() {
		return Interval;
	}





	public void setInterval(int interval) {
		Interval = interval;
	}





	public TLVTable getIsdnRange() {
		return IsdnRange;
	}





	public void setIsdnRange(TLVTable isdnRange) {
		IsdnRange = isdnRange;
	}





	public int getStartTime() {
		return StartTime;
	}





	public void setStartTime(int startTime) {
		StartTime = startTime;
	}





	public int getStopTime() {
		return StopTime;
	}





	public void setStopTime(int stopTime) {
		StopTime = stopTime;
	}


	
	
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -