salut j'ai un projet de exchange les données entre le PC et le Portable a l'aide de l'API SMSLib voi la mon code ms il ne marche pas :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
 
import java.net.*;
import java.org.smslib.*;
import org.smslib.gateway.ModemGateway;
import org.smslib.gateway.SerialModemGateway;
 
public class SendMessage
{
public void doIt() throws Exception
{
Service srv;
OutboundMessage msg;
 
OutboundNotification outboundNotification = new OutboundNotification();
 
System.out.println("Example: Send message from a serial gsm modem.");
System.out.println(Library.LIB_INFOTEXT);
System.out.println("Version: " + Library.LIB_VERSION + "." + Library.LIB_RELEASE + "." + Library.LIB_SUBRELEASE);
 
srv = new Service();
 
 
srv.startService();
 
 
// Send a message synchronously.
msg = new OutboundMessage("+306948494037", "Hello World!");
srv.sendMessage(msg);
System.out.println(msg);
 
// Or, send out a WAP SI message.
OutboundWapSIMessage wapMsg = new OutboundWapSIMessage("+306948494037", new URL("https://mail.google.com/"), "Visit GMail now!");
srv.sendMessage(wapMsg);
System.out.println(wapMsg);
 
// You can also queue some asynchronous messages to see how the callbacks
// are called...
msg = new OutboundMessage("+309999999999", "Wrong number!");
msg.setPriority(OutboundMessage.Priorities.LOW);
srv.queueMessage(msg, gateway.getGatewayId());
msg = new OutboundMessage("+308888888888", "Wrong number!");
msg.setPriority(OutboundMessage.Priorities.HIGH);
srv.queueMessage(msg, gateway.getGatewayId());
 
System.out.println("Now Sleeping - Hit <enter> to terminate.");
System.in.read();
 
srv.stopService();
}
 
public class OutboundNotification implements IOutboundMessageNotification
{
public void process(String gatewayId, OutboundMessage msg)
{
System.out.println("Outbound handler called from Gateway: " + gatewayId);
System.out.println(msg);
}
}
 
public static void main(String args[])
{
SendMessage app = new SendMessage();
try
{
app.doIt();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}