yes Following codes, I have written and doing testing with the same code

package com.ems.scp;

import java.io.IOException;
import org.smslib.GatewayException;
import org.smslib.OutboundMessage;
import org.smslib.SMSLibException;
import org.smslib.Service;
import org.smslib.TimeoutException;
import org.smslib.AGateway.Protocols;
import org.smslib.Service.ServiceStatus;
import org.smslib.modem.SerialModemGateway;

public class Test {
        //SMSLib class objects
        private Service c_service = null;
        private SerialModemGateway c_gateway = null;
        private OutboundMessage c_outboundMessage = null;
        
        private String c_sGatewayId = null;
        private String c_sDevicePort = null;
        private Integer c_iBaudrate = 0;
        private String c_sManufacturer = null;
        private String c_sModelInfo = null;

        //Method fetching and initializing modem information from DB.
        private void initializeModemInformation()
        {
                System.out.println("SendSmsProcess.initializeModemInformation()
Entered SendSmsProcess");
                
                c_sGatewayId = "gateway1";
                c_sDevicePort = "/dev/ttyS4";
                c_iBaudrate = 115200;
                c_sManufacturer = "WAVECOM";
                c_sModelInfo = "900E";

                try{
                        
System.out.println("SendSmsProcess.initializeModemInformation()
Service Status: "+ c_service.getServiceStatus());
                        c_gateway =new SerialModemGateway(c_sGatewayId, 
c_sDevicePort,
c_iBaudrate, c_sManufacturer, c_sModelInfo);
                        //Setting parameters for Modem
                        c_gateway.setInbound(false);
                        c_gateway.setOutbound(true);
                        c_gateway.setProtocol(Protocols.PDU);
                        
                        
System.out.println("SendSmsProcess.initializeModemInformation()
Gateway is now trying to add ..");

                        c_service.addGateway(c_gateway);
                        
                        
System.out.println("SendSmsProcess.initializeModemInformation()
Gateway is added ..");
        
                } catch(GatewayException ge){
                        ge.printStackTrace();
                        
System.err.println("SendSmsProcess.initializeModemInformation()
Error in adding Gateway "+ge.getMessage());
                }
                System.out.println("SendSmsProcess.initializeModemInformation() 
Exiting... ");
        }
        
        private void startSendingMessages() {
                
                String f_sRecipentNumber = null;
                String f_sSmsText = "";
                int f_count = 0;
                System.out.println("SendSmsProcess.startSendingMessages() 
Entered ");
                while(f_count<10) {
                        try{
                                
                                
                                
                                if(c_service.getServiceStatus() == 
ServiceStatus.STOPPED) {
                                        initializeModemInformation();
                                        
System.out.println("SendSmsProcess.startSendingMessages() Modem
parameters are initialized ");
                                        
                                        c_service.startService();
                                        
System.out.println("SendSmsProcess.startSendingMessages() Service
is started ..");
                                        
                                        
System.out.println("SendSmsProcess.startSendingMessages() Modem
Information:");
                                        
System.out.println("SendSmsProcess.startSendingMessages()
Manufacturer: " + c_gateway.getManufacturer());
                                        
System.out.println("SendSmsProcess.startSendingMessages()  Model:
" + c_gateway.getModel());
                                        
System.out.println("SendSmsProcess.startSendingMessages()  Serial
No: " + c_gateway.getSerialNo());
        
                                        
System.out.println("SendSmsProcess.startSendingMessages()  SIM
IMSI: " + c_gateway.getImsi());
                                        
System.out.println("SendSmsProcess.startSendingMessages()  Signal
Level: " + c_gateway.getSignalLevel() + "%");
                                        
System.out.println("SendSmsProcess.startSendingMessages()
Battery Level: " + c_gateway.getBatteryLevel() + "%");
                                }
                                if(c_service.getServiceStatus() == 
ServiceStatus.STARTED){
                                        
System.out.println("SendSmsProcess.startSendingMessages() Service
is running ");

                                        for(int f_iInc = 0; f_iInc<1; f_iInc++) 
{       
                                                
                                                f_sRecipentNumber = ""; //Holds 
recipient number
                                                f_sSmsText = " OMC-R : Hello 
from OMC-R Server, Alert has been
received, By Daya S Chaubey";
                                
                                                c_outboundMessage = new 
OutboundMessage(f_sRecipentNumber, f_sSmsText);

                                                
c_outboundMessage.setValidityPeriod(48);
                                                
c_outboundMessage.setRetryCount(3);
                                
                                                
if(c_service.sendMessage(c_outboundMessage))
                                                        
System.out.println("SendSmsProcess.startSendingMessages() SMS
Sent Successfully to the recipient "+f_sRecipentNumber);
                                                else
                                                        
System.err.println("SendSmsProcess.startSendingMessages()
Failed to send SMS to the recipent "+f_sRecipentNumber);
                                                
                                        }
                                        
                                                
System.out.println("SendSmsProcess.startSendingMessages()
Stopping the service ");
                                                c_service.stopService();
                                                
System.out.println("SendSmsProcess.startSendingMessages()
Removing Gateway ");
                                                
c_service.removeGateway(c_gateway);
                                                
System.out.println("SendSmsProcess.startSendingMessages()
Service stopped successfully ");
                                        
                                }else {
                                        
System.err.println("SendSmsProcess.startSendingMessages() Service
is not running, could not send SMS ");
                                }
                                
                        }catch(TimeoutException te){
                                te.printStackTrace();
                                
System.err.println("SendSmsProcess.startSendingMessages() Could
not start/stop service : Timeout "+te.getMessage());
                        }catch(GatewayException ge){
                                ge.printStackTrace();
                                
System.err.println("SendSmsProcess.startSendingMessages() Could
not start/stop service : Gateway Error "+ge.getMessage());
                        }catch(IOException ioe){
                                ioe.printStackTrace();
                                
System.err.println("SendSmsProcess.startSendingMessages() Could
not start/stop service : IO Error "+ioe.getMessage());
                        }catch(InterruptedException ie) {
                                ie.printStackTrace();
                                
System.err.println("SendSmsProcess.startSendingMessages() Could
not start/stop service : Interrupted Error "+ie.getMessage());
                                
System.err.println("SendSmsProcess.startSendingMessages() Problem
in reading queue element ");
                        }catch(SMSLibException smse){
                                smse.printStackTrace();
                                
System.err.println("SendSmsProcess.startSendingMessages() Could
not start service : SMSLib Error "+smse.getMessage());
                        }
                        f_count++;
                }
        }
        public static void main(String args[]) {
                Test obj = new Test();
                
                obj.startSendingMessages();
        }
}


Please help me..



On 12/22/09, Thanasis <[email protected]> wrote:
> Cannot reproduce...
> It this a modified SendMessage sample? Can you remove the recipient's
> number and post the code?
>
> On Dec 22, 10:42 am, Daya Shanker <[email protected]> wrote:
>> yes, I wait long time, but control did not return to the point where I
>> called stopService method.
>> The same code I tested with release 3.4.2, It is working perfectly
>> fine. In this release I dont have to wait.
>>
>> this problem is coming with the latest release only.
>>
>> Thanks for reply..
>>
>> On 12/22/09, Thanasis <[email protected]> wrote:
>>
>>
>>
>>
>>
>> > There is a delay in shutting down the Service class. Did you wait and
>> > see if it closed successfully?
>>
>> > On Dec 22, 8:50 am, Daya Shanker <[email protected]> wrote:
>> >> yes I am usiing latest version: 3.4.4?
>>
>> >> Please reply me solution for the same problem..
>>
>> >> Thanks for helping..
>> >> Regds..
>> >> Daya
>>
>> >> On 12/22/09, Thanasis <[email protected]> wrote:
>>
>> >> > What version are you using? A similar error was solved in the latest
>> >> > one.
>>
>> >> > On Dec 22, 8:09 am, j2ee <[email protected]> wrote:
>> >> >> Hello,
>>
>> >> >>  I am facing one problem with stopService.
>> >> >>  I have modified SendMessage.java program to send SMS, In that
>> >> >> program
>> >> >> I tried to send SMS more than 2 times. for sending SMS to each
>> >> >> number
>> >> >> it first start the service usiing startService() method of Service
>> >> >> class and after sending SMS, it stops the service using
>> >> >> stopService()
>> >> >> method of Service class.
>> >> >> I found that first time it stops the service successfully, But
>> >> >> during
>> >> >> second time it is unable to stop the service. Following are the
>> >> >> trace
>> >> >> corresponding to stopService method :
>> >> >> 1. During first time
>> >> >> Stopping the service
>> >> >> Stopped.
>> >> >> Stopped.
>> >> >> GTW: gateway1: Stopping gateway...
>> >> >> NotifyQueueManager end...
>> >> >> Stopped.
>> >> >> Stopped.
>> >> >> Stopped.
>> >> >> GTW: gateway1: AsyncNotifier thread ended.
>> >> >> GTW: gateway1: AsyncMessageProcessor thread ended.
>> >> >> GTW: gateway1: ModemReader thread ended.
>> >> >> Stopped.
>> >> >> GTW: gateway1: Closing: /dev/ttyS4 @115200
>> >> >> GTW: gateway1: Gateway stopped.
>> >> >> Running...
>> >> >> NotifyQueueManager running...
>> >> >> NotifyQueueManager end...
>> >> >> Running...
>> >> >> NotifyQueueManager running...
>> >> >> Stopped.
>> >> >> Removing Gateway
>> >> >> Service is stopped successfully
>>
>> >> >> 2. during Second time :
>> >> >> Stopping the service
>> >> >> Stopped.
>> >> >> Stopped.
>> >> >> GTW: gateway1: Stopping gateway...
>> >> >> Stopped.
>> >> >> Stopped.
>> >> >> Stopped.
>> >> >> GTW: gateway1: AsyncNotifier thread ended.
>> >> >> GTW: gateway1: AsyncMessageProcessor thread ended.
>> >> >> GTW: gateway1: ModemReader thread ended.
>> >> >> Stopped.
>> >> >> GTW: gateway1: Closing: /dev/ttyS4 @115200
>> >> >> GTW: gateway1: Gateway stopped.
>>
>> >> >> Please reply me the reason/problem, why it is  not able to stop the
>> >> >> service..
>>
>> >> >> Thanks in Advance..
>>
>> >> >> Regds
>> >> >> Daya
>>
>> >> > --
>>
>> >> > 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].
>> >> > 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.
>>
>> >> --
>> >> Thanks & Regds.
>> >> *****************************
>> >> Daya Shanker Chaubey
>> >> Research Engineer
>> >> IN Group
>> >> C-DOT Delhi
>>
>> > --
>>
>> > 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].
>> > 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.
>>
>> --
>> Thanks & Regds.
>> *****************************
>> Daya Shanker Chaubey
>> Research Engineer
>> IN Group
>> C-DOT Delhi
>
> --
>
> 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].
> 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.
>
>
>


-- 
Thanks & Regds.
*****************************
Daya Shanker Chaubey
Research Engineer
IN Group
C-DOT Delhi

--

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