Package se.glockner.email

Source Code of se.glockner.email.EmailChecker

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package se.glockner.email;

import com.oracle.deviceaccess.gpio.PinEvent;
import com.oracle.deviceaccess.gpio.PinListener;
import javax.microedition.midlet.MIDlet;
import se.glockner.raspberrypi.Button;
import se.glockner.raspberrypi.Led;


/**
*
* @author andreas
*/
public class EmailChecker extends MIDlet {
   
    private Button checkButton;
    private Led newMailLed;
    private Led checkMailLed;
   
    public void startApp() {
        try{
            checkButton = new Button(17, "CheckMail Button");
            newMailLed = new Led(18, "New Mail Arrived");
            checkMailLed = new Led(23, "Checking Mail");
           
            checkButton.setInputListener(new PinListener(){
                public void valueChanged(PinEvent event){
                    System.out.println(checkButton);
                    checkMailLed.on();
                    newMailLed.off();
                    try {
                        Thread.sleep(1000);
                    }catch(InterruptedException e){
                        // NOOp
                    }
                    checkMailLed.off();
                    newMailLed.on();
                }
               
            });
        }catch(Exception e){
            System.out.println("Exception: " + e);
            notifyDestroyed();
        }
    }
    public void pauseApp() {
    }
   
    public void destroyApp(boolean unconditional) {
        if (newMailLed != null) {
            newMailLed.off();
            newMailLed.destroy();
        }
        if (checkMailLed != null) {
            checkMailLed.off();
            checkMailLed.destroy();
        }
        if (checkButton != null) {
            checkButton.destroy();
        }
       
    }
}

TOP

Related Classes of se.glockner.email.EmailChecker

TOP
Copyright © 2018 www.massapi.com. 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.