41 #define _CRT_SECURE_NO_DEPRECATE //do not use windows secure crt 48 #define __FILE_ID__ "display" 54 _display(parent),_id(id),_cmdbuff(
""),_hidden(false)
74 if(
_cmdbuff.length() + cmd.length() >= 100) {
98 int size = (int)data.size();
99 char *arr =
new char[size];
100 for (
int i=0;i<size;i++) arr[i] = data[i];
101 string strval = string(arr,size);
609 ,_enabled(ENABLED_INVALID)
610 ,_startupSeq(STARTUPSEQ_INVALID)
611 ,_brightness(BRIGHTNESS_INVALID)
612 ,_orientation(ORIENTATION_INVALID)
613 ,_displayWidth(DISPLAYWIDTH_INVALID)
614 ,_displayHeight(DISPLAYHEIGHT_INVALID)
615 ,_displayType(DISPLAYTYPE_INVALID)
616 ,_layerWidth(LAYERWIDTH_INVALID)
617 ,_layerHeight(LAYERHEIGHT_INVALID)
618 ,_layerCount(LAYERCOUNT_INVALID)
619 ,_command(COMMAND_INVALID)
620 ,_valueCallbackDisplay(NULL)
622 ,_allDisplayLayers(0)
648 if(json_val->
has(
"enabled")) {
651 if(json_val->
has(
"startupSeq")) {
654 if(json_val->
has(
"brightness")) {
657 if(json_val->
has(
"orientation")) {
660 if(json_val->
has(
"displayWidth")) {
663 if(json_val->
has(
"displayHeight")) {
666 if(json_val->
has(
"displayType")) {
669 if(json_val->
has(
"layerWidth")) {
672 if(json_val->
has(
"layerHeight")) {
675 if(json_val->
has(
"layerCount")) {
678 if(json_val->
has(
"command")) {
706 }
catch (std::exception) {
729 rest_val = (newval>0 ?
"1" :
"0");
730 res =
_setAttr(
"enabled", rest_val);
731 }
catch (std::exception) {
760 }
catch (std::exception) {
786 res =
_setAttr(
"startupSeq", rest_val);
787 }
catch (std::exception) {
816 }
catch (std::exception) {
841 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
842 res =
_setAttr(
"brightness", rest_val);
843 }
catch (std::exception) {
873 }
catch (std::exception) {
898 char buf[32]; sprintf(buf,
"%d", newval); rest_val = string(buf);
899 res =
_setAttr(
"orientation", rest_val);
900 }
catch (std::exception) {
929 }
catch (std::exception) {
958 }
catch (std::exception) {
988 }
catch (std::exception) {
1017 }
catch (std::exception) {
1046 }
catch (std::exception) {
1075 }
catch (std::exception) {
1097 }
catch (std::exception) {
1112 res =
_setAttr(
"command", rest_val);
1113 }
catch (std::exception) {
1161 }
catch (std::exception) {
1183 if (callback != NULL) {
1190 if (callback != NULL && this->
isOnline()) {
1344 return this->
_upload(pathname, content);
1400 vector<YFUN_DESCR> v_fundescr;
1402 string serial, funcId, funcName, funcVal, errmsg;
1405 v_fundescr.size() == 0 ||
1419 for(
unsigned i = 0; i < nb_display_layer; i++) {
virtual int _invokeValueCallback(string value)
virtual int setLayerPosition(int x, int y, int scrollTime)
virtual int playSequence(string sequenceName)
yCRITICAL_SECTION _this_cs
void(* YDisplayValueCallback)(YDisplay *func, const string &functionValue)
YDisplay * nextDisplay(void)
virtual int selectColorPen(int color)
virtual int registerValueCallback(YDisplayValueCallback callback)
YRETCODE _load_unsafe(int msValidity)
int set_brightness(int newval)
Y_DISPLAYTYPE_enum _displayType
static YDisplay * FindDisplay(string func)
virtual int drawPixel(int x, int y)
Y_ORIENTATION_enum _orientation
int set_enabled(Y_ENABLED_enum newval)
YDisplay(const string &func)
static const int LAYERWIDTH_INVALID
static const string STARTUPSEQ_INVALID
virtual int saveSequence(string sequenceName)
YRETCODE _upload(const string &path, const string &content)
static int DefaultCacheValidity
string getString(const string &key)
static const int DISPLAYHEIGHT_INVALID
virtual int moveTo(int x, int y)
Y_ENABLED_enum get_enabled(void)
virtual YDisplay * get_display(void)
virtual int setAntialiasingMode(bool mode)
virtual int fade(int brightness, int duration)
void _throw(YRETCODE errType, string errMsg)
void resetHiddenLayerFlags(void)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
static YRETCODE getFunctionInfo(YFUN_DESCR fundesc, YDEV_DESCR &devdescr, string &serial, string &funcId, string &funcName, string &funcVal, string &errmsg)
virtual int selectGrayPen(int graylevel)
virtual int drawBar(int x1, int y1, int x2, int y2)
virtual int consoleOut(string text)
virtual int drawCircle(int x, int y, int r)
virtual int get_layerHeight(void)
virtual int drawImage(int x, int y, string imagename)
#define YAPI_INVALID_STRING
virtual int drawBitmap(int x, int y, int w, string bitmap, int bgcol)
virtual int _parseAttr(YJSONObject *json_val)
virtual int selectEraser(void)
static const int LAYERCOUNT_INVALID
virtual int copyLayerContent(int srcLayerId, int dstLayerId)
virtual int setConsoleWordWrap(bool wordwrap)
static const int LAYERHEIGHT_INVALID
Y_DISPLAYTYPE_enum get_displayType(void)
int getInt(const string &key)
virtual int upload(string pathname, string content)
static u64 GetTickCount(void)
static void _AddToCache(const string &classname, const string &func, YFunction *obj)
virtual int drawText(int x, int y, Y_ALIGN anchor, string text)
virtual int _parseAttr(YJSONObject *json_val)
static const Y_ORIENTATION_enum ORIENTATION_INVALID
virtual int get_displayWidth(void)
int set_command(const string &newval)
virtual int swapLayerContent(int layerIdA, int layerIdB)
static YFunction * _FindFromCache(const string &classname, const string &func)
virtual int pauseSequence(int delay_ms)
static const string COMMAND_INVALID
virtual int setConsoleBackground(int bgcol)
static string ysprintf(const char *fmt,...)
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
static yCRITICAL_SECTION _global_cs
static const int BRIGHTNESS_INVALID
virtual int get_displayHeight(void)
virtual int selectFont(string fontname)
static int getFunctionsByClass(const string &class_str, YFUN_DESCR prevfundesc, vector< YFUN_DESCR > &buffer, int maxsize, string &errmsg)
static const Y_ENABLED_enum ENABLED_INVALID
YDisplayValueCallback _valueCallbackDisplay
virtual int resetHiddenFlag(void)
int set_orientation(Y_ORIENTATION_enum newval)
virtual int stopSequence(void)
static const int DISPLAYWIDTH_INVALID
virtual int drawRect(int x1, int y1, int x2, int y2)
static YDisplay * FirstDisplay(void)
int command_flush(string cmd)
YDisplayLayer * get_displayLayer(unsigned layerId)
virtual int newSequence(void)
vector< YDisplayLayer * > _allDisplayLayers
YDisplayLayer(YDisplay *parent, int id)
static bool _apiInitialized
YRETCODE _nextFunction(string &hwId)
virtual int drawDisc(int x, int y, int r)
virtual int resetAll(void)
static void _UpdateValueCallbackList(YFunction *func, bool add)
static const Y_DISPLAYTYPE_enum DISPLAYTYPE_INVALID
string get_startupSeq(void)
int sendCommand(string cmd)
virtual int lineTo(int x, int y)
virtual int clearConsole(void)
bool has(const string &key)
YRETCODE _setAttr(string attrname, string newvalue)
int command_push(string cmd)
int set_startupSeq(const string &newval)
int get_layerHeight(void)
virtual int get_layerWidth(void)
int get_displayHeight(void)
virtual int _invokeValueCallback(string value)
virtual int setConsoleMargins(int x1, int y1, int x2, int y2)
Y_ORIENTATION_enum get_orientation(void)
int get_displayWidth(void)