this code Connect button :
public void openConnection(mod_conPort port) throws Exception {
        // Define a list which will hold the read messages.
                BasicConfigurator.configure();
                List<InboundMessage> msgList;
                // Create the notification callback method for inbound & status
report
                // messages.

                try
                {
                        System.out.println("Example: Read messages from a 
serial gsm
modem.");
                        System.out.println(Library.getLibraryDescription());
                        System.out.println("Version: " + 
Library.getLibraryVersion());
                        // Create the Gateway representing the serial GSM modem.
                        gateway = new SerialModemGateway("modem.com7", "COM7", 
115200,
"Wavecomm", "");
                        // Set the modem protocol to PDU (alternative is TEXT). 
PDU is the
default, anyway...
                        gateway.setProtocol(Protocols.PDU);
                        // Do we want the Gateway to be used for Inbound 
messages?
                        gateway.setInbound(true);
                        // Do we want the Gateway to be used for Outbound 
messages?
                        gateway.setOutbound(true);
                        // Let SMSLib know which is the SIM PIN.
                        gateway.setSimPin("0000");
                        // Set up the notification methods.
        
Service.getInstance().setInboundMessageNotification(inboundNotification);
                        
Service.getInstance().setCallNotification(callNotification);
        
Service.getInstance().setGatewayStatusNotification(statusNotification);
        
Service.getInstance().setOrphanedMessageNotification(orphanedMessageNotification);
                        // Add the Gateway to the Service object.
                        Service.getInstance().addGateway(gateway);
                        // Similarly, you may define as many Gateway objects, 
representing
                        // various GSM modems, add them in the Service object 
and control
all of them.
                        // Start! (i.e. connect to all defined Gateways)
                        Service.getInstance().startService();
                        // Printout some general information about the modem.
                        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()
+ "%");

                        // Read Messages. The reading is done via the Service 
object and
                        // affects all Gateway objects defined. This can also 
be more
directed to a specific
                        // Gateway - look the JavaDocs for information on the 
Service
method calls.
                        msgList = new ArrayList<InboundMessage>();
                        Service.getInstance().readMessages(msgList, 
MessageClasses.ALL);
                        for (InboundMessage msg : msgList)
                                System.out.println("msg: "+msg.getText());


                }
                catch (Exception e)
                {
                        e.printStackTrace();
                }

    }

new error:
org.smslib.GatewayException: Comm library exception:
java.lang.RuntimeException: javax.comm.PortInUseException: Port
currently owned by Unknown Windows Application
        at
org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:
102)
        at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
        at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
        at org.smslib.Service$1Starter.run(Service.java:276)


pleace help,
how I can use the gateway open and close the gateway,
I hope you can understand what I mean

thank you

On Feb 28, 6:13 pm, Abdeljebbar BOUARFA <[email protected]> wrote:
> show me the code of the Connect button.
>
> 2012/2/28 edy <[email protected]>
>
>
>
>
>
>
>
> > thanks for replies,
> > so in my application there are action buttons to connect and
> > disconnect the modem,
> > according to the instructions for connecting
> >http://smslib.org/doc/smslib/quickstart/
> > and running properly,
> > but to disconnect my call
> >     Service.getInstance (). StopService ();
> >     Service.getInstance (). RemoveGateway (this.gateway);
> >     this.gateway.stopGateway ();
> > I recall the connect button does not work
> > This output from smslib
>
> > java.lang.NullPointerException
> >        at org.smslib.modem.SerialModemDriver.write(SerialModemDriver.java:
> > 166)
> >        at org.smslib.modem.AModemDriver.write(AModemDriver.java:302)
> >        at
> > org.smslib.modem.athandler.ATHandler_Wavecom.done(ATHandler_Wavecom.java:
> > 52)
> >        at org.smslib.modem.ModemGateway.stopGateway(ModemGateway.java:198)
> >        at org.smslib.Service.stopService(Service.java:354)
> >        at org.smslib.Service.startService(Service.java:233)
> >        at org.smslib.Service.startService(Service.java:196)
>
> > On Feb 27, 10:34 pm, Abdeljebbar BOUARFA <[email protected]> wrote:
> > > hi
> > > before start service you have to add the gateway
>
> > > something lik that
>
> > > Service.getInstance().addGateway(gateway);
>
> > > Abdel
>
> > > 2012/2/27 edy <[email protected]>
>
> > > > how to run again after Service.getInstance () stopService () on call,
> > > > I have used Service.getInstance () startService () but it does not
> > > > work
>
> > > > please help
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "SMSLib Discussion 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 Discussion 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 Discussion 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