package org.meal.util;
public class BLOCK_DATA {
private String _mtype; //主類型 2字符長度
private String _subtype; //次類型 2字符長度
private String shopid; //五位商戶號
private String dataLen;
private String _DataBody;
public String BLOCK2String(BLOCK_DATA bh)
{
String tem="";
tem+=_subtype;
tem+=_mtype;
tem+=shopid;
tem+=dataLen;
tem+=_DataBody;
return tem;
}
public String chek;//校驗數據位
public String getShopid() {
return shopid;
}
public void setShopid(String shopid) {
this.shopid = shopid;
}
public String get_mtype() {
return _mtype;
}
public void set_mtype(int _mtype) {
this._mtype = String.format("%02d", _mtype);
}
public String get_subtype() {
return _subtype;
}
public void set_subtype(int _subtype) {
this._subtype =String.format("%02d", _subtype);;
}
public String getDataLen() {
return dataLen;
}
public void setDataLen(String dataLen) {
this.dataLen = dataLen;
}
public String get_DataBody() {
return _DataBody;
}
public void set_DataBody(String _DataBody) {
this._DataBody = _DataBody;
}
public String getChek() {
return chek;
}
public void setChek(String chek) {
this.chek = chek;
}
}
其次定義常量
package org.meal.util;
public final class Constants {
//私有構造方法
private Constants() {}
public static final int LIVE = 1;
public static final int BYE = 2;
public static final int REFRESH = 3; //刷新功能
public static final int STOP = 4;
public static final int DATA = 5; //數據
public static final int PRINT = 6; //打印
public static final int MENU = 7; //菜單
}
複製代碼