Package org.smslib.modem

Examples of org.smslib.modem.SerialModemGateway


    {
      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.
      SerialModemGateway gateway = new SerialModemGateway("modem.com4", "COM4", 115200, "Huawei", "E160");
      // 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();
      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() + "%");
      System.out.println();
      // In case you work with encrypted messages, its a good time to declare your keys.
      // Create a new AES Key with a known key value.
      // Register it in KeyManager in order to keep it active. SMSLib will then automatically
      // encrypt / decrypt all messages send to / received from this number.
View Full Code Here


  {
    OutboundNotification outboundNotification = new OutboundNotification();
    System.out.println("Example: Send message from a serial gsm modem.");
    System.out.println(Library.getLibraryDescription());
    System.out.println("Version: " + Library.getLibraryVersion());
    SerialModemGateway gateway = new SerialModemGateway("modem.com1", "COM4", 115200, "Huawei", "");
    gateway.setInbound(true);
    gateway.setOutbound(true);
    gateway.setSimPin("0000");
    // Explicit SMSC address set is required for some modems.
    // Below is for VODAFONE GREECE - be sure to set your own!
    gateway.setSmscNumber("+306942190000");
    Service.getInstance().setOutboundMessageNotification(outboundNotification);
    Service.getInstance().addGateway(gateway);
    Service.getInstance().startService();
    System.out.println();
    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() + "%");
    System.out.println();
    // Send a message synchronously.
    OutboundMessage msg = new OutboundMessage("306974000000", "Hello from SMSLib!");
    Service.getInstance().sendMessage(msg);
    System.out.println(msg);
View Full Code Here

  public void doIt() throws Exception
  {
    System.out.println("Example: Send an encrypted message from a serial gsm modem.");
    System.out.println(Library.getLibraryDescription());
    System.out.println("Version: " + Library.getLibraryVersion());
    SerialModemGateway gateway = new SerialModemGateway("modem.com1", "COM5", 57600, "Nokia", "E60");
    gateway.setInbound(true);
    gateway.setOutbound(true);
    gateway.setSimPin("0000");
    Service.getInstance().addGateway(gateway);
    Service.getInstance().startService();
    System.out.println();
    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() + "%");
    System.out.println();
   
    // Create a new AES Key with a known key value.
    // Register it in KeyManager in order to keep it active. SMSLib will then automatically
    // encrypt / decrypt all messages send to / received from this number.
View Full Code Here

            service = serviceRepo.getService(gsmTransportInDetails.getGatewayId());
            return;
        }
        service = new Service();

        gateway= new SerialModemGateway(gsmTransportInDetails.getGatewayId(), gsmTransportInDetails.getComPort(),
                gsmTransportInDetails.getBaudRate(),gsmTransportInDetails.getManufacturer(),
                gsmTransportInDetails.getModel());

      // Set the modem protocol to PDU (alternative is TEXT). PDU is the default, anyway...
      gateway.setProtocol(AGateway.Protocols.PDU);
View Full Code Here

    public void sendSMS(SMSMessage sm) {
        if (service == null && !serviceRepo.gatewayInUse(gsmTransportOutDetails.getGatewayId())) {
            //Operating in the Out Only mode
            service = new Service();
            gateway = new SerialModemGateway(gsmTransportOutDetails.getGatewayId(), gsmTransportOutDetails.getComPort(),
                    gsmTransportOutDetails.getBaudRate(), gsmTransportOutDetails.getManufacturer(),
                    gsmTransportOutDetails.getModel());

            // Set the modem protocol to PDU (alternative is TEXT). PDU is the default, anyway...
            gateway.setProtocol(AGateway.Protocols.PDU);
View Full Code Here

      logger.info( Library.getLibraryDescription() );
      logger.info( Library.getLibraryVersion() );



      gateway = new SerialModemGateway( "SER LIQUIDO", modemSerialPort, 38400, "MultiTech","GPRS" );

      gateway.setInbound(true);
      gateway.setOutbound(true);
    //  gateway.getATHandler().setStorageLocations("SMMTMESR");
View Full Code Here

    try {

      logger.info( Library.getLibraryDescription() );
      logger.info( Library.getLibraryVersion() );

      gateway = new SerialModemGateway( "SER LIQUIDO", modemSerialPort, 38400, "MultiTech","GPRS" );

      gateway.setInbound(true);
      gateway.setOutbound(true);

      service = new Service();
View Full Code Here

        //configuration = (SmsConfiguration) context.getBean("smsConfiguration");
        AppSettingService settingService = (AppSettingServiceImpl) context.getBean("appSettingService");
        incomingService = (IncomingServiceImpl) context.getBean("incomingService");

        configuration = settingService.getSetting();
        gateway = new SerialModemGateway(configuration.getModemName(), configuration.getComPort(),
                      configuration.getBaudRate(), configuration.getManufacturer(), configuration.getModel());
        factory = new StdSchedulerFactory();

        startButton.addActionListener(new ActionListener() {
View Full Code Here

TOP

Related Classes of org.smslib.modem.SerialModemGateway

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.