本文整理汇总了C++中Print类的典型用法代码示例。如果您正苦于以下问题:C++ Print类的具体用法?C++ Print怎么用?C++ Print使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Print类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print_channel_state
void slave_status::print_channel_state(Print& out, const channel_state_t& state)
{
switch (state)
{
case channel_working:
out.print("Working Normally");
break;
case channel_disconnected:
out.print("Disconnected / Solenoid Not Found");
break;
case channel_failed_short:
out.print("Short-Circuited");
break;
case channel_failed_open:
out.print("Failed Open-Circuit");
break;
default:
out.print("Unknown / Invalid Channel Status");
break;
}
}
示例2: LoadHeader
void CApplicationMonitor::Dump(Print &rDestination, bool bOnlyIfPresent) const
{
CApplicationMonitorHeader Header;
CCrashReport Report;
uint8_t uReport;
uint32_t uAddress;
LoadHeader(Header);
if (!bOnlyIfPresent || Header.m_uSavedReports != 0)
{
rDestination.println(F("Application Monitor"));
rDestination.println(F("-------------------"));
PrintValue(rDestination, F("Saved reports: "), Header.m_uSavedReports, DEC, true);
PrintValue(rDestination, F("Next report: "), Header.m_uNextReport, DEC, true);
for (uReport = 0; uReport < Header.m_uSavedReports; ++uReport)
{
LoadReport(uReport, Report);
rDestination.print(uReport);
uAddress = 0;
memcpy(&uAddress, Report.m_auAddress, PROGRAM_COUNTER_SIZE);
PrintValue(rDestination, F(": word-address=0x"), uAddress, HEX, false);
PrintValue(rDestination, F(": byte-address=0x"), uAddress * 2, HEX, false);
PrintValue(rDestination, F(", data=0x"), Report.m_uData, HEX, true);
}
}
}
示例3: printdesc
void GAnalogSensor::printdesc(Print& prn)
{
// e.g. A0:
prn.print(F("A"));
prn.print(_pin);
prn.print(F(": "));
}
示例4: send
void OSCBundle::send(Print &p){
//don't send a bundle with errors
if (hasError()){
return;
}
//write the bundle header
static uint8_t header[] = {'#', 'b', 'u', 'n', 'd', 'l', 'e', 0};
p.write(header, 8);
//write the timetag
{
osctime_t time = timetag;
uint32_t d = BigEndian(time.seconds);
uint8_t * ptr = (uint8_t *) &d;
p.write(ptr, 4);
d = BigEndian(time.fractionofseconds);
ptr = (uint8_t *) &d;
p.write(ptr, 4);
}
//send the messages
for (int i = 0; i < numMessages; i++){
OSCMessage * msg = getOSCMessage(i);
int msgSize = msg->bytes();
//turn the message size into a pointer
uint32_t s32 = BigEndian((uint32_t) msgSize);
uint8_t * sptr = (uint8_t *) &s32;
//write the messsage size
p.write(sptr, 4);
msg->send(p);
}
}
示例5: printDigits
void printDigits(Print &print, int digits) {
// utility function for digital clock display: prints preceding colon and leading 0
print.print(":");
if (digits < 10)
print.print('0');
print.print(digits);
}
示例6: printTo
size_t IPAddress::printTo(Print& p) const {
size_t n = 0;
if (!isSet())
return p.print(F("(IP unset)"));
#if LWIP_IPV6
if (isV6()) {
int count0 = 0;
for (int i = 0; i < 8; i++) {
uint16_t bit = PP_NTOHS(raw6()[i]);
if (bit || count0 < 0) {
n += p.printf("%x", bit);
if (count0 > 0)
// no more hiding 0
count0 = -8;
} else
count0++;
if ((i != 7 && count0 < 2) || count0 == 7)
n += p.print(':');
}
return n;
}
#endif
for(int i = 0; i < 4; i++) {
n += p.print((*this)[i], DEC);
if (i != 3)
n += p.print('.');
}
return n;
}
示例7: setDateFromStream
void setDateFromStream(Stream &in, Print& out) {
out.print("set date (MM/DD/YYYY): ");
int month, day, year;
int val = in.peek();
while(val <= ' ') {
in.read();
val = in.peek();
}
do {
month = in.parseInt();
} while(month == 0);
if(in.peek() != '/') {
out.println("Syntax error");
return;
}
day = in.parseInt();
if(in.peek() != '/') {
out.println("Syntax error");
return;
}
year = in.parseInt();
if(year < 100) {
year += 2000;
}
rtc_clock.set_date(day, month, year);
}
示例8: booleanValue
void JsonPrinter::booleanValue(Print& printer, boolean value) {
if (value == true) {
printer.print("true");
} else {
printer.print("false");
}
}
示例9: setTimeFromStream
void setTimeFromStream(Stream &in, Print& out) {
out.print("set time (HH:MM:SS): ");
int second, minute, hour;
int val = in.peek();
while(val < '0' || val > '9') {
if(val > ' ') {
out.println("Syntax error");
return;
}
in.read();
val = in.peek();
}
hour = in.parseInt();
if(in.peek() != ':') {
out.println("Syntax error");
return;
}
minute = in.parseInt();
if(in.peek() != ':') {
second = 0;
} else {
second = in.parseInt();
}
rtc_clock.set_time(hour, minute, second);
}
示例10: printTo
size_t JsonObjectBase::printTo(Print& p) const
{
size_t n = 0;
n += p.write('{');
// NB: the code has been optimized for a small size on a 8-bit AVR
const KeyValuePair* current = items;
for (int i = count; i > 0; i--)
{
n += EscapedString::printTo(current->key, p);
n += p.write(':');
n += current->value.printTo(p);
current++;
if (i > 1)
{
n += p.write(',');
}
}
n += p.write('}');
return n;
}
示例11: printErrorCb
void printErrorCb(TxStatusResponse& r, uintptr_t data) {
Print *p = (Print*)data;
if (!r.isSuccess()) {
p->print(F("Error sending packet. Delivery status: "));
p->println(r.getStatus());
}
}
示例12: digitalDateDisplay
void digitalDateDisplay(Print& print) {
print.print(day());
print.print(".");
print.print(month());
print.print(".");
print.print(year());
}
示例13: digitalClockDisplay
void digitalClockDisplay(Print &print) {
// digital clock display of the time
digitalTimeDisplay(print);
print.print(" ");
digitalDateDisplay(print);
print.println();
}
示例14: PrintValue
void CApplicationMonitor::PrintValue(Print &rDestination, const __FlashStringHelper *pLabel,
uint32_t uValue, uint8_t uRadix, bool bNewLine) const
{
rDestination.print(pLabel);
rDestination.print(uValue, uRadix);
if (bNewLine)
rDestination.println();
}
示例15: printCharTo
static inline size_t printCharTo(char c, Print& p)
{
char specialChar = getSpecialChar(c);
return specialChar != 0
? p.write('\\') + p.write(specialChar)
: p.write(c);
}