First verify compatibility with examples.modem.ReadMessages and change
parameters.

On Sun, May 2, 2010 at 9:43 PM, DigitLife <[email protected]> wrote:
> Hi
>
> I use the Samsung SHG-M610 USB connection.
> My program uses information SMSLib read as follows:
> Modem Information:
>  Manufacturer: Samsung
>  Model: Samsung SGH-M610
>  Serial No: 355 811 2001 237 101 0
>  SIM IMSI: ** ** masked
>  Signal Level: 93%
>  Battery Level: 75%
>
> Can I ask why not read the message.
>
> My code:
> public class SMSDemo {
>
>        private Service svr;
>
>        public SMSDemo() {
>                svr = new Service();
>                try {
>                        SerialModemGateway gateway = new 
> SerialModemGateway("modem.com1",
> "COM3", 9600, "", "");
>                        gateway.setProtocol(Protocols.PDU);
>                        gateway.setInbound(true);
>                        gateway.setOutbound(true);
>                        gateway.setSimPin("0000");
>
>
>                        svr.addGateway(gateway);
>
>                        try {
>                                svr.startService();
>                                System.out.println("Connected");
>
>                                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() +
>                                "%");
>                                System.out.println(" Battery Level: " +
>                                gateway.getBatteryLevel()
>                                + "%");
>                                System.out.println();
>                        } catch (TimeoutException e) {
>                                e.printStackTrace();
>                        } catch (SMSLibException e) {
>                                e.printStackTrace();
>                        } catch (IOException e) {
>                                e.printStackTrace();
>                        } catch (InterruptedException e) {
>                                e.printStackTrace();
>                        }
>                } catch (GatewayException e) {
>                        e.printStackTrace();
>                }
>
>        }
>
>        public void readMsg() {
>                if(svr != null) {
>                        try {
>                                InboundMessage[] msgList =
>                                        
> svr.readMessages(org.smslib.InboundMessage.MessageClasses.ALL);
>                                if(msgList.length > 0) {
>                                        System.out.println("Msg" + 
> msgList[0].getOriginator() + " -:-" +
> msgList[0].getText());
>                                }
>                        } catch (TimeoutException e) {
>                                // TODO Auto-generated catch block
>                                e.printStackTrace();
>                        } catch (GatewayException e) {
>                                // TODO Auto-generated catch block
>                                e.printStackTrace();
>                        } catch (IOException e) {
>                                // TODO Auto-generated catch block
>                                e.printStackTrace();
>                        } catch (InterruptedException e) {
>                                // TODO Auto-generated catch block
>                                e.printStackTrace();
>                        }
>                }
>        }
>
>        public static void main(String args[]) {
>                SMSDemo obj = new SMSDemo();
>                obj.readMsg();
>        }
> }
>
> --
> You received this message because you are subscribed to the Google Groups 
> "SMSLib User Group" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> 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 User Group" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/smslib?hl=en.

Reply via email to