本文整理汇总了C++中Print::write方法的典型用法代码示例。如果您正苦于以下问题:C++ Print::write方法的具体用法?C++ Print::write怎么用?C++ Print::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Print
的用法示例。
在下文中一共展示了Print::write方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dispatch
void MetaExpanduinoSubdevice::dispatch(uint8_t opcode, Stream& request, Print& response) {
switch (opcode) {
case EXPANDUINO_CMD_META_VENDOR_NAME: {
container.getVendorName(response);
break;
}
case EXPANDUINO_CMD_META_PRODUCT_NAME: {
container.getProductName(response);
break;
}
case EXPANDUINO_CMD_META_SHORT_NAME: {
container.getShortName(response);
break;
}
case EXPANDUINO_CMD_META_SERIAL_NUMBER: {
container.getSerialNumber(response);
break;
}
case EXPANDUINO_CMD_META_RESET: {
if (request.available()) {
ExpanduinoSubdevice* dev = container.getDevice(request.read());
if (dev) {
dev->setInterruptionEnabled(false);
dev->reset();
}
} else {
container.reset();
}
break;
}
case EXPANDUINO_CMD_META_GET_INTERRUPTION: {
container.readInterruptionData(response);
break;
}
case EXPANDUINO_CMD_META_GET_INTERRUPTION_ENABLED: {
if (request.available()) {
ExpanduinoSubdevice* dev = container.getDevice(request.read());
if (dev) {
response.write(dev->interruptionEnabled);
}
}
break;
}
case EXPANDUINO_CMD_META_SET_INTERRUPTION_ENABLED: {
if (request.available()) {
ExpanduinoSubdevice* dev = container.getDevice(request.read());
if (dev && request.available()) {
dev->setInterruptionEnabled(request.read());
}
}
break;
}
case EXPANDUINO_CMD_META_NUM_SUBDEVICES: {
response.write(container.getNumSubdevices());
break;
}
case EXPANDUINO_CMD_META_SUBDEVICE_TYPE: {
uint8_t devType = EXPANDUINO_DEVICE_TYPE_MISSING;
if (request.available()) {
ExpanduinoSubdevice* dev = container.getDevice(request.read());
if (dev) {
response.write(dev->devType);
}
}
break;
}
case EXPANDUINO_CMD_META_SUBDEVICE_NAME: {
if (request.available()) {
ExpanduinoSubdevice* dev = container.getDevice(request.read());
if (dev) {
dev->getName(response);
}
}
break;
}
case EXPANDUINO_CMD_META_SUBDEVICE_SHORT_NAME: {
if (request.available()) {
ExpanduinoSubdevice* dev = container.getDevice(request.read());
if (dev) {
dev->getShortName(response);
}
}
break;
}
}
}
示例2: writeTabs
size_t writeTabs() {
size_t n = 0;
for (int i = 0; i < level * tabSize; i++) n += sink->write(' ');
return n;
}
示例3: putChar
void DataStream::putChar(char ch) {
if (_isUSB && (!SerialUSB.isConnected() || (!SerialUSB.getDTR() && !SerialUSB.getRTS())))
return;
_out->write(&ch,1); };
示例4: puts
void DataStream::puts(char *s) {
if (_isUSB && (!SerialUSB.isConnected() || (!SerialUSB.getDTR() && !SerialUSB.getRTS())))
return;
_out->write(s);
};
示例5: printTo
// Allow Arduino's Serial.print() to print BigNumber objects!
size_t BigNumber::printTo(Print& p) const
{
char *buf = bc_num2str(num_);
p.write(buf);
free(buf);
}
示例6: hNibble
size_t hNibble(Print& p, byte val)
{
return p.write(val + (val<10 ? '0' : 'A'-10));
}