PixelLightAPI  .
LED.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: LED.h                                          *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLINPUT_LED_H__
00024 #define __PLINPUT_LED_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLInput/Input/Controls/Control.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLInput {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Classes                                               ]
00042 //[-------------------------------------------------------]
00043 /**
00044 *  @brief
00045 *    LED control
00046 *
00047 *  @remarks
00048 *    An LED control can manage up to 32 LEDs
00049 */
00050 class LED : public Control {
00051 
00052 
00053     //[-------------------------------------------------------]
00054     //[ Class definition                                      ]
00055     //[-------------------------------------------------------]
00056     pl_class(PLINPUT_RTTI_EXPORT, LED, "PLInput", PLInput::Control, "LED control")
00057         #ifdef PLINPUT_EXPORTS  // The following is only required when compiling PLInput
00058             // Methods
00059             pl_method_0(GetLEDs,    pl_ret_type(PLCore::uint32),                            "Returns the state of all LEDs as a bit field.",                                                                        "")
00060             pl_method_1(SetLEDs,    pl_ret_type(void),              PLCore::uint32,         "Set state of all LEDs as a bit field. LED states as first parameter.",                                                 "")
00061             pl_method_1(IsOn,       pl_ret_type(bool),              int,                    "Get LED status. Index of LED (0..31) as first parameter. Returns 'true' if the LED is currently on, else 'false'.",    "")
00062             pl_method_2(SetOn,      pl_ret_type(void),              int,            bool,   "Set LED status. Index of LED (0..31) as first parameter. 'true' as second parameter, if the LED is on, else 'false'.", "")
00063         #endif
00064     pl_class_end
00065 
00066 
00067     //[-------------------------------------------------------]
00068     //[ Public functions                                      ]
00069     //[-------------------------------------------------------]
00070     public:
00071         /**
00072         *  @brief
00073         *    LED
00074         *
00075         *  @param[in] pController
00076         *    Owning controller, can, but shouldn't be a null pointer
00077         *  @param[in] sName
00078         *    Control name
00079         *  @param[in] sDescription
00080         *    Control description
00081         */
00082         PLINPUT_API LED(Controller *pController, const PLCore::String &sName, const PLCore::String &sDescription);
00083 
00084         /**
00085         *  @brief
00086         *    Copy constructor
00087         *
00088         *  @param[in] cOther
00089         *    Other LED
00090         */
00091         PLINPUT_API LED(const LED &cOther);
00092 
00093         /**
00094         *  @brief
00095         *    Destructor
00096         */
00097         PLINPUT_API virtual ~LED();
00098 
00099         /**
00100         *  @brief
00101         *    Comparison operator
00102         *
00103         *  @param[in] cOther
00104         *    LED to compare with
00105         *
00106         *  @return
00107         *    'true', if both LEDs are equal, else 'false'
00108         */
00109         PLINPUT_API bool operator ==(const LED &cOther) const;
00110 
00111         /**
00112         *  @brief
00113         *    Copy operator
00114         *
00115         *  @param[in] cOther
00116         *    Other LED
00117         *
00118         *  @return
00119         *    Reference to this LED
00120         */
00121         PLINPUT_API LED &operator =(const LED &cOther);
00122 
00123         /**
00124         *  @brief
00125         *    Get state of all LEDs as a bit field
00126         *
00127         *  @return
00128         *    LED states
00129         */
00130         PLINPUT_API PLCore::uint32 GetLEDs() const;
00131 
00132         /**
00133         *  @brief
00134         *    Set state of all LEDs as a bit field
00135         *
00136         *  @param[in] nLEDs
00137         *    LED states
00138         */
00139         PLINPUT_API void SetLEDs(PLCore::uint32 nLEDs);
00140 
00141         /**
00142         *  @brief
00143         *    Get LED status
00144         *
00145         *  @param[in] nLED
00146         *    Index of LED (0..31)
00147         *
00148         *  @return
00149         *    'true', if the LED is currently on, else 'false'
00150         */
00151         PLINPUT_API bool IsOn(int nLED) const;
00152 
00153         /**
00154         *  @brief
00155         *    Set LED status
00156         *
00157         *  @param[in] nLED
00158         *    Index of LED (0..31)
00159         *  @param[in] bOn
00160         *    'true', if the LED is on, else 'false'
00161         */
00162         PLINPUT_API void SetOn(int nLED, bool bOn);
00163 
00164 
00165     //[-------------------------------------------------------]
00166     //[ Private data                                          ]
00167     //[-------------------------------------------------------]
00168     private:
00169         PLCore::uint32 m_nLEDs; /**< State of all LEDs */
00170 
00171 
00172 };
00173 
00174 
00175 //[-------------------------------------------------------]
00176 //[ Namespace                                             ]
00177 //[-------------------------------------------------------]
00178 } // PLInput
00179 
00180 
00181 #endif // __PLINPUT_LED_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:56
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported