Package de.nordakademie.cerca.button

Examples of de.nordakademie.cerca.button.NativeButton


    mySensorPort.setISensorPort(0, new LightSensorStub());
   
    NativeSensorPort sensorPort = NativeSensorPort.getInstance();
    sensorPort.setBehaviour(mySensorPort);
   
    NativeButton nBtn = NativeButton.getInstance();
    nBtn.setBehaviour(new MyButton());
   
    // calling native LeJOS methods
//    int voltage = Battery.getVoltageMilliVolt();
//    System.out.println("Voltage: " + voltage);
   
View Full Code Here


    return 0;
  }

  @Test
  public void getButtonsTest() {
    NativeButton button = NativeButton.getInstance();
    button.setBehaviour(this);
    // getButtons() can only be called via readButtons() since modifier is
    // private
    assertEquals(0, Button.readButtons());
  }
View Full Code Here

  public static void main(String[] args) throws InterruptedException {
    // implementing customized behaviour
    NativeLCD lcd = NativeLCD.getInstance();
    lcd.setBehaviour(new MyLCD());
   
    NativeButton btn = NativeButton.getInstance();
    MyButton myBtn = new MyButton();
    btn.setBehaviour(myBtn);
   
    myBtn.setButtons(8);
   
    System.out.println("Buttons: " + getBits(myBtn.getButtons()));
   
View Full Code Here

    assertEquals(15, btnStub.getButtons());
  }

  @Test
  public void testButtonStubInCercaContext() {
    NativeButton nativeBtn = NativeButton.getInstance();
    nativeBtn.setBehaviour(btnStub);

    assertEquals(0, Button.readButtons());
    btnStub.pressEscapeButton();
    assertEquals(Button.ID_ESCAPE, Button.readButtons());
  }
View Full Code Here

   */
  public void testWithZPilot() throws InterruptedException{
   
    NativeMotorPort nativeMotorPort = NativeMotorPort.getInstance();
    NativeBattery nativeBattery = NativeBattery.getInstance();
    NativeButton nativeButton = NativeButton.getInstance();
    NativeLCD nativeLcd = NativeLCD.getInstance();
    NativeSensorPort nativeSensor = NativeSensorPort.getInstance();
   
    //Verhalten f�r die Cerca Instanzen setzen
    NativeMotorPortStub motorportStub = new NativeMotorPortStub();
    nativeMotorPort.setBehaviour(motorportStub);   
    NativeBatteryStub batteryStub = new NativeBatteryStub();
    nativeBattery.setBehaviour(batteryStub);   
    NativeButtonStub btnStub = new NativeButtonStub();
    nativeButton.setBehaviour(btnStub);     
    NativeLcdStub lcdStub = new NativeLcdStub();
    nativeLcd.setBehaviour(lcdStub);   
    NativeSensorPortStub sensorPortStub = new NativeSensorPortStub();
    nativeSensor.setBehaviour(sensorPortStub);
   
View Full Code Here

TOP

Related Classes of de.nordakademie.cerca.button.NativeButton

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.