Windows Virtual Shields for Arduino
Text.h
Go to the documentation of this file.
1 /*
2  Copyright(c) Microsoft Open Technologies, Inc. All rights reserved.
3 
4  The MIT License(MIT)
5 
6  Permission is hereby granted, free of charge, to any person obtaining a copy
7  of this software and associated documentation files(the "Software"), to deal
8  in the Software without restriction, including without limitation the rights
9  to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
10  copies of the Software, and to permit persons to whom the Software is
11  furnished to do so, subject to the following conditions :
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  THE SOFTWARE.
23 */
24 
25 #ifndef Text_h
26 #define Text_h
27 
28 #include "Sensor.h"
29 
30 const PROGMEM char Y[] = "Y";
31 const PROGMEM char CLEAR[] = "CLEAR";
32 const PROGMEM char RGBAKEY[] = "ARGB";
33 const PROGMEM char PID[] = "Pid";
34 
35 class Text : public Sensor
36 {
37 public:
38  Text(const VirtualShield &shield);
39 
40  int clear(ARGB argb = 0);
41  int clearLine(UINT line);
42  int clearId(UINT id);
43 
44  int print(String text, ARGB argb = 0);
45  int printAt(UINT line, String text, Attr extraAttributes[] = 0, int extraAttributeCount = 0);
46  int printAt(UINT line, EPtr text, Attr extraAttributes[] = 0, int extraAttributeCount = 0);
47  int printAt(UINT line, double value, ARGB argb = 0);
48 
49  void onJsonReceived(JsonObject& root, ShieldEvent* shieldEvent) override;
50 };
51 
52 #endif
Definition: Text.h:35
Definition: Sensor.h:51
Definition: VirtualShield.h:50
const PROGMEM char RGBAKEY[]
Definition: Text.h:32
const PROGMEM char CLEAR[]
Definition: Text.h:31
VirtualShield & shield
Definition: Sensor.h:55
Text(const VirtualShield &shield)
Initializes a new instance of the Screen class.
Definition: Text.cpp:40
unsigned int UINT
Definition: SensorModels.h:28
int clearLine(UINT line)
Clears the line.
Definition: Text.cpp:58
int clear(ARGB argb=0)
Clears the screen of all elements.
Definition: Text.cpp:47
Definition: SensorModels.h:56
int clearId(UINT id)
Clears the element associated with the id.
Definition: Text.cpp:69
void onJsonReceived(JsonObject &root, ShieldEvent *shieldEvent) override
Event called when a valid json message was received. Consumes the proper values for this sensor...
Definition: Text.cpp:125
Definition: SensorModels.h:101
int print(String text, ARGB argb=0)
Prints the specified text.
Definition: Text.cpp:80
Definition: Attr.h:30
Definition: ShieldEvent.h:35
const PROGMEM char PID[]
Definition: Text.h:33
const PROGMEM char Y[]
Definition: Text.h:30
int printAt(UINT line, String text, Attr extraAttributes[]=0, int extraAttributeCount=0)
Prints the specified text at the specified line.
Definition: Text.cpp:104