* if (submit.isLong()) { // ������ // submit.getMsgContent().length; }
* else { }
*/
if (submit.getMsgContent().length > 200) {
return (new Result(4, "Message too Long"));
}
Vector<Tlv> tlv = new Vector<Tlv>();
if (this.SPID != null && !this.SPID.equals("")) {
tlv.add(new Tlv(TlvId.MsgSrc, this.SPID));
}
if (submit.getProductID() != null && !submit.getProductID().equals("")) {
tlv.add(new Tlv(TlvId.Mserviceid, submit.getProductID()));
}
if (submit.getTP_udhi()==1){
tlv.add(new Tlv(TlvId.TP_udhi,String.valueOf(1)));
}
if (submit.getLinkID() != null && !submit.getLinkID().equals("")) {
tlv.add(new Tlv(TlvId.LinkID, submit.getLinkID()));
}
if (submit.getOtherTlvArray() != null) {
for (int i = 0; i < submit.getOtherTlvArray().length; i++) {
tlv.add(submit.getOtherTlvArray()[i]);
}
}
Tlv[] tlvarray = new Tlv[tlv.size()];
// System.out.println("tlvlen:"+tlv.size());
for (int i = 0; i < tlv.size(); i++) {
// System.out.println(((Tlv)tlv.get(i)).Value);
tlvarray[i] = (Tlv) tlv.get(i);
}
String[] desttermidarray = new String[1];
desttermidarray[0] = submit.getDestTermid();
if (SequenceId++ == 0x7FFFFF) {
SequenceId = 0;
}
int tmpseq = SequenceId;
SubmitMessage sm = new SubmitMessage(submit.getMsgType(), submit
.getNeedReport(), submit.getPriority(), submit.getServiceID(),
submit.getFeetype(), submit.getFeeCode(), submit.getFixedFee(),
submit.getMsgFormat(), submit.getValidTime(), submit
.getAtTime(), submit.getSrcTermid(), submit
.getChargeTermid(), desttermidarray, submit
.getMsgLength(), submit.getMsgContent(), submit
.getReserve(), tlvarray, tmpseq);
try {
// System.out.println(Hex.rhex(sm.getBuf()));
SendBuf(sm.getBuf());
// out.write(sm.getBuf());
if (this.DisplayMode >= 2) {
DisplayPackage(sm.getBuf(), 1);
}
} catch (IOException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
return (new Result(-1, "Socket Error!"));
}
long sendTime = getTimeStamp();
/*
* while ((getTimeStamp() - sendTime) < 60000 && (this.CurPack == null
* || this.CurPack.ReqestId != RequestId.Submit_Resp ||
* this.CurPack.SequenceId != tmpseq)) {
*/
Package tmppack = new Package();
while ((getTimeStamp() - sendTime) < 60000
&& ((tmppack = checkPackage(tmpseq, RequestId.Submit_Resp)) == null)) {
// checkPackage(int, int)
try {
synchronized (this) {
wait(60000);
}
} catch (RuntimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (tmppack != null) {
SubmitRespMessage srm = new SubmitRespMessage(tmppack.Message);
return (new Result(srm.getStatus(), srm.getMsgID()));
} else {
System.out.println("SubmitResp��ʱ��" + "Seq:" + tmpseq);
return (new Result(-1, "00000000000000000000"));
}
// if (srm==null) {
// return (new Result(-1,"Login Fail"));