⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readmessages.jad

📁 使用smslib和GSP modem 发送和接收手机短息
💻 JAD
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2008-6-16 15:08:43
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   ReadMessages.java

package examples.modem;

import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import org.smslib.*;
import org.smslib.modem.SerialModemGateway;

public class ReadMessages
{
    public class CallNotification
        implements ICallNotification
    {

        public void process(String gatewayId, String callerId)
        {
            System.out.println((new StringBuilder()).append(">>> New call detected from Gateway: ").append(gatewayId).append(" : ").append(callerId).toString());
        }

        final ReadMessages this$0;

        public CallNotification()
        {
            this$0 = ReadMessages.this;
            super();
        }
    }

    public class InboundNotification
        implements IInboundMessageNotification
    {

        public void process(String gatewayId, MessageTypes msgType, String memLoc, int memIndex)
        {
            if(msgType == MessageTypes.INBOUND)
            {
                System.out.println((new StringBuilder()).append(">>> New Inbound message detected from Gateway: ").append(gatewayId).append(" : ").append(memLoc).append(" @ ").append(memIndex).toString());
                try
                {
                    List msgList = new ArrayList();
                    srv.readMessages(msgList, MessageClasses.UNREAD, gatewayId);
                    for(int i = 0; i < msgList.size(); i++)
                        System.out.println(msgList.get(i));

                }
                catch(Exception e)
                {
                    System.out.println("Oops, some bad happened...");
                    e.printStackTrace();
                }
            } else
            if(msgType == MessageTypes.STATUSREPORT)
                System.out.println((new StringBuilder()).append(">>> New Status Report message detected from Gateway: ").append(gatewayId).append(" : ").append(memLoc).append(" @ ").append(memIndex).toString());
        }

        final ReadMessages this$0;

        public InboundNotification()
        {
            this$0 = ReadMessages.this;
            super();
        }
    }


    public ReadMessages()
    {
    }

    public void doIt()
        throws Exception
    {
        InboundNotification inboundNotification;
        CallNotification callNotification;
        inboundNotification = new InboundNotification();
        callNotification = new CallNotification();
        System.out.println("Example: Read messages from a serial gsm modem.");
        System.out.println(Library.getLibraryDescription());
        System.out.println((new StringBuilder()).append("Version: ").append(Library.getLibraryVersion()).toString());
        srv = new Service();
        SerialModemGateway gateway = new SerialModemGateway("modem.com1", "COM1", 57600, "Nokia", "6310i");
        gateway.setInbound(true);
        gateway.setOutbound(true);
        gateway.setSimPin("0000");
        gateway.setInboundNotification(inboundNotification);
        gateway.setCallNotification(callNotification);
        srv.addGateway(gateway);
        srv.startService();
        System.out.println();
        System.out.println("Modem Information:");
        System.out.println((new StringBuilder()).append("  Manufacturer: ").append(gateway.getManufacturer()).toString());
        System.out.println((new StringBuilder()).append("  Model: ").append(gateway.getModel()).toString());
        System.out.println((new StringBuilder()).append("  Serial No: ").append(gateway.getSerialNo()).toString());
        System.out.println((new StringBuilder()).append("  SIM IMSI: ").append(gateway.getImsi()).toString());
        System.out.println((new StringBuilder()).append("  Signal Level: ").append(gateway.getSignalLevel()).append("%").toString());
        System.out.println((new StringBuilder()).append("  Battery Level: ").append(gateway.getBatteryLevel()).append("%").toString());
        System.out.println();
        List msgList = new ArrayList();
        srv.readMessages(msgList, MessageClasses.ALL);
        for(int i = 0; i < msgList.size(); i++)
            System.out.println(msgList.get(i));

        System.out.println("Now Sleeping - Hit <enter> to terminate.");
        System.in.read();
        srv.stopService();
        break MISSING_BLOCK_LABEL_451;
        Exception e;
        e;
        e.printStackTrace();
        srv.stopService();
        break MISSING_BLOCK_LABEL_451;
        Exception exception;
        exception;
        srv.stopService();
        throw exception;
    }

    public static void main(String args[])
    {
        ReadMessages app = new ReadMessages();
        try
        {
            app.doIt();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    private Service srv;

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -