Just figured that there is no "removeGateway()" method... I'll keep a note to add one.
In the meantime, use the "addGateway()" only once for the entire lifespan of your application. On Jul 13, 3:45 pm, EvilNick <[email protected]> wrote: > Yup Thanasis, this is my case. > > On Jul 13, 8:17 pm, Thanasis <[email protected]> wrote: > > > > > Hi Nick, > > > By the way you describe things, here is a possible flow: > > > 1) User presses "START". You define the gateway and add it to the > > service, then you start the service. > > 2) User presses "STOP". All is OK. > > 3) User presses "START" again: You define a second **SAME** gateway > > and add it. Now your service object has two gateways which refer to > > the same modem... > > > Is this your case??? > > > On Jul 13, 11:06 am, EvilNick <[email protected]> wrote: > > > > Yup, > > > > I'm using the latest version 3.4.1. > > > > Here's my error log:>>> Gateway Status change for modem.com1, OLD: > > > STARTED -> NEW: STOPPING > > > > Jul 13, 2009 4:01:22 PM org.smslib.helper.Logger logInfo>>> Gateway > > > Status change for modem.com1, OLD: STOPPING -> NEW: STOPPED > > > > INFO: GTW: modem.com1: Stopping gateway... > > > Jul 13, 2009 4:01:22 PM org.smslib.helper.Logger logInfo > > > INFO: GTW: modem.com1: Closing: COM4 @460800 > > > Jul 13, 2009 4:01:22 PM org.smslib.helper.Logger logInfo > > > INFO: GTW: modem.com1: Gateway stopped. > > > Jul 13, 2009 4:01:27 PM org.smslib.helper.Logger logInfo > > > INFO: GTW: modem.com1: Starting gateway, using Generic AT Handler. > > > Jul 13, 2009 4:01:27 PM org.smslib.helper.Logger logInfo > > > INFO: GTW: modem.com1: Starting gateway, using Generic AT Handler. > > > Jul 13, 2009 4:01:27 PM org.smslib.helper.Logger logInfo > > > INFO: GTW: modem.com1: Opening: COM4 @460800 > > > Jul 13, 2009 4:01:27 PM org.smslib.helper.Logger logInfo > > > INFO: GTW: modem.com1: Opening: COM4 @460800>>> Gateway Status change for > > > modem.com1, OLD: STOPPED -> NEW: RESTART > > > > org.smslib.GatewayException: Comm library exception: > > > java.lang.RuntimeException: javax.comm.PortInUseException: Port > > > currently owned by org.smslib > > > at org.smslib.modem.SerialModemDriver.connectPort > > > (SerialModemDriver.java:99) > > > at org.smslib.modem.AModemDriver.connect(AModemDriver.java: > > > 110) > > > at org.smslib.modem.ModemGateway.startGateway > > > (ModemGateway.java:158) > > > at org.smslib.Service$1Starter.run(Service.java:239) > > > > Here's my Connect button code: > > > > int speed = 460800; > > > String port = "COM4"; > > > > try > > > { > > > // Create the Gateway representing the serial GSM > > > modem. > > > gateway = new SerialModemGateway("modem.com1", > > > port, speed, "GSM > > > MODEM", ""); > > > > // 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); > > > gateway.setOutbound(true); > > > > // Set up the notification methods. > > > srv.setInboundNotification(inboundNotification); > > > srv.setCallNotification(callNotification); > > > > > > srv.setGatewayStatusNotification(statusNotification); > > > > srv.addGateway(gateway); > > > srv.startService(); > > > srv.getKeyManager().registerKey("+2181", new > > > AESKey(new > > > SecretKeySpec("0011223344556677".getBytes(), "AES"))); > > > > } > > > catch (Exception e) > > > { > > > e.printStackTrace(); > > > } > > > > On Jul 11, 5:48 pm, Thanasis <[email protected]> wrote: > > > > > Latest version? > > > > > On Jul 11, 5:06 am, EvilNick <[email protected]> wrote: > > > > > > I'm having the exact same error/problem too. > > > > > > I have a button in my GUI which creates a gateway and adds it to the > > > > > service and followed by starting this service. > > > > > > And another button called Disconnect which calls srv.stopService(). > > > > > > Anyone with fixes or similar problem? > > > > > > On May 29, 3:15 am, Thanasis <[email protected]> wrote: > > > > > > > Hi, > > > > > > > I cannot reproduce this. > > > > > > What I did is I modified the ReadMessages sample and called > > > > > > startService() immediately after the stopService(). Its working > > > > > > fine. > > > > > > > Are you certain you call stopService() as described? In some cases, > > > > > > stopService() may take a while (if called during a read/send > > > > > > operation) - are you calling the second startService() quick enough > > > > > > - > > > > > > maybe before stopService() returns? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
