my problem not solved yet On 9/14/09, Sadegh gilani <[email protected]> wrote: > Hi Thanasis > thanks > > how can define array for gateway ? > i want usins two or three or.. several gateway in the program. > i have to define gateway thus (gateway0,gateway1,...). > > when i want using several gateway must be define array. > error happend when using array for gateway, But i don't know how to > define array for gateway? > > //Public Variables > SerialModemGateway gateway,gateway1,gates[]; > OutboundNotification outboundNotification; > InboundNotification inboundNotification; > .... > > //------------------------------------------------------------ > function Connection > inboundNotification = new InboundNotification(); > outboundNotification = new OutboundNotification(); > // Create the notification callback method for inbound voice calls. > callNotification = new CallNotification(); > //Create the notification callback method for gateway statuses. > statusNotification = new GatewayStatusNotification(); > System.out.println("Example: Read messages from a serial gsm modem."); > System.out.println(Library.getLibraryDescription()); > System.out.println("Version: " + Library.getLibraryVersion()); > > this.srv = new Service(); > try > { > for(int i=0;i<8;i++){ > //example for Modem Wavecom have eight > port , not true using array and happened error > gates[i] = new > SerialModemGateway("WavecomModem."+String.valueOf(i), > "COM"+String.valueOf(i), 9600, "Wavecom", ""); > gates[i].setProtocol(Protocols.PDU); > gates[i].setInbound(true); > gates[i].setOutbound(true); > this.srv.setInboundNotification(inboundNotification); > this.srv.setCallNotification(callNotification); > this.srv.setGatewayStatusNotification(statusNotification); > > this.srv.addGateway(gates[i]); > } > // gateway1 = new SerialModemGateway("Gate.COM2", > "COM6", 9600, "SonyErricsson", ""); > // gateway1.setProtocol(Protocols.PDU); > // gateway1.setInbound(true); > // gateway1.setOutbound(true); > // this.srv.setInboundNotification(inboundNotification); > // this.srv.setCallNotification(callNotification); > // this.srv.setGatewayStatusNotification(statusNotification); > // this.srv.addGateway(gateway1); > > this.srv.startService(); > } > catch (Exception e) > { > e.printStackTrace(); > } > > > On 9/14/09, Thanasis <[email protected]> wrote: >> >> Hi, >> >> Your definitions seem ok, but what do you mean by "dynamic gateway"? >> >> On Sep 14, 5:15 am, Sadegh gilani <[email protected]> wrote: >>> is corrected my define for two gateway? >>> how define dynamic gateway in program when using several port? >>> >>> inboundNotification = new InboundNotification(); >>> outboundNotification = new OutboundNotification(); >>> // Create the notification callback method for inbound >>> voice calls. >>> callNotification = new CallNotification(); >>> //Create the notification callback method for gateway >>> statuses. >>> statusNotification = new GatewayStatusNotification(); >>> System.out.println("Example: Read messages from a >>> serial gsm modem."); >>> System.out.println(Library.getLibraryDescription()); >>> System.out.println("Version: " + >>> Library.getLibraryVersion()); >>> >>> this.srv = new Service(); >>> try >>> { >>> gateway = new SerialModemGateway("Gate.COM1", >>> "COM8", 9600, "Nokia", ""); >>> >>> gateway.setProtocol(Protocols.PDU); >>> gateway.setInbound(true); >>> gateway.setOutbound(true); >>> >>> this.srv.setInboundNotification(inboundNotification); >>> this.srv.setCallNotification(callNotification); >>> >>> this.srv.setGatewayStatusNotification(statusNotification); >>> >>> this.srv.addGateway(gateway); >>> >>> gateway1 = new SerialModemGateway("Gate.COM2", >>> "COM6", 9600, "SonyErricsson", "K800"); >>> >>> gateway1.setProtocol(Protocols.PDU); >>> gateway1.setInbound(true); >>> gateway1.setOutbound(true); >>> >>> this.srv.setInboundNotification(inboundNotification); >>> this.srv.setCallNotification(callNotification); >>> >>> this.srv.setGatewayStatusNotification(statusNotification); >>> >>> this.srv.addGateway(gateway1); >>> >>> this.srv.startService(); >>> >>> } >>> catch (Exception e) >>> { >>> e.printStackTrace(); >>> } >> >> >> >
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
