当前位置: 首页>>代码示例>>C++>>正文


C++ Print::write方法代码示例

本文整理汇总了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;
    }
  }
}
开发者ID:Expanduino,项目名称:Expanduino-Arduino,代码行数:98,代码来源:meta.cpp

示例2: writeTabs

 size_t writeTabs() {
   size_t n = 0;
   for (int i = 0; i < level * tabSize; i++) n += sink->write(' ');
   return n;
 }
开发者ID:anhtuan200794,项目名称:libraries,代码行数:5,代码来源:IndentedPrint.hpp

示例3: putChar

void DataStream::putChar(char ch) {
    if (_isUSB && (!SerialUSB.isConnected() || (!SerialUSB.getDTR() && !SerialUSB.getRTS()))) 
        return; 
    _out->write(&ch,1); };
开发者ID:suspect-devices,项目名称:cache-and-carry,代码行数:4,代码来源:main.cpp

示例4: puts

void DataStream::puts(char *s) { 
    if (_isUSB && (!SerialUSB.isConnected() || (!SerialUSB.getDTR() && !SerialUSB.getRTS()))) 
        return;
    _out->write(s); 
};
开发者ID:suspect-devices,项目名称:cache-and-carry,代码行数:5,代码来源:main.cpp

示例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);
}
开发者ID:dsansoni,项目名称:NetSecProject,代码行数:7,代码来源:BigNumber.cpp

示例6: hNibble

size_t hNibble(Print& p, byte val)
{
    return p.write(val + (val<10 ? '0' : 'A'-10));
}
开发者ID:RobTillaart,项目名称:Arduino,代码行数:4,代码来源:avrheap.cpp


注:本文中的Print::write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。