00001 #include "LCDScreen.h"
00002 #include "LCDUtils.h"
00003
00004 using namespace std;
00005
00006 LCDScreen::LCDScreen(LCDElement *parent, string name, string id) : LCDElement(id, "screen_add", "", parent)
00007 {
00008 if (name != "")
00009 {
00010 setName(name);
00011 }
00012 _elementDel = "screen_del";
00013 }
00014
00015 string LCDScreen::valueToString(string value)
00016 {
00017 return value;
00018 }
00019
00020 string LCDScreen::valueToString(int value)
00021 {
00022 return LCDUtils::toString(value);
00023 }
00024
00025 template <typename T> void LCDScreen::setScreenOption(string optName, T value)
00026 {
00027 sendCommand("screen_set", string("-") + optName + " " + LCDScreen::valueToString(value));
00028 }
00029
00030 void LCDScreen::setName(string name)
00031 {
00032 setScreenOption("name", name);
00033 }
00034
00035 void LCDScreen::setWidth(int width)
00036 {
00037 setScreenOption("wid", width);
00038 }
00039
00040 void LCDScreen::setHeight(int height)
00041 {
00042 setScreenOption("hgt", height);
00043 }
00044
00045 void LCDScreen::setPriority(string priority)
00046 {
00047 setScreenOption("priority", priority);
00048 }
00049
00050 void LCDScreen::setHeartBeat(string heartbeat)
00051 {
00052 setScreenOption("heartbeat", heartbeat);
00053 }
00054
00055 void LCDScreen::setBackLight(string backlight)
00056 {
00057 setScreenOption("backlight", backlight);
00058 }
00059
00060 void LCDScreen::setDuration(int secondEights)
00061 {
00062 setScreenOption("duration", secondEights);
00063 }
00064
00065 void LCDScreen::setTimeOut(int secondEights)
00066 {
00067 setScreenOption("timeout", secondEights);
00068 }
00069
00070 void LCDScreen::setCursor(string cursor)
00071 {
00072 setScreenOption("cursor", cursor);
00073 }
00074
00075 void LCDScreen::setCursorX(int x)
00076 {
00077 setScreenOption("cursor_x", x);
00078 }
00079
00080 void LCDScreen::setCursorY(int y)
00081 {
00082 setScreenOption("cursor_y", y);
00083 }
00084
00085 void LCDScreen::setCursorPosition(int x, int y)
00086 {
00087 setCursorX(x);
00088 setCursorY(y);
00089 }