我可以在我的代码上看到更改消息,但接收方会收到不同的消息。正如您在下面的结果中看到的那样,发送的消息是“测试消息”。请帮忙:(
OutboundNotification outboundNotification = new OutboundNotification();
System.out.println("Example: Send message from a serial gsm modem.");
System.out.println(Library.getLibraryDescription());
System.out.println("Version: " + Library.getLibraryVersion());
SerialModemGateway gateway = new SerialModemGateway("modem.com1","COM6",115200, "Huawei", "");
gateway.setInbound(true);
gateway.setOutbound(true);
gateway.setSimPin("0000");
Service.getInstance().setOutboundMessageNotification(outboundNotification);
Service.getInstance().addGateway(gateway);
Service.getInstance().startService();
System.out.println();
System.out.println("Modem Information:");
System.out.println(" Manufacturer: " + gateway.getManufacturer());
System.out.println(" Model: " + gateway.getModel());
System.out.println(" Serial No: " + gateway.getSerialNo());
System.out.println(" SIM IMSI: " + gateway.getImsi());
System.out.println(" Signal Level: " + gateway.getSignalLevel() + " dBm");
System.out.println(" Battery Level: " + gateway.getBatteryLevel() + "%");
System.out.println();
// Send a message synchronously.
OutboundMessage msg = new OutboundMessage("09085928249", "que onda como andas!");
Service.getInstance().sendMessage(msg);
System.out.println(msg);
System.out.println("Now Sleeping - Hit <enter> to terminate.");
System.in.read();
Service.getInstance().stopService();
}
结果
Gateway Id: modem.com1
Message Id: 0
Message UUID: eeecf9ba-5cb6-49f3-a20f-4e1901e2527a
Encoding: 7-bit
Date: Thu Jan 26 18:24:18 CST 2017
SMSC Ref No: 95
Recipient: +639085928249
Dispatch Date: Thu Jan 26 18:24:22 CST 2017
Message Status: SENT
Failure Cause: NO_ERROR
Validity Period (Hours): -1
Status Report: false
Source / Destination Ports: -1 / -1
Flash SMS: false
Text: Test Message
PDU data: D4F29C0E6A96E7F3F0B90C
Scheduled Delivery: null