欢迎来到天天文库
浏览记录
ID:34783852
大小:162.68 KB
页数:22页
时间:2019-03-10
《用java实现短信收发》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、6月2日Java实现的GSMModem短消息收发(三)怎么每一篇能贴的那么短,真痛苦。不是MSN的联系人有限制,就是hotmail的通讯录有限制,现在又是篇幅限制,唉....继续贴完吧,善始善终,呵呵。 //一个MSG类packagemodemGSM;publicclassOneMsg{publicStringsmContent="";publicStringdestination="";publicStringsentTime="";publicStringsmsAddr="";publicintSN=0;publicintdraftOrReceived
2、=1;}//ModemAdapter类,这个清楚了,基本上就没啥问题了packagemodemGSM;//packagecom.gftech.dp.adapter;importjava.io.DataInputStream;importjava.io.DataOutputStream;importjava.io.IOException;importjava.util.ArrayList;importjava.util.Enumeration;importjava.util.TooManyListenersException;importjavax.comm
3、.CommDriver;importjavax.comm.CommPortIdentifier;importjavax.comm.PortInUseException;importjavax.comm.SerialPort;importjavax.comm.SerialPortEvent;importjavax.comm.SerialPortEventListener;importjavax.comm.UnsupportedCommOperationException;//importorg.apache.log4j.BasicConfigurator;/
4、/importorg.apache.log4j.BasicConfigurator;//importorg.apache.log4j.BasicConfigurator;importorg.apache.log4j.Logger;importorg.apache.log4j.PropertyConfigurator;//importorg.apache.log4j.PropertyConfigurator;//importorg.apache.log4j.PropertyConfigurator;//importorg.apache.log4j.Prope
5、rtyConfigurator;/*importcom.gftech.dp.conf.ConfParam;importcom.gftech.dp.run.DPMain;importcom.gftech.protocol.SubmitPack;importcom.gftech.smp.SmpDeliverPack;importcom.gftech.smp.SmpSubmitPack;importcom.gftech.util.PduPack;*//***@authorsinboy**无线MODEM适配器。用来从MODEM发送短消息,以及从MODEM接收短消息
6、*/publicclassModemAdapterextendsThreadimplementsSerialPortEventListener{privatestaticModemAdaptermodem;//发送是否已成功完成privatebooleansendOKFlag;//publicbooleancommOpened;//privateHashMapsmsc;//privateHashMapsmsc;//privatebooleanrecOverFlag=false;privateinterrCount;//发送模式
7、是否是PDU方式privatebooleanisPduMode;privateStringsmContent;privateStringsmscAddress=null;privatePduPackpack;publicbooleanbStore=true;StringBufferstoredsb=newStringBuffer();privateShortMessagesm;privateArrayListsendBuffer;//privateArrayListsendBuffer;privateArrayListrecB
8、uffer;////要打开使用的串口publicSerialPor
此文档下载收益归作者所有