OSDN Git Service

Update ecrobot to nxtOSEK_v212.zip
[nxt-jsp/etrobo-atk.git] / nxtOSEK / ecrobot / c++ / device / LightSensor.h
diff --git a/nxtOSEK/ecrobot/c++/device/LightSensor.h b/nxtOSEK/ecrobot/c++/device/LightSensor.h
new file mode 100644 (file)
index 0000000..2cffca0
--- /dev/null
@@ -0,0 +1,55 @@
+//\r
+// LightSensor.h\r
+//\r
+// Copyright 2009 by Takashi Chikamasa, Jon C. Martin and Robert W. Kramer\r
+//\r
+\r
+#ifndef LIGHTSENSOR_H_\r
+#define LIGHTSENSOR_H_\r
+\r
+#include "Sensor.h"\r
+\r
+namespace ecrobot\r
+{\r
+/**\r
+ * NXT Light sensor class.\r
+ */\r
+class LightSensor: public Sensor\r
+{\r
+public:\r
+       /**\r
+        * Constructor (turn on the lamp by default).\r
+        * Note:<BR>\r
+        * This class must be constructed as a global object. Otherwise, a device assertion will be displayed<BR>\r
+        * in the LCD when the object is constructed as a non global object.<BR>\r
+        * When the object is destructed while the system is shut down, the device is de-activated automatically.\r
+        * @param port Light sensor connected port\r
+        * @param lamp Turn on/off the lamp (true:on/false:off)\r
+        * @return -\r
+        */\r
+       explicit LightSensor(ePortS port, bool lamp = true);\r
+\r
+       /**\r
+        * Destructor (turn off the lamp if it was on).\r
+        * @param -\r
+        * @return -\r
+        */\r
+       ~LightSensor(void);\r
+\r
+       /**\r
+        * Get brightness.\r
+        * @param -\r
+        * @return Brightness value (greater value means brighter)\r
+        */\r
+       S16 getBrightness(void) const;\r
+\r
+       /**\r
+        * Turn on/off the lamp.\r
+        * @param lamp true:on/false:off\r
+        * @return -\r
+        */\r
+       void setLamp(bool lamp);\r
+};\r
+}\r
+\r
+#endif\r