Envoit des SMS avec SMSLib
Bonjour je souhaite utiliser smslib pour l'envoit des SMS. J'ai parcouru le tuto suivant:
http://blog.harshadura.net/2011/10/s...46776668048406
mais j'ai l'exception suivante:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| -----------------------------
*** SMS-DURA - GSM MODEM SMS API WRAPPER ***
www.harshadura.com
-----------------------------
Example: Send message from a serial gsm modem.
SMSLib: A Java API library for sending and receiving SMS via a GSM modem or other supported gateways.
This software is distributed under the terms of the Apache v2.0 License.
Web Site: http://smslib.org
Version: 3.5.2
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.PortInUseException: Port currently owned by Unknown Windows Application
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276) |
j(utilise un motorola L7 comme modem, et une liaison Bluetooth voilà mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| package logic;
import com.harshadura.gsm.smsdura.GsmModem;
public class TestSMS {
private static String port = "COM5"; //Modem Port.
private static int bitRate = 115200; //this is also optional. leave as it is.
private static String modemName = "Motorola L6"; //this is optional.
private static String modemPin = "0000"; //Pin code if any have assigned to the modem.
private static String SMSC = "+23790764181"; //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("+23794140369", "Test Message"); // (tp, msg)
}
} |
Deuxième problème j'aimerais que dans mon application se soit une seule machine connectée au modem qui puisse envoyé les sms.
Merci