这篇教程C++ CanRead函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CanRead函数的典型用法代码示例。如果您正苦于以下问题:C++ CanRead函数的具体用法?C++ CanRead怎么用?C++ CanRead使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CanRead函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetAttributeIndexToReadvoid CGXDLMSAutoConnect::GetAttributeIndexToRead(std::vector<int>& attributes){ //LN is static and read only once. if (CGXDLMSObject::IsLogicalNameEmpty(m_LN)) { attributes.push_back(1); } //Mode if (CanRead(2)) { attributes.push_back(2); } //Repetitions if (CanRead(3)) { attributes.push_back(3); } //RepetitionDelay if (CanRead(4)) { attributes.push_back(4); } //CallingWindow if (CanRead(5)) { attributes.push_back(5); } //Destinations if (CanRead(6)) { attributes.push_back(6); }}
开发者ID:bfabio,项目名称:Gurux.DLMS.cpp,代码行数:33,
示例2: CanConfigint CanConfig(unsigned char channel){ unsigned char temp; CanReset(channel); // reset CAN controller //------ Write Control Register (CR) CanWrite(channel, CR, 0x01); // Enter Reset Mode without setting RIE // and enter reset mode (Set Reset Request bit) //------ Write Bus Timing Register 0 & 1 (BTR0 & BTR1) // BTR can be accessed (read/write) if the reset mode is active CanWrite(channel, BTR0, CAN[channel].btr0); // Write Bus Timing Register 0 (BTR0) CanWrite(channel, BTR1, CAN[channel].btr1); // Write Bus Timing Register 1 (BTR1) temp = CanRead(channel, BTR0); if(temp != CAN[channel].btr0) // Read BTR0 and confirm it return(ERR_CONFIG); // fail to configure temp = CanRead(channel, BTR1); if(temp != CAN[channel].btr1) // Read BTR1 and confirm it return(ERR_CONFIG); // fail to configure //------ Write Acceptance Code Register (ACR) and // Acceptance Mask Register (AMR) CanWrite(channel, ACR, CAN[channel].acc_code); // Write ACR CanWrite(channel, AMR, CAN[channel].acc_mask); // Write AMR //------ Write Output Control Register (OCR) // Set Normal Output Mode & Push-pull dirver CanWrite(channel, OCR, 0xfa); return(ERR_OK); // successful}
开发者ID:auxsophia,项目名称:Jaemi-DRC,代码行数:34,
示例3: GetAttributeIndexToReadvoid CGXDLMSActivityCalendar::GetAttributeIndexToRead(std::vector<int>& attributes){ //LN is static and read only once. if (CGXDLMSObject::IsLogicalNameEmpty(m_LN)) { attributes.push_back(1); } //CalendarNameActive if (CanRead(2)) { attributes.push_back(2); } //SeasonProfileActive if (CanRead(3)) { attributes.push_back(3); } //WeekProfileTableActive if (CanRead(4)) { attributes.push_back(4); } //DayProfileTableActive if (CanRead(5)) { attributes.push_back(5); } //CalendarNamePassive if (CanRead(6)) { attributes.push_back(6); } //SeasonProfilePassive if (CanRead(7)) { attributes.push_back(7); } //WeekProfileTablePassive if (CanRead(8)) { attributes.push_back(8); } //DayProfileTablePassive if (CanRead(9)) { attributes.push_back(9); } //Time. if (CanRead(10)) { attributes.push_back(10); }}
开发者ID:d21d3q,项目名称:Gurux.DLMS.cpp,代码行数:54,
示例4: GetWBackwxInputStream& wxInputStream::Read(void *buf, size_t size){ char *p = (char *)buf; m_lastcount = 0; size_t read = GetWBack(buf, size); for ( ;; ) { size -= read; m_lastcount += read; p += read; if ( !size ) { // we read the requested amount of data break; } if ( p != buf && !CanRead() ) { // we have already read something and we would block in OnSysRead() // now: don't do it but return immediately break; } read = OnSysRead(p, size); if ( !read ) { // no more data available break; } } return *this;}
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:35,
示例5: RETURN_ZERO_IF_FALSEsize_t BufferStream::ReadDataTo(MemoryData& outData, DataReadingMode mode/*=DataReadingMode::AlwaysCopy*/)const{ RETURN_ZERO_IF_FALSE(CanRead()); FlushOnReadWrite(StreamDataOperation::Read); size_t outPos = 0; size_t outSize = outData.Size(); //read left buffer data size_t bufferLeftLength = mBufferLength - mBuffer.Position(); if (bufferLeftLength != 0) { size_t readSize = Math::Min(bufferLeftLength, outSize); MemoryData tempData = MemoryData::FromStatic(outData.MutableData() + outPos, readSize); readSize = mBuffer.ReadDataTo(tempData, DataReadingMode::AlwaysCopy); outPos += readSize; outSize -= readSize; } //directly read to out data block per block size_t blockSize = mBuffer.Length(); size_t blockCount = outSize / blockSize; FOR_EACH_SIZE(i, blockCount) { MemoryData tempData = MemoryData::FromStatic(outData.MutableData() + outPos, blockSize); size_t readSize = mSourceStream->ReadDataTo(tempData); outPos += readSize; outSize -= readSize; if (readSize != blockSize) //last block { return outPos; } }
开发者ID:fjz13,项目名称:Medusa,代码行数:33,
示例6: acceptbool EzSockets::accept(EzSockets& socket){ if (!blocking && !CanRead()) return false; #if defined(HAVE_INET_NTOP) char buf[INET_ADDRSTRLEN]; inet_ntop(AF_INET, &addr.sin_addr, buf, INET_ADDRSTRLEN); address = buf; #elif defined(HAVE_INET_NTOA) address = inet_ntoa(addr.sin_addr); #endif int length = sizeof(socket); socket.sock = ::accept(sock,(struct sockaddr*) &socket.addr, (socklen_t*) &length); lastCode = socket.sock; if (socket.sock <= 0) return false; socket.state = skCONNECTED; return true;}
开发者ID:geekmaster,项目名称:stepmania-3.9,代码行数:29,
示例7: RETURN_ZERO_IF_FALSEsize_t IStream::ReadToStream(size_t size, IStream& dest, size_t bufferSize/*=1024*/)const{ RETURN_ZERO_IF_FALSE(CanRead() && dest.CanWrite()); if (dest.IsPtrAvailable())//could directly write { dest.ReserveLeftSize(size); byte* buffer = dest.MutablePtr(); MemoryData destBuffer = MemoryData::FromStatic(buffer, size); return ReadDataTo(destBuffer, DataReadingMode::AlwaysCopy); } else { //should use temp buffer size_t count = 0; size_t realBufferSize = Math::Min(LeftLength(), bufferSize, size); MemoryData tempBuffer = MemoryData::Alloc(realBufferSize); do { size_t readSize = Math::Min(size, realBufferSize); tempBuffer.ForceSetSize(readSize); readSize = ReadDataTo(tempBuffer, DataReadingMode::AlwaysCopy); BREAK_IF_ZERO(readSize); tempBuffer.ForceSetSize(readSize); count += dest.WriteData(tempBuffer); tempBuffer.ForceSetSize(realBufferSize); size -= readSize; } while (size > 0); return count; }}
开发者ID:fjz13,项目名称:Medusa,代码行数:34,
示例8: RecvUnknowLen// 接收数据int RecvUnknowLen(int SocketFd, void *ptr, size_t nbytes, int nSecond, int nMiniSec) { ssize_t n = -1; if (nbytes > 0) { while ((n = recv(SocketFd, (char *)ptr, nbytes, 0)) < 0) { if (EWOULDBLOCK == errno) { if (nSecond || nMiniSec) { if (CanRead(SocketFd, nSecond, nMiniSec) <= 0) { break; } nSecond = 0;//nMiniSec只等一次 nMiniSec = 0; } else { break; } } else { //连接需要关闭 n = 0; break; } } } return n;}
开发者ID:hamburger20140810,项目名称:utils,代码行数:35,
示例9: GetAttributeIndexToReadvoid CGXDLMSAutoAnswer::GetAttributeIndexToRead(std::vector<int>& attributes){ //LN is static and read only once. if (CGXDLMSObject::IsLogicalNameEmpty(m_LN)) { attributes.push_back(1); } //Mode is static and read only once. if (!IsRead(2)) { attributes.push_back(2); } //ListeningWindow is static and read only once. if (!IsRead(3)) { attributes.push_back(3); } //Status is not static. if (CanRead(4)) { attributes.push_back(4); } //NumberOfCalls is static and read only once. if (!IsRead(5)) { attributes.push_back(5); } //NumberOfRingsInListeningWindow is static and read only once. if (!IsRead(6)) { attributes.push_back(6); }}
开发者ID:d21d3q,项目名称:Gurux.DLMS.cpp,代码行数:34,
|