#include <yocto_display.h>
Public Member Functions | |
virtual int | _invokeValueCallback (string value) |
int | brightness (void) |
string | command (void) |
virtual int | copyLayerContent (int srcLayerId, int dstLayerId) |
int | displayHeight (void) |
Y_DISPLAYTYPE_enum | displayType (void) |
int | displayWidth (void) |
Y_ENABLED_enum | enabled (void) |
virtual int | fade (int brightness, int duration) |
int | flushLayers (void) |
int | get_brightness (void) |
string | get_command (void) |
int | get_displayHeight (void) |
YDisplayLayer * | get_displayLayer (unsigned layerId) |
Y_DISPLAYTYPE_enum | get_displayType (void) |
int | get_displayWidth (void) |
Y_ENABLED_enum | get_enabled (void) |
int | get_layerCount (void) |
int | get_layerHeight (void) |
int | get_layerWidth (void) |
Y_ORIENTATION_enum | get_orientation (void) |
string | get_startupSeq (void) |
int | layerCount (void) |
int | layerHeight (void) |
int | layerWidth (void) |
virtual int | newSequence (void) |
YDisplay * | next (void) |
YDisplay * | nextDisplay (void) |
Y_ORIENTATION_enum | orientation (void) |
virtual int | pauseSequence (int delay_ms) |
virtual int | playSequence (string sequenceName) |
virtual int | registerValueCallback (YDisplayValueCallback callback) |
virtual int | resetAll (void) |
void | resetHiddenLayerFlags (void) |
virtual int | saveSequence (string sequenceName) |
int | sendCommand (string cmd) |
int | set_brightness (int newval) |
int | set_command (const string &newval) |
int | set_enabled (Y_ENABLED_enum newval) |
int | set_orientation (Y_ORIENTATION_enum newval) |
int | set_startupSeq (const string &newval) |
int | setBrightness (int newval) |
int | setCommand (const string &newval) |
int | setEnabled (Y_ENABLED_enum newval) |
int | setOrientation (Y_ORIENTATION_enum newval) |
int | setStartupSeq (const string &newval) |
string | startupSeq (void) |
virtual int | stopSequence (void) |
virtual int | swapLayerContent (int layerIdA, int layerIdB) |
virtual int | upload (string pathname, string content) |
~YDisplay () | |
Public Member Functions inherited from YFunction | |
void | _clearDataStreamCache () |
string | _decode_json_string (const string &json) |
string | _download (const string &url) |
YDataStream * | _findDataStream (YDataSet &dataset, const string &def) |
string | _get_json_path (const string &json, const string &path) |
vector< string > | _json_get_array (const string &json) |
string | _json_get_key (const string &json, const string &data) |
string | _json_get_string (const string &json) |
int | _parseEx (yJsonStateMachine &j) |
virtual int | _parserHelper (void) |
string | _parseString (yJsonStateMachine &j) |
string | _request (const string &request) |
string | _requestEx (int tcpchan, const string &request, yapiRequestProgressCallback callback, void *context) |
void | _throw (YRETCODE errType, string errMsg) |
YRETCODE | _upload (const string &path, const string &content) |
YRETCODE | _uploadWithProgress (const string &path, const string &content, yapiRequestProgressCallback callback, void *context) |
string | advertisedValue (void) |
void | clearCache () |
string | describe (void) |
string | errMessage (void) |
string | errorMessage (void) |
YRETCODE | errorType (void) |
YRETCODE | errType (void) |
YFUN_DESCR | functionDescriptor (void) |
string | get_advertisedValue (void) |
string | get_errorMessage (void) |
YRETCODE | get_errorType (void) |
virtual string | get_friendlyName (void) |
YFUN_DESCR | get_functionDescriptor (void) |
string | get_functionId (void) |
string | get_hardwareId (void) |
string | get_hubSerial () |
string | get_logicalName (void) |
YModule * | get_module (void) |
void * | get_userData (void) |
bool | isOnline (void) |
YRETCODE | load (int msValidity) |
virtual string | loadAttribute (string attrName) |
string | logicalName (void) |
YModule * | module (void) |
virtual int | muteValueCallbacks (void) |
YFunction * | next (void) |
YFunction * | nextFunction (void) |
virtual int | registerValueCallback (YFunctionValueCallback callback) |
int | set_advertisedValue (const string &newval) |
int | set_logicalName (const string &newval) |
void | set_userData (void *data) |
int | setAdvertisedValue (const string &newval) |
int | setLogicalName (const string &newval) |
void | setUserData (void *data) |
virtual int | unmuteValueCallbacks (void) |
void * | userData (void) |
virtual | ~YFunction () |
Static Public Member Functions | |
static YDisplay * | Find (string func) |
static YDisplay * | FindDisplay (string func) |
static YDisplay * | First (void) |
static YDisplay * | FirstDisplay (void) |
Static Public Member Functions inherited from YFunction | |
static void | _ClearCache (void) |
static YFunction * | Find (string func) |
static YFunction * | FindFunction (string func) |
static YFunction * | First (void) |
static YFunction * | FirstFunction (void) |
Private Member Functions | |
virtual int | _parseAttr (YJSONObject *json_val) |
YDisplay (const string &func) | |
Private Attributes | |
vector< YDisplayLayer * > | _allDisplayLayers |
int | _brightness |
string | _command |
int | _displayHeight |
Y_DISPLAYTYPE_enum | _displayType |
int | _displayWidth |
Y_ENABLED_enum | _enabled |
int | _layerCount |
int | _layerHeight |
int | _layerWidth |
Y_ORIENTATION_enum | _orientation |
bool | _recording |
string | _sequence |
string | _startupSeq |
YDisplayValueCallback | _valueCallbackDisplay |
Friends | |
YDisplay * | yFindDisplay (const string &func) |
YDisplay * | yFirstDisplay (void) |
Additional Inherited Members | |
Protected Member Functions inherited from YFunction | |
YRETCODE | _buildSetRequest (const string &changeattr, const string *changeval, string &request, string &errmsg) |
string | _escapeAttr (const string &changeval) |
YRETCODE | _getDescriptor (YFUN_DESCR &fundescr, string &errMsg) |
YRETCODE | _getDevice (YDevice *&dev, string &errMsg) |
YRETCODE | _load_unsafe (int msValidity) |
YRETCODE | _nextFunction (string &hwId) |
int | _parse (YJSONObject *j) |
YRETCODE | _setAttr (string attrname, string newvalue) |
YFunction (const string &func) | |
Static Protected Member Functions inherited from YFunction | |
static void | _AddToCache (const string &classname, const string &func, YFunction *obj) |
static YFunction * | _FindFromCache (const string &classname, const string &func) |
static void | _UpdateTimedReportCallbackList (YFunction *func, bool add) |
static void | _UpdateValueCallbackList (YFunction *func, bool add) |
Protected Attributes inherited from YFunction | |
string | _advertisedValue |
u64 | _cacheExpiration |
string | _className |
std::map< string, YDataStream * > | _dataStreams |
string | _func |
YFUN_DESCR | _fundescr |
string | _funId |
string | _hwId |
string | _lastErrorMsg |
YRETCODE | _lastErrorType |
string | _logicalName |
string | _serial |
yCRITICAL_SECTION | _this_cs |
void * | _userData |
YFunctionValueCallback | _valueCallbackFunction |
Static Protected Attributes inherited from YFunction | |
static std::map< string, YFunction * > | _cache |
YDisplay Class: Display function interface
Yoctopuce display interface has been designed to easily show information and images. The device provides built-in multi-layer rendering. Layers can be drawn offline, individually, and freely moved on the display. It can also replay recorded sequences (animations).
Definition at line 586 of file yocto_display.h.
|
private |
Definition at line 607 of file yocto_display.cpp.
YDisplay::~YDisplay | ( | ) |
Definition at line 629 of file yocto_display.cpp.
|
virtual |
Reimplemented from YFunction.
Definition at line 1199 of file yocto_display.cpp.
|
privatevirtual |
Reimplemented from YFunction.
Definition at line 646 of file yocto_display.cpp.
|
inline |
Definition at line 708 of file yocto_display.h.
|
inline |
Definition at line 829 of file yocto_display.h.
|
virtual |
Copies the whole content of a layer to another layer. The color and transparency of all the pixels from the destination layer are set to match the source pixels. This method only affects the displayed content, but does not change any property of the layer object. Note that layer 0 has no transparency support (it is always completely opaque).
srcLayerId | : the identifier of the source layer (a number in range 0..layerCount-1) |
dstLayerId | : the identifier of the destination layer (a number in range 0..layerCount-1) |
On failure, throws an exception or returns a negative error code.
Definition at line 1361 of file yocto_display.cpp.
|
inline |
Definition at line 775 of file yocto_display.h.
|
inline |
Definition at line 788 of file yocto_display.h.
|
inline |
Definition at line 763 of file yocto_display.h.
|
inline |
Definition at line 656 of file yocto_display.h.
|
virtual |
Smoothly changes the brightness of the screen to produce a fade-in or fade-out effect.
brightness | : the new screen brightness |
duration | : duration of the brightness transition, in milliseconds. |
On failure, throws an exception or returns a negative error code.
Definition at line 1236 of file yocto_display.cpp.
|
inlinestatic |
Definition at line 1015 of file yocto_display.h.
|
static |
Retrieves a display for a given identifier. The identifier can be specified using several formats:
This function does not require that the display is online at the time it is invoked. The returned object is nevertheless valid. Use the method YDisplay.isOnline() to test if the display is indeed online at a given time. In case of ambiguity when looking for a display by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.
If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.
func | : a string that uniquely characterizes the display |
Definition at line 1148 of file yocto_display.cpp.
|
inlinestatic |
Definition at line 1039 of file yocto_display.h.
|
static |
Starts the enumeration of displays currently accessible. Use the method YDisplay.nextDisplay() to iterate on next displays.
Definition at line 1398 of file yocto_display.cpp.
int YDisplay::flushLayers | ( | void | ) |
Definition at line 1431 of file yocto_display.cpp.
int YDisplay::get_brightness | ( | void | ) |
Returns the luminosity of the module informative leds (from 0 to 100).
On failure, throws an exception or returns Y_BRIGHTNESS_INVALID.
Definition at line 802 of file yocto_display.cpp.
string YDisplay::get_command | ( | void | ) |
Definition at line 1083 of file yocto_display.cpp.
int YDisplay::get_displayHeight | ( | void | ) |
Returns the display height, in pixels.
On failure, throws an exception or returns Y_DISPLAYHEIGHT_INVALID.
Definition at line 944 of file yocto_display.cpp.
YDisplayLayer * YDisplay::get_displayLayer | ( | unsigned | layerId | ) |
Returns a YDisplayLayer object that can be used to draw on the specified layer. The content is displayed only when the layer is active on the screen (and not masked by other overlapping layers).
layerId | : the identifier of the layer (a number in range 0..layerCount-1) |
On failure, throws an exception or returns NULL.
Definition at line 1415 of file yocto_display.cpp.
Y_DISPLAYTYPE_enum YDisplay::get_displayType | ( | void | ) |
Returns the display type: monochrome, gray levels or full color.
On failure, throws an exception or returns Y_DISPLAYTYPE_INVALID.
Definition at line 974 of file yocto_display.cpp.
int YDisplay::get_displayWidth | ( | void | ) |
Returns the display width, in pixels.
On failure, throws an exception or returns Y_DISPLAYWIDTH_INVALID.
Definition at line 915 of file yocto_display.cpp.
Y_ENABLED_enum YDisplay::get_enabled | ( | void | ) |
Returns true if the screen is powered, false otherwise.
On failure, throws an exception or returns Y_ENABLED_INVALID.
Definition at line 692 of file yocto_display.cpp.
int YDisplay::get_layerCount | ( | void | ) |
Returns the number of available layers to draw on.
On failure, throws an exception or returns Y_LAYERCOUNT_INVALID.
Definition at line 1061 of file yocto_display.cpp.
int YDisplay::get_layerHeight | ( | void | ) |
Returns the height of the layers to draw on, in pixels.
On failure, throws an exception or returns Y_LAYERHEIGHT_INVALID.
Definition at line 1032 of file yocto_display.cpp.
int YDisplay::get_layerWidth | ( | void | ) |
Returns the width of the layers to draw on, in pixels.
On failure, throws an exception or returns Y_LAYERWIDTH_INVALID.
Definition at line 1003 of file yocto_display.cpp.
Y_ORIENTATION_enum YDisplay::get_orientation | ( | void | ) |
Returns the currently selected display orientation.
On failure, throws an exception or returns Y_ORIENTATION_INVALID.
Definition at line 859 of file yocto_display.cpp.
string YDisplay::get_startupSeq | ( | void | ) |
Returns the name of the sequence to play when the displayed is powered on.
On failure, throws an exception or returns Y_STARTUPSEQ_INVALID.
Definition at line 746 of file yocto_display.cpp.
|
inline |
Definition at line 824 of file yocto_display.h.
|
inline |
Definition at line 812 of file yocto_display.h.
|
inline |
Definition at line 800 of file yocto_display.h.
|
virtual |
Starts to record all display commands into a sequence, for later replay. The name used to store the sequence is specified when calling saveSequence(), once the recording is complete.
On failure, throws an exception or returns a negative error code.
Definition at line 1251 of file yocto_display.cpp.
|
inline |
Definition at line 1026 of file yocto_display.h.
YDisplay * YDisplay::nextDisplay | ( | void | ) |
Continues the enumeration of displays started using yFirstDisplay().
Definition at line 1388 of file yocto_display.cpp.
|
inline |
Definition at line 736 of file yocto_display.h.
|
virtual |
Waits for a specified delay (in milliseconds) before playing next commands in current sequence. This method can be used while recording a display sequence, to insert a timed wait in the sequence (without any immediate effect). It can also be used dynamically while playing a pre-recorded sequence, to suspend or resume the execution of the sequence. To cancel a delay, call the same method with a zero delay.
delay_ms | : the duration to wait, in milliseconds |
On failure, throws an exception or returns a negative error code.
Definition at line 1310 of file yocto_display.cpp.
|
virtual |
Replays a display sequence previously recorded using newSequence() and saveSequence().
sequenceName | : the name of the newly created sequence |
On failure, throws an exception or returns a negative error code.
Definition at line 1290 of file yocto_display.cpp.
|
virtual |
Registers the callback function that is invoked on every change of advertised value. The callback is invoked only during the execution of ySleep or yHandleEvents. This provides control over the time when the callback is triggered. For good responsiveness, remember to call one of these two functions periodically. To unregister a callback, pass a NULL pointer as argument.
callback | : the callback function to call, or a NULL pointer. The callback function should take two arguments: the function object of which the value has changed, and the character string describing the new advertised value. |
Definition at line 1180 of file yocto_display.cpp.
|
virtual |
Clears the display screen and resets all display layers to their default state. Using this function in a sequence will kill the sequence play-back. Don't use that function to reset the display at sequence start-up.
On failure, throws an exception or returns a negative error code.
Definition at line 1218 of file yocto_display.cpp.
void YDisplay::resetHiddenLayerFlags | ( | void | ) |
Definition at line 1440 of file yocto_display.cpp.
|
virtual |
Stops recording display commands and saves the sequence into the specified file on the display internal memory. The sequence can be later replayed using playSequence().
sequenceName | : the name of the newly created sequence |
On failure, throws an exception or returns a negative error code.
Definition at line 1270 of file yocto_display.cpp.
int YDisplay::sendCommand | ( | string | cmd | ) |
Definition at line 1447 of file yocto_display.cpp.
int YDisplay::set_brightness | ( | int | newval | ) |
Changes the brightness of the display. The parameter is a value between 0 and
newval | : an integer corresponding to the brightness of the display |
On failure, throws an exception or returns a negative error code.
Definition at line 835 of file yocto_display.cpp.
int YDisplay::set_command | ( | const string & | newval | ) |
Definition at line 1105 of file yocto_display.cpp.
int YDisplay::set_enabled | ( | Y_ENABLED_enum | newval | ) |
Changes the power state of the display.
newval | : either Y_ENABLED_FALSE or Y_ENABLED_TRUE, according to the power state of the display |
On failure, throws an exception or returns a negative error code.
Definition at line 723 of file yocto_display.cpp.
int YDisplay::set_orientation | ( | Y_ORIENTATION_enum | newval | ) |
Changes the display orientation. Remember to call the saveToFlash() method of the module if the modification must be kept.
newval | : a value among Y_ORIENTATION_LEFT, Y_ORIENTATION_UP, Y_ORIENTATION_RIGHT and Y_ORIENTATION_DOWN corresponding to the display orientation |
On failure, throws an exception or returns a negative error code.
Definition at line 892 of file yocto_display.cpp.
int YDisplay::set_startupSeq | ( | const string & | newval | ) |
Changes the name of the sequence to play when the displayed is powered on. Remember to call the saveToFlash() method of the module if the modification must be kept.
newval | : a string corresponding to the name of the sequence to play when the displayed is powered on |
On failure, throws an exception or returns a negative error code.
Definition at line 779 of file yocto_display.cpp.
|
inline |
Definition at line 723 of file yocto_display.h.
|
inline |
Definition at line 833 of file yocto_display.h.
|
inline |
Definition at line 669 of file yocto_display.h.
|
inline |
Definition at line 751 of file yocto_display.h.
|
inline |
Definition at line 696 of file yocto_display.h.
|
inline |
Definition at line 681 of file yocto_display.h.
|
virtual |
Stops immediately any ongoing sequence replay. The display is left as is.
On failure, throws an exception or returns a negative error code.
Definition at line 1324 of file yocto_display.cpp.
|
virtual |
Swaps the whole content of two layers. The color and transparency of all the pixels from the two layers are swapped. This method only affects the displayed content, but does not change any property of the layer objects. In particular, the visibility of each layer stays unchanged. When used between onae hidden layer and a visible layer, this method makes it possible to easily implement double-buffering. Note that layer 0 has no transparency support (it is always completely opaque).
layerIdA | : the first layer (a number in range 0..layerCount-1) |
layerIdB | : the second layer (a number in range 0..layerCount-1) |
On failure, throws an exception or returns a negative error code.
Definition at line 1382 of file yocto_display.cpp.
|
virtual |
Uploads an arbitrary file (for instance a GIF file) to the display, to the specified full path name. If a file already exists with the same path name, its content is overwritten.
pathname | : path and name of the new file to create |
content | : binary buffer with the content to set |
On failure, throws an exception or returns a negative error code.
Definition at line 1342 of file yocto_display.cpp.
|
friend |
Retrieves a display for a given identifier. The identifier can be specified using several formats:
This function does not require that the display is online at the time it is invoked. The returned object is nevertheless valid. Use the method YDisplay.isOnline() to test if the display is indeed online at a given time. In case of ambiguity when looking for a display by logical name, no error is notified: the first instance found is returned. The search is performed first by hardware name, then by logical name.
If a call to this object's is_online() method returns FALSE although you are certain that the matching device is plugged, make sure that you did call registerHub() at application initialization time.
func | : a string that uniquely characterizes the display |
Definition at line 1101 of file yocto_display.h.
|
friend |
Starts the enumeration of displays currently accessible. Use the method YDisplay.nextDisplay() to iterate on next displays.
Definition at line 1112 of file yocto_display.h.
|
private |
Definition at line 615 of file yocto_display.h.
|
private |
Definition at line 595 of file yocto_display.h.
|
private |
Definition at line 603 of file yocto_display.h.
|
private |
Definition at line 598 of file yocto_display.h.
|
private |
Definition at line 599 of file yocto_display.h.
|
private |
Definition at line 597 of file yocto_display.h.
|
private |
Definition at line 593 of file yocto_display.h.
|
private |
Definition at line 602 of file yocto_display.h.
|
private |
Definition at line 601 of file yocto_display.h.
|
private |
Definition at line 600 of file yocto_display.h.
|
private |
Definition at line 596 of file yocto_display.h.
|
private |
Definition at line 616 of file yocto_display.h.
|
private |
Definition at line 617 of file yocto_display.h.
|
private |
Definition at line 594 of file yocto_display.h.
|
private |
Definition at line 604 of file yocto_display.h.
|
static |
Definition at line 630 of file yocto_display.h.
|
static |
Definition at line 645 of file yocto_display.h.
|
static |
Definition at line 637 of file yocto_display.h.
|
static |
Definition at line 639 of file yocto_display.h.
|
static |
Definition at line 641 of file yocto_display.h.
|
static |
Definition at line 638 of file yocto_display.h.
|
static |
Definition at line 640 of file yocto_display.h.
|
static |
Definition at line 636 of file yocto_display.h.
|
static |
Definition at line 626 of file yocto_display.h.
|
static |
Definition at line 628 of file yocto_display.h.
|
static |
Definition at line 627 of file yocto_display.h.
|
static |
Definition at line 644 of file yocto_display.h.
|
static |
Definition at line 643 of file yocto_display.h.
|
static |
Definition at line 642 of file yocto_display.h.
|
static |
Definition at line 634 of file yocto_display.h.
|
static |
Definition at line 635 of file yocto_display.h.
|
static |
Definition at line 631 of file yocto_display.h.
|
static |
Definition at line 633 of file yocto_display.h.
|
static |
Definition at line 632 of file yocto_display.h.
|
static |
Definition at line 629 of file yocto_display.h.