hello...is there a way, a flag, a property or anything that i can use
to read only new/unread message(s) from the modem? i'm using a
sonyericsson w660 as my modem and do implement an inbound message
notifier but when the notifier being notified about a new incoming
message event, it reads not only new message but all the message(s)
from the modem...so as a workaround, i call the read all message
function once at the app start then comparing the hashcode of the
message string at the inbound notifier implementation by assuming that
the hashcode for each message will be unique, CMIIW...it is work, but
is there any "better" ways to do it?? below included the partial code:

...
private List<InboundMessage> msgList0 = new
ArrayList<InboundMessage>(); //messages read at start
private List<InboundMessage> msgList = new
ArrayList<InboundMessage>(); //messages read in notifier
....

outNotification = new OutboundNotification();
inNotification = new InboundNotification();
srv.setOutboundMessageNotification(outNotification);
srv.setInboundMessageNotification(inNotification);
srv.addGateway(gateway);
srv.startService();
System.out.println("device connected OK");
srv.readMessages(msgList0, InboundMessage.MessageClasses.ALL); //read
all messages
....

//notifier class
class InboundNotification implements IInboundMessageNotification {
        public void process(AGateway gateway, MessageTypes msgType,
InboundMessage msg) {
            boolean msgExists = false;
            ListIterator<InboundMessage> x = msgList0.listIterator();
            while (x.hasNext()) {
                if (x.next().toString().hashCode() ==
msg.toString().hashCode()) {
                    msgExists=true;
                    break;
                }
            }
            if (!msgExists) {
                msgList.add(msg);
                msgList0.add(msg);
                System.out.println("Incoming message notifier...");
                System.out.println(msg.toString());
            }
        }
    }

....

thanks in advance

-- 
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