Hi, I'm working with a ZTE MF622 modem. When I send the sms it returns me
"Message Status: FAILED" I do not understand why. Can you help me?
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package prueba2;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.smslib.SMSLibException;
/**
*
* @author FLAVIO
*/
public class App {
public static void main(String...args){
SendMessage app = new SendMessage();
try {
app.sendSms();
} catch (SMSLibException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null,
ex);
} catch (IOException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null,
ex);
} catch (InterruptedException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null,
ex);
}
}
}
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package prueba2;
import org.smslib.AGateway;
import org.smslib.IOutboundMessageNotification;
import org.smslib.OutboundMessage;
/**
*
* @author FLAVIO
*/
public class OutboundNotification implements IOutboundMessageNotification {
public void process(AGateway gateway, OutboundMessage msg)
{
System.out.println("Outbound handler called from Gateway: " +
gateway.getGatewayId());
System.out.println(msg);
}
}
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package prueba2;
import java.io.IOException;
import org.smslib.GatewayException;
import org.smslib.Library;
import org.smslib.OutboundMessage;
import org.smslib.SMSLibException;
import org.smslib.Service;
import org.smslib.TimeoutException;
import org.smslib.modem.SerialModemGateway;
/**
*
* @author FLAVIO
*/
public class SendMessage {
public void sendSms() throws GatewayException, SMSLibException,
TimeoutException, IOException, InterruptedException{
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.com4",
"COM4", 115200, "Claro", "ZTE");
SerialModemGateway gateway = new SerialModemGateway("ZTE
MF622","COM4", 115200, "ZTE INCORPORATED", "MF622");
gateway.getATHandler().setStorageLocations("SMMTME");
gateway.setInbound(true);
gateway.setOutbound(true);
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(" ID: " + gateway.getGatewayId());
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();
OutboundMessage msg = new OutboundMessage("+549261xxxxxxx", "Hello
from SMSLib!");
gateway.getModemDriver().write("AT+CFUN=1");
Service.getInstance().sendMessage(msg);
System.out.println(msg);
System.out.println("Now Sleeping - Hit <enter> to terminate.");
System.in.read();
Service.getInstance().stopService();
}
}
Thanks!
El viernes, 8 de enero de 2010, 6:59:37 (UTC-3), Dustin Cheng escribió:
>
> Oh btw, the modem also doesn't seem to turn on by itself. I had to send
> AT+CFUN=1 everytime before I use it. Maybe we can include that also into
> the AT Handler for that model :)
>
> Thanks again!
>
> On Fri, Jan 8, 2010 at 5:35 PM, Thanasis <[email protected] <javascript:>
> > wrote:
>
>> Good! I've created an issue in order to create a special at handler
>> for your modem.
>>
>> http://code.google.com/p/smslib/issues/detail?id=311
>>
>> Cheers :)
>>
>> On Jan 8, 11:20 am, Dustin Cheng <[email protected]> wrote:
>> > Great! It works fine now. And yes, I had to use the "SMME" otherwise I
>> get
>> > duplicate messages.
>> >
>> > Thanks a lot Thanasis :) Cheers!
>> >
>> >
>> >
>> > On Fri, Jan 8, 2010 at 4:55 PM, Thanasis <[email protected]> wrote:
>> > > Edit the ReadMessages source. Locate the line:
>> >
>> > > SerialModemGateway gateway = new SerialModemGateway("modem.com1",
>> > > "COM1", 57600, "Nokia", "");
>> >
>> > > After this line, add the following one:
>> >
>> > > gateway.getATHandler().setStorageLocations("SMMTME");
>> >
>> > > Recompile and run once more. If you get duplicate inbound messages,
>> > > modify the line as follows:
>> >
>> > > gateway.getATHandler().setStorageLocations("SMME");
>> >
>> > > and try once more.
>> >
>> > > --
>> > > You received this message because you are subscribed to the Google
>> Groups
>> > > "SMSLib for Java User Group" group.
>> > > To post to this group, send email to [email protected]
>> <javascript:>.
>> > > To unsubscribe from this group, send email to
>> > > [email protected] <javascript:><
>> smslib%[email protected] <javascript:>>
>> > > .
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/smslib?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "SMSLib for Java User Group" group.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>.
>> For more options, visit this group at
>> http://groups.google.com/group/smslib?hl=en.
>>
>>
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"SMSLib Discussion Group" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/smslib/02b25739-0090-44cf-8dfe-3ee8438d9cba%40googlegroups.com.