AI2 Component  (Version nb184)
NxtColorSensor.java
Go to the documentation of this file.
1 // -*- mode: java; c-basic-offset: 2; -*-
2 // Copyright 2009-2011 Google, All Rights reserved
3 // Copyright 2011-2012 MIT, All rights reserved
4 // Released under the Apache License, Version 2.0
5 // http://www.apache.org/licenses/LICENSE-2.0
6 
7 package com.google.appinventor.components.runtime;
8 
20 
21 import android.os.Handler;
22 
23 import java.util.HashMap;
24 import java.util.Map;
25 
34 @DesignerComponent(version = YaVersion.NXT_COLORSENSOR_COMPONENT_VERSION,
35  description = "A component that provides a high-level interface to a color sensor on a " +
36  "LEGO MINDSTORMS NXT robot.",
37  category = ComponentCategory.LEGOMINDSTORMS,
38  nonVisible = true,
39  iconName = "images/legoMindstormsNxt.png")
40 @SimpleObject
41 public class NxtColorSensor extends LegoMindstormsNxtSensor implements Deleteable {
42 
43  private enum State { UNKNOWN, BELOW_RANGE, WITHIN_RANGE, ABOVE_RANGE }
44  private static final String DEFAULT_SENSOR_PORT = "3";
45  private static final int DEFAULT_BOTTOM_OF_RANGE = 256;
46  private static final int DEFAULT_TOP_OF_RANGE = 767;
47 
48  static final int SENSOR_TYPE_COLOR_FULL = 0x0D; // Color detector mode
49  static final int SENSOR_TYPE_COLOR_RED = 0x0E; // Light sensor mode with red light on
50  static final int SENSOR_TYPE_COLOR_GREEN = 0x0F; // Light sensor mode with green light on
51  static final int SENSOR_TYPE_COLOR_BLUE = 0x10; // Light sensor mode with blue light on
52  static final int SENSOR_TYPE_COLOR_NONE = 0x11; // Light sensor mode with no light
53 
54  private static final Map<Integer, Integer> mapColorToSensorType;
55  private static final Map<Integer, Integer> mapSensorValueToColor;
56  static {
57  mapColorToSensorType = new HashMap<Integer, Integer>();
58  mapColorToSensorType.put(Component.COLOR_RED, SENSOR_TYPE_COLOR_RED);
59  mapColorToSensorType.put(Component.COLOR_GREEN, SENSOR_TYPE_COLOR_GREEN);
60  mapColorToSensorType.put(Component.COLOR_BLUE, SENSOR_TYPE_COLOR_BLUE);
61  mapColorToSensorType.put(Component.COLOR_NONE, SENSOR_TYPE_COLOR_NONE);
62 
63  mapSensorValueToColor = new HashMap<Integer, Integer>();
64  mapSensorValueToColor.put(0x01, Component.COLOR_BLACK);
65  mapSensorValueToColor.put(0x02, Component.COLOR_BLUE);
66  mapSensorValueToColor.put(0x03, Component.COLOR_GREEN);
67  mapSensorValueToColor.put(0x04, Component.COLOR_YELLOW);
68  mapSensorValueToColor.put(0x05, Component.COLOR_RED);
69  mapSensorValueToColor.put(0x06, Component.COLOR_WHITE);
70  }
71 
72  private boolean detectColor;
73  private Handler handler;
74  private final Runnable sensorReader;
75 
76  // Fields related to detecting color
77  private int previousColor;
78  private boolean colorChangedEventEnabled;
79 
80  // Fields related to detecting light
81  private State previousState;
82  private int bottomOfRange;
83  private int topOfRange;
84  private boolean belowRangeEventEnabled;
85  private boolean withinRangeEventEnabled;
86  private boolean aboveRangeEventEnabled;
87  private int generateColor;
88 
92  public NxtColorSensor(ComponentContainer container) {
93  super(container, "NxtColorSensor");
94  handler = new Handler();
95  previousState = State.UNKNOWN;
96  previousColor = Component.COLOR_NONE;
97  sensorReader = new Runnable() {
98  public void run() {
99  if (bluetooth != null && bluetooth.IsConnected()) {
100  if (detectColor) {
101  // Detecting color
102  SensorValue<Integer> sensorValue = getColorValue("");
103  if (sensorValue.valid) {
104  int currentColor = sensorValue.value;
105 
106  if (currentColor != previousColor) {
107  ColorChanged(currentColor);
108  }
109 
110  previousColor = currentColor;
111  }
112 
113  } else {
114  // Detecting light
115  SensorValue<Integer> sensorValue = getLightValue("");
116  if (sensorValue.valid) {
117  State currentState;
118  if (sensorValue.value < bottomOfRange) {
119  currentState = State.BELOW_RANGE;
120  } else if (sensorValue.value > topOfRange) {
121  currentState = State.ABOVE_RANGE;
122  } else {
123  currentState = State.WITHIN_RANGE;
124  }
125 
126  if (currentState != previousState) {
127  if (currentState == State.BELOW_RANGE && belowRangeEventEnabled) {
128  BelowRange();
129  }
130  if (currentState == State.WITHIN_RANGE && withinRangeEventEnabled) {
131  WithinRange();
132  }
133  if (currentState == State.ABOVE_RANGE && aboveRangeEventEnabled) {
134  AboveRange();
135  }
136  }
137 
138  previousState = currentState;
139  }
140  }
141  }
142  if (isHandlerNeeded()) {
143  handler.post(sensorReader);
144  }
145  }
146  };
147 
148  SensorPort(DEFAULT_SENSOR_PORT);
149 
150  // Detecting color
151  DetectColor(true);
153 
154  // Detecting light
155  BottomOfRange(DEFAULT_BOTTOM_OF_RANGE);
156  TopOfRange(DEFAULT_TOP_OF_RANGE);
157  BelowRangeEventEnabled(false);
159  AboveRangeEventEnabled(false);
161  }
162 
163  @Override
164  protected void initializeSensor(String functionName) {
165  int sensorType = detectColor ? SENSOR_TYPE_COLOR_FULL : mapColorToSensorType.get(generateColor);
166  setInputMode(functionName, port, sensorType, SENSOR_MODE_RAWMODE);
167  resetInputScaledValue(functionName, port);
168  }
169 
175  defaultValue = DEFAULT_SENSOR_PORT)
176  @SimpleProperty(userVisible = false)
177  public void SensorPort(String sensorPortLetter) {
178  setSensorPort(sensorPortLetter);
179  }
180 
193  @SimpleProperty(description = "Whether the sensor should detect color or light. " +
194  "True indicates that the sensor should detect color; False indicates that the sensor " +
195  "should detect light. " +
196  "If the DetectColor property is set to True, the BelowRange, WithinRange, and AboveRange " +
197  "events will not occur and the sensor will not generate color. " +
198  "If the DetectColor property is set to False, the ColorChanged event will not occur.",
199  category = PropertyCategory.BEHAVIOR)
200  public boolean DetectColor() {
201  return detectColor;
202  }
203 
210  defaultValue = "True")
212  public void DetectColor(boolean detectColor) {
213  boolean handlerWasNeeded = isHandlerNeeded();
214 
215  this.detectColor = detectColor;
216  if (bluetooth != null && bluetooth.IsConnected()) {
217  initializeSensor("DetectColor");
218  }
219 
220  boolean handlerIsNeeded = isHandlerNeeded();
221  if (handlerWasNeeded && !handlerIsNeeded) {
222  handler.removeCallbacks(sensorReader);
223  }
224  previousColor = Component.COLOR_NONE;
225  previousState = State.UNKNOWN;
226  if (!handlerWasNeeded && handlerIsNeeded) {
227  handler.post(sensorReader);
228  }
229  }
230 
231  // Methods for detecting color
232 
233  @SimpleFunction(description = "Returns the current detected color, or the color None if the " +
234  "color can not be read or if the DetectColor property is set to False.")
235  public int GetColor() {
236  String functionName = "GetColor";
237  if (!checkBluetooth(functionName)) {
238  return Component.COLOR_NONE;
239  }
240  if (!detectColor) {
241  form.dispatchErrorOccurredEvent(this, functionName,
243  return Component.COLOR_NONE;
244  }
245 
246  SensorValue<Integer> sensorValue = getColorValue(functionName);
247  if (sensorValue.valid) {
248  return sensorValue.value;
249  }
250 
251  // invalid response
252  return Component.COLOR_NONE;
253  }
254 
255  private SensorValue<Integer> getColorValue(String functionName) {
256  byte[] returnPackage = getInputValues(functionName, port);
257  if (returnPackage != null) {
258  boolean valid = getBooleanValueFromBytes(returnPackage, 4);
259  if (valid) {
260  int scaledValue = getSWORDValueFromBytes(returnPackage, 12);
261  if (mapSensorValueToColor.containsKey(scaledValue)) {
262  int color = mapSensorValueToColor.get(scaledValue);
263  return new SensorValue<Integer>(true, color);
264  }
265  }
266  }
267 
268  // invalid response
269  return new SensorValue<Integer>(false, null);
270  }
271 
276  @SimpleProperty(description = "Whether the ColorChanged event should fire when the DetectColor" +
277  " property is set to True and the detected color changes.",
278  category = PropertyCategory.BEHAVIOR)
279  public boolean ColorChangedEventEnabled() {
280  return colorChangedEventEnabled;
281  }
282 
287  @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "False")
289  public void ColorChangedEventEnabled(boolean enabled) {
290  boolean handlerWasNeeded = isHandlerNeeded();
291 
292  colorChangedEventEnabled = enabled;
293 
294  boolean handlerIsNeeded = isHandlerNeeded();
295  if (handlerWasNeeded && !handlerIsNeeded) {
296  handler.removeCallbacks(sensorReader);
297  }
298  if (!handlerWasNeeded && handlerIsNeeded) {
299  previousColor = Component.COLOR_NONE;
300  handler.post(sensorReader);
301  }
302  }
303 
304  @SimpleEvent(description = "Detected color has changed. " +
305  "The ColorChanged event will not occur if the DetectColor property is set to False or if " +
306  "the ColorChangedEventEnabled property is set to False.")
307  public void ColorChanged(int color) {
308  EventDispatcher.dispatchEvent(this, "ColorChanged", color);
309  }
310 
311  // Methods for detecting light
312 
313  @SimpleFunction(description = "Returns the current light level as a value between 0 and 1023, " +
314  "or -1 if the light level can not be read or if the DetectColor property is set to True.")
315  public int GetLightLevel() {
316  String functionName = "GetLightLevel";
317  if (!checkBluetooth(functionName)) {
318  return -1;
319  }
320  if (detectColor) {
321  form.dispatchErrorOccurredEvent(this, functionName,
323  return -1;
324  }
325 
326  SensorValue<Integer> sensorValue = getLightValue(functionName);
327  if (sensorValue.valid) {
328  return sensorValue.value;
329  }
330 
331  // invalid response
332  return -1;
333  }
334 
335  private SensorValue<Integer> getLightValue(String functionName) {
336  byte[] returnPackage = getInputValues(functionName, port);
337  if (returnPackage != null) {
338  boolean valid = getBooleanValueFromBytes(returnPackage, 4);
339  if (valid) {
340  int normalizedValue = getUWORDValueFromBytes(returnPackage, 10);
341  return new SensorValue<Integer>(true, normalizedValue);
342  }
343  }
344 
345  // invalid response
346  return new SensorValue<Integer>(false, null);
347  }
348 
353  @SimpleProperty(description = "The bottom of the range used for the BelowRange, WithinRange," +
354  " and AboveRange events.",
355  category = PropertyCategory.BEHAVIOR)
356  public int BottomOfRange() {
357  return bottomOfRange;
358  }
359 
365  defaultValue = "" + DEFAULT_BOTTOM_OF_RANGE)
367  public void BottomOfRange(int bottomOfRange) {
368  this.bottomOfRange = bottomOfRange;
369  previousState = State.UNKNOWN;
370  }
371 
376  @SimpleProperty(description = "The top of the range used for the BelowRange, WithinRange, and" +
377  " AboveRange events.",
378  category = PropertyCategory.BEHAVIOR)
379  public int TopOfRange() {
380  return topOfRange;
381  }
382 
388  defaultValue = "" + DEFAULT_TOP_OF_RANGE)
390  public void TopOfRange(int topOfRange) {
391  this.topOfRange = topOfRange;
392  previousState = State.UNKNOWN;
393  }
394 
399  @SimpleProperty(description = "Whether the BelowRange event should fire when the DetectColor" +
400  " property is set to False and the light level goes below the BottomOfRange.",
401  category = PropertyCategory.BEHAVIOR)
402  public boolean BelowRangeEventEnabled() {
403  return belowRangeEventEnabled;
404  }
405 
410  @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "False")
412  public void BelowRangeEventEnabled(boolean enabled) {
413  boolean handlerWasNeeded = isHandlerNeeded();
414 
415  belowRangeEventEnabled = enabled;
416 
417  boolean handlerIsNeeded = isHandlerNeeded();
418  if (handlerWasNeeded && !handlerIsNeeded) {
419  handler.removeCallbacks(sensorReader);
420  }
421  if (!handlerWasNeeded && handlerIsNeeded) {
422  previousState = State.UNKNOWN;
423  handler.post(sensorReader);
424  }
425  }
426 
427  @SimpleEvent(description = "Light level has gone below the range. " +
428  "The BelowRange event will not occur if the DetectColor property is set to True or if " +
429  "the BelowRangeEventEnabled property is set to False.")
430  public void BelowRange() {
431  EventDispatcher.dispatchEvent(this, "BelowRange");
432  }
433 
439  @SimpleProperty(description = "Whether the WithinRange event should fire when the DetectColor" +
440  " property is set to False and the light level goes between the BottomOfRange and the " +
441  "TopOfRange.",
442  category = PropertyCategory.BEHAVIOR)
443  public boolean WithinRangeEventEnabled() {
444  return withinRangeEventEnabled;
445  }
446 
452  @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "False")
454  public void WithinRangeEventEnabled(boolean enabled) {
455  boolean handlerWasNeeded = isHandlerNeeded();
456 
457  withinRangeEventEnabled = enabled;
458 
459  boolean handlerIsNeeded = isHandlerNeeded();
460  if (handlerWasNeeded && !handlerIsNeeded) {
461  handler.removeCallbacks(sensorReader);
462  }
463  if (!handlerWasNeeded && handlerIsNeeded) {
464  previousState = State.UNKNOWN;
465  handler.post(sensorReader);
466  }
467  }
468 
469  @SimpleEvent(description = "Light level has gone within the range. " +
470  "The WithinRange event will not occur if the DetectColor property is set to True or if " +
471  "the WithinRangeEventEnabled property is set to False.")
472  public void WithinRange() {
473  EventDispatcher.dispatchEvent(this, "WithinRange");
474  }
475 
480  @SimpleProperty(description = "Whether the AboveRange event should fire when the DetectColor" +
481  " property is set to False and the light level goes above the TopOfRange.",
482  category = PropertyCategory.BEHAVIOR)
483  public boolean AboveRangeEventEnabled() {
484  return aboveRangeEventEnabled;
485  }
486 
491  @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "False")
493  public void AboveRangeEventEnabled(boolean enabled) {
494  boolean handlerWasNeeded = isHandlerNeeded();
495 
496  aboveRangeEventEnabled = enabled;
497 
498  boolean handlerIsNeeded = isHandlerNeeded();
499  if (handlerWasNeeded && !handlerIsNeeded) {
500  handler.removeCallbacks(sensorReader);
501  }
502  if (!handlerWasNeeded && handlerIsNeeded) {
503  previousState = State.UNKNOWN;
504  handler.post(sensorReader);
505  }
506  }
507 
508  @SimpleEvent(description = "Light level has gone above the range. " +
509  "The AboveRange event will not occur if the DetectColor property is set to True or if " +
510  "the AboveRangeEventEnabled property is set to False.")
511  public void AboveRange() {
512  EventDispatcher.dispatchEvent(this, "AboveRange");
513  }
514 
521  @SimpleProperty(description = "The color that should generated by the sensor. " +
522  "Only None, Red, Green, or Blue are valid values. " +
523  "The sensor will not generate color when the DetectColor property is set to True.",
524  category = PropertyCategory.BEHAVIOR)
525  public int GenerateColor() {
526  return generateColor;
527  }
528 
536  defaultValue = Component.DEFAULT_VALUE_COLOR_NONE)
538  public void GenerateColor(int generateColor) {
539  String functionName = "GenerateColor";
540  if (mapColorToSensorType.containsKey(generateColor)) {
541  this.generateColor = generateColor;
542  if (bluetooth != null && bluetooth.IsConnected()) {
543  initializeSensor(functionName);
544  }
545  } else {
546  form.dispatchErrorOccurredEvent(this, functionName,
548  }
549  }
550 
551  private boolean isHandlerNeeded() {
552  if (detectColor) {
553  return colorChangedEventEnabled;
554  } else {
555  return belowRangeEventEnabled || withinRangeEventEnabled || aboveRangeEventEnabled;
556  }
557  }
558 
559  // Deleteable implementation
560 
561  @Override
562  public void onDelete() {
563  handler.removeCallbacks(sensorReader);
564  super.onDelete();
565  }
566 }
com.google.appinventor.components.runtime.EventDispatcher
Definition: EventDispatcher.java:22
com.google.appinventor.components.runtime.LegoMindstormsNxtBase.getSWORDValueFromBytes
final int getSWORDValueFromBytes(byte[] bytes, int offset)
Definition: LegoMindstormsNxtBase.java:411
com.google.appinventor.components.runtime.Component.COLOR_GREEN
static final int COLOR_GREEN
Definition: Component.java:60
com.google.appinventor.components.annotations.SimpleFunction
Definition: SimpleFunction.java:23
com.google.appinventor.components.runtime.NxtColorSensor.AboveRangeEventEnabled
boolean AboveRangeEventEnabled()
Definition: NxtColorSensor.java:483
com.google.appinventor.components.runtime.util.ErrorMessages
Definition: ErrorMessages.java:17
com.google.appinventor.components.runtime.NxtColorSensor.WithinRangeEventEnabled
boolean WithinRangeEventEnabled()
Definition: NxtColorSensor.java:443
com.google.appinventor.components.runtime.util
-*- mode: java; c-basic-offset: 2; -*-
Definition: AccountChooser.java:7
com.google.appinventor.components.runtime.Component.COLOR_BLUE
static final int COLOR_BLUE
Definition: Component.java:56
com.google.appinventor.components.runtime.NxtColorSensor.GenerateColor
int GenerateColor()
Definition: NxtColorSensor.java:525
com.google.appinventor.components.common.YaVersion
Definition: YaVersion.java:14
com.google.appinventor.components.annotations.DesignerProperty
Definition: DesignerProperty.java:25
com.google.appinventor.components.runtime.LegoMindstormsNxtBase.bluetooth
BluetoothClient bluetooth
Definition: LegoMindstormsNxtBase.java:77
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_NONE
static final String DEFAULT_VALUE_COLOR_NONE
Definition: Component.java:70
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_NXT_CANNOT_DETECT_LIGHT
static final int ERROR_NXT_CANNOT_DETECT_LIGHT
Definition: ErrorMessages.java:67
com.google.appinventor.components
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_NON_NEGATIVE_INTEGER
static final String PROPERTY_TYPE_NON_NEGATIVE_INTEGER
Definition: PropertyTypeConstants.java:206
com.google.appinventor.components.runtime.NxtColorSensor.BelowRangeEventEnabled
boolean BelowRangeEventEnabled()
Definition: NxtColorSensor.java:402
com.google.appinventor.components.runtime.NxtColorSensor.onDelete
void onDelete()
Definition: NxtColorSensor.java:562
com.google.appinventor.components.runtime.LegoMindstormsNxtSensor.setSensorPort
final void setSensorPort(String sensorPortLetter)
Definition: LegoMindstormsNxtSensor.java:78
com.google.appinventor.components.runtime.BluetoothConnectionBase.IsConnected
final boolean IsConnected()
Definition: BluetoothConnectionBase.java:204
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN
static final String PROPERTY_TYPE_BOOLEAN
Definition: PropertyTypeConstants.java:35
com.google.appinventor.components.runtime.NxtColorSensor.ColorChanged
void ColorChanged(int color)
Definition: NxtColorSensor.java:307
com.google.appinventor.components.runtime.LegoMindstormsNxtBase.resetInputScaledValue
final void resetInputScaledValue(String functionName, int port)
Definition: LegoMindstormsNxtBase.java:185
com.google.appinventor.components.annotations.DesignerComponent
Definition: DesignerComponent.java:22
com.google.appinventor.components.runtime.NxtColorSensor.NxtColorSensor
NxtColorSensor(ComponentContainer container)
Definition: NxtColorSensor.java:92
com.google.appinventor.components.annotations.SimpleEvent
Definition: SimpleEvent.java:20
com.google.appinventor.components.annotations.PropertyCategory.BEHAVIOR
BEHAVIOR
Definition: PropertyCategory.java:15
com.google.appinventor.components.runtime.Component.COLOR_YELLOW
static final int COLOR_YELLOW
Definition: Component.java:67
com.google.appinventor.components.runtime.NxtColorSensor
Definition: NxtColorSensor.java:41
com.google.appinventor.components.runtime.NxtColorSensor.BottomOfRange
int BottomOfRange()
Definition: NxtColorSensor.java:356
com.google.appinventor.components.runtime.NxtColorSensor.DetectColor
void DetectColor(boolean detectColor)
Definition: NxtColorSensor.java:212
com.google.appinventor.components.runtime.NxtColorSensor.ColorChangedEventEnabled
boolean ColorChangedEventEnabled()
Definition: NxtColorSensor.java:279
com.google.appinventor.components.runtime.LegoMindstormsNxtSensor.SensorPort
String SensorPort()
Definition: LegoMindstormsNxtSensor.java:70
com.google.appinventor.components.runtime.Component.COLOR_RED
static final int COLOR_RED
Definition: Component.java:65
com.google.appinventor.components.runtime.NxtColorSensor.DetectColor
boolean DetectColor()
Definition: NxtColorSensor.java:200
com.google.appinventor.components.runtime.NxtColorSensor.TopOfRange
void TopOfRange(int topOfRange)
Definition: NxtColorSensor.java:390
com.google.appinventor.components.runtime.NxtColorSensor.ColorChangedEventEnabled
void ColorChangedEventEnabled(boolean enabled)
Definition: NxtColorSensor.java:289
com.google.appinventor.components.runtime.NxtColorSensor.TopOfRange
int TopOfRange()
Definition: NxtColorSensor.java:379
com.google.appinventor.components.runtime.NxtColorSensor.AboveRangeEventEnabled
void AboveRangeEventEnabled(boolean enabled)
Definition: NxtColorSensor.java:493
com.google.appinventor.components.runtime.NxtColorSensor.WithinRangeEventEnabled
void WithinRangeEventEnabled(boolean enabled)
Definition: NxtColorSensor.java:454
com.google.appinventor.components.runtime.LegoMindstormsNxtBase.getInputValues
final byte[] getInputValues(String functionName, int port)
Definition: LegoMindstormsNxtBase.java:168
com.google.appinventor.components.runtime.Component.COLOR_NONE
static final int COLOR_NONE
Definition: Component.java:54
com.google.appinventor.components.runtime.EventDispatcher.dispatchEvent
static boolean dispatchEvent(Component component, String eventName, Object...args)
Definition: EventDispatcher.java:188
com.google.appinventor.components.runtime.LegoMindstormsNxtSensor
Definition: LegoMindstormsNxtSensor.java:21
com.google.appinventor.components.runtime.NxtColorSensor.GenerateColor
void GenerateColor(int generateColor)
Definition: NxtColorSensor.java:538
com.google.appinventor.components.runtime.NxtColorSensor.WithinRange
void WithinRange()
Definition: NxtColorSensor.java:472
com.google.appinventor.components.annotations.SimpleProperty
Definition: SimpleProperty.java:23
com.google.appinventor.components.annotations.PropertyCategory
Definition: PropertyCategory.java:13
com.google.appinventor.components.runtime.Component.COLOR_BLACK
static final int COLOR_BLACK
Definition: Component.java:55
com.google.appinventor.components.runtime.ComponentContainer
Definition: ComponentContainer.java:16
com.google.appinventor.components.runtime
Copyright 2009-2011 Google, All Rights reserved.
Definition: AccelerometerSensor.java:8
com.google.appinventor.components.runtime.Component
Definition: Component.java:17
com.google.appinventor.components.runtime.Map< Integer, Integer >
com.google.appinventor.components.runtime.Deleteable
Definition: Deleteable.java:15
com.google.appinventor.components.common
Definition: ComponentCategory.java:7
com.google.appinventor.components.common.ComponentCategory
Definition: ComponentCategory.java:48
com.google.appinventor.components.runtime.NxtColorSensor.BottomOfRange
void BottomOfRange(int bottomOfRange)
Definition: NxtColorSensor.java:367
com.google.appinventor.components.runtime.LegoMindstormsNxtBase.checkBluetooth
final boolean checkBluetooth(String functionName)
Definition: LegoMindstormsNxtBase.java:250
com.google.appinventor.components.runtime.NxtColorSensor.BelowRangeEventEnabled
void BelowRangeEventEnabled(boolean enabled)
Definition: NxtColorSensor.java:412
com.google.appinventor.components.runtime.Form.dispatchErrorOccurredEvent
void dispatchErrorOccurredEvent(final Component component, final String functionName, final int errorNumber, final Object... messageArgs)
Definition: Form.java:1011
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_NXT_INVALID_GENERATE_COLOR
static final int ERROR_NXT_INVALID_GENERATE_COLOR
Definition: ErrorMessages.java:68
com.google.appinventor.components.annotations.SimpleObject
Definition: SimpleObject.java:23
com.google.appinventor.components.runtime.Component.COLOR_WHITE
static final int COLOR_WHITE
Definition: Component.java:66
com.google.appinventor.components.runtime.NxtColorSensor.BelowRange
void BelowRange()
Definition: NxtColorSensor.java:430
com.google.appinventor.components.runtime.LegoMindstormsNxtSensor.port
int port
Definition: LegoMindstormsNxtSensor.java:56
com.google.appinventor.components.runtime.NxtColorSensor.AboveRange
void AboveRange()
Definition: NxtColorSensor.java:511
com.google.appinventor.components.runtime.LegoMindstormsNxtBase.getBooleanValueFromBytes
final boolean getBooleanValueFromBytes(byte[] bytes, int offset)
Definition: LegoMindstormsNxtBase.java:399
com.google.appinventor.components.runtime.LegoMindstormsNxtBase.getUWORDValueFromBytes
final int getUWORDValueFromBytes(byte[] bytes, int offset)
Definition: LegoMindstormsNxtBase.java:416
com.google
com
com.google.appinventor.components.runtime.NxtColorSensor.GetLightLevel
int GetLightLevel()
Definition: NxtColorSensor.java:315
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_LEGO_NXT_SENSOR_PORT
static final String PROPERTY_TYPE_LEGO_NXT_SENSOR_PORT
Definition: PropertyTypeConstants.java:101
com.google.appinventor.components.runtime.NxtColorSensor.GetColor
int GetColor()
Definition: NxtColorSensor.java:235
com.google.appinventor.components.common.PropertyTypeConstants.PROPERTY_TYPE_LEGO_NXT_GENERATED_COLOR
static final String PROPERTY_TYPE_LEGO_NXT_GENERATED_COLOR
Definition: PropertyTypeConstants.java:108
com.google.appinventor.components.runtime.LegoMindstormsNxtBase.setInputMode
final void setInputMode(String functionName, int port, int sensorType, int sensorMode)
Definition: LegoMindstormsNxtBase.java:158
com.google.appinventor.components.runtime.AndroidNonvisibleComponent.form
final Form form
Definition: AndroidNonvisibleComponent.java:19
com.google.appinventor.components.common.PropertyTypeConstants
Definition: PropertyTypeConstants.java:14
com.google.appinventor.components.annotations
com.google.appinventor.components.runtime.util.ErrorMessages.ERROR_NXT_CANNOT_DETECT_COLOR
static final int ERROR_NXT_CANNOT_DETECT_COLOR
Definition: ErrorMessages.java:66
com.google.appinventor
com.google.appinventor.components.runtime.NxtColorSensor.initializeSensor
void initializeSensor(String functionName)
Definition: NxtColorSensor.java:164