使用Java通过USB gsm调制解调器发送短信

时间:2016-06-09 17:25:45

标签: java sms modem

最好的方法是什么?我已经读过它,但大多数主题已经过时了。大多数例子都使用" COM"端口,但我在COM连接中找不到我的USB调制解调器(在设备管理器中),而不是在#34;网卡&#34 ;.

1 个答案:

答案 0 :(得分:1)

希望此代码有所帮助:

 package logic;

import com.harshadura.gsm.smsdura.GsmModem;

public class TestSMS {

    private static String port = "COM3"; //Modem Port.
    private static int bitRate = 115200; //this is also optional. leave as it is.
    private static String modemName = "ZTE"; //this is optional.
    private static String modemPin = "0000"; //Pin code if any have assigned to the modem.
    private static String SMSC = "+9477000003"; //Message Center Number ex. Mobitel

    public static void main(String[] args) throws Exception {
        GsmModem gsmModem = new GsmModem();
        GsmModem.configModem(port, bitRate, modemName, modemPin, SMSC);
        gsmModem.Sender("+94712244555", "Test Message"); // (tp, msg) 
    } 
}

完整的答案和详情为at this article