Documentation
For Arduino users
NexGauge.cpp
Go to the documentation of this file.
1 
16 #include "NexGauge.h"
17 
18 NexGauge::NexGauge(uint8_t pid, uint8_t cid, const char *name)
19  :NexObject(pid, cid, name)
20 {
21 }
22 
23 bool NexGauge::getValue(uint32_t *number)
24 {
25  String cmd = String("get ");
26  cmd += getObjName();
27  cmd += ".val";
28  sendCommand(cmd.c_str());
29  return recvRetNumber(number);
30 }
31 
32 bool NexGauge::setValue(uint32_t number)
33 {
34  char buf[10] = {0};
35  String cmd;
36 
37  utoa(number, buf, 10);
38  cmd += getObjName();
39  cmd += ".val=";
40  cmd += buf;
41 
42  sendCommand(cmd.c_str());
43  return recvRetCommandFinished();
44 }
45 
46 uint32_t NexGauge::Get_background_color_bco(uint32_t *number)
47 {
48  String cmd;
49  cmd += "get ";
50  cmd += getObjName();
51  cmd += ".bco";
52  sendCommand(cmd.c_str());
53  return recvRetNumber(number);
54 }
55 
57 {
58  char buf[10] = {0};
59  String cmd;
60 
61  utoa(number, buf, 10);
62  cmd += getObjName();
63  cmd += ".bco=";
64  cmd += buf;
65  sendCommand(cmd.c_str());
66 
67  cmd="";
68  cmd += "ref ";
69  cmd += getObjName();
70  sendCommand(cmd.c_str());
71  return recvRetCommandFinished();
72 }
73 
74 uint32_t NexGauge::Get_font_color_pco(uint32_t *number)
75 {
76  String cmd;
77  cmd += "get ";
78  cmd += getObjName();
79  cmd += ".pco";
80  sendCommand(cmd.c_str());
81  return recvRetNumber(number);
82 }
83 
84 bool NexGauge::Set_font_color_pco(uint32_t number)
85 {
86  char buf[10] = {0};
87  String cmd;
88 
89  utoa(number, buf, 10);
90  cmd += getObjName();
91  cmd += ".pco=";
92  cmd += buf;
93  sendCommand(cmd.c_str());
94 
95  cmd = "";
96  cmd += "ref ";
97  cmd += getObjName();
98  sendCommand(cmd.c_str());
99  return recvRetCommandFinished();
100 }
101 
102 uint32_t NexGauge::Get_pointer_thickness_wid(uint32_t *number)
103 {
104  String cmd;
105  cmd += "get ";
106  cmd += getObjName();
107  cmd += ".wid";
108  sendCommand(cmd.c_str());
109  return recvRetNumber(number);
110 }
111 
113 {
114  char buf[10] = {0};
115  String cmd;
116 
117  utoa(number, buf, 10);
118  cmd += getObjName();
119  cmd += ".wid=";
120  cmd += buf;
121  sendCommand(cmd.c_str());
122 
123  cmd = "";
124  cmd += "ref ";
125  cmd += getObjName();
126  sendCommand(cmd.c_str());
127  return recvRetCommandFinished();
128 }
129 
130 uint32_t NexGauge::Get_background_cropi_picc(uint32_t *number)
131 {
132  String cmd;
133  cmd += "get ";
134  cmd += getObjName();
135  cmd += ".picc";
136  sendCommand(cmd.c_str());
137  return recvRetNumber(number);
138 }
139 
141 {
142  char buf[10] = {0};
143  String cmd;
144 
145  utoa(number, buf, 10);
146  cmd += getObjName();
147  cmd += ".picc=";
148  cmd += buf;
149  sendCommand(cmd.c_str());
150 
151  cmd = "";
152  cmd += "ref ";
153  cmd += getObjName();
154  sendCommand(cmd.c_str());
155  return recvRetCommandFinished();
156 }
157 
158 
bool setValue(uint32_t number)
Set the value of gauge.
Definition: NexGauge.cpp:32
uint32_t Get_font_color_pco(uint32_t *number)
Get pco attribute of component.
Definition: NexGauge.cpp:74
NexGauge(uint8_t pid, uint8_t cid, const char *name)
Constructor.
Definition: NexGauge.cpp:18
uint32_t Get_background_cropi_picc(uint32_t *number)
Get picc attribute of component.
Definition: NexGauge.cpp:130
bool Set_pointer_thickness_wid(uint32_t number)
Set wid attribute of component.
Definition: NexGauge.cpp:112
The definition of class NexGauge.
bool Set_background_crop_picc(uint32_t number)
Set picc attribute of component.
Definition: NexGauge.cpp:140
uint32_t Get_pointer_thickness_wid(uint32_t *number)
Get wid attribute of component.
Definition: NexGauge.cpp:102
bool Set_font_color_pco(uint32_t number)
Set pco attribute of component.
Definition: NexGauge.cpp:84
bool getValue(uint32_t *number)
Get the value of gauge.
Definition: NexGauge.cpp:23
uint32_t Get_background_color_bco(uint32_t *number)
Get bco attribute of component.
Definition: NexGauge.cpp:46
bool Set_background_color_bco(uint32_t number)
Set bco attribute of component.
Definition: NexGauge.cpp:56
Root class of all Nextion components.
Definition: NexObject.h:32