本文整理汇总了C++中sendBuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ sendBuffer函数的具体用法?C++ sendBuffer怎么用?C++ sendBuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendBuffer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: KeyPressHandling
void KeyPressHandling(void) {
char c;
if ( kbhit() ) {
c = getchar();
if ( c == 'c' ) {
printf("YOU HIT 'c' ...NOW QUITTING\n");
exit(1);
}
if ( c == 'h' ) {
DEBUG(LOG_NOTICE, "Arming home");
sendBuffer(&PowerlinkCommand[Pmax_ARMHOME]);
}
if ( c == 'd' ) {
DEBUG(LOG_NOTICE, "Disarm");
sendBuffer(&PowerlinkCommand[Pmax_DISARM]);
}
if ( c == 'a' ) {
DEBUG(LOG_NOTICE, "Arming away");
sendBuffer(&PowerlinkCommand[Pmax_ARMAWAY]);
}
if ( c == 'g' ) {
DEBUG(LOG_NOTICE, "Get Event log");
sendBuffer(&PowerlinkCommand[Pmax_GETEVENTLOG]);
}
if ( c == 'r' ) {
DEBUG(LOG_NOTICE, "Request Status Update");
sendBuffer(&PowerlinkCommand[Pmax_REQSTATUS]);
}
}
}
开发者ID:thefrip,项目名称:pmaxd,代码行数:31,代码来源:pmaxd.c
示例2: sendBuffer
DRIVER_ERROR Hbpl1::FormFeed ()
{
if (0 != m_numScanLines && m_pbyStripData && 0 != m_nStripSize)
{
++m_nBandCount;
m_pHbpl1Wrapper->Encapsulate(m_pbyStripData, m_nStripSize, m_nStripHeight, (void**)&m_pOutBuffer, &m_OutBuffSize);
sendBuffer(m_pOutBuffer, m_OutBuffSize);
memset(m_pbyStripData,0xFF,m_nStripSize);
}
while(m_nBandCount < m_numStrips)
{
++m_nBandCount;
m_pHbpl1Wrapper->Encapsulate(m_pbyStripData, m_nStripSize, m_nStripHeight, (void**)&m_pOutBuffer, &m_OutBuffSize);
sendBuffer(m_pOutBuffer, m_OutBuffSize);
}
m_pHbpl1Wrapper->EndPage((void**)&m_pOutBuffer, &m_OutBuffSize);
sendBuffer(m_pOutBuffer, m_OutBuffSize);
m_pHbpl1Wrapper->FreeBuffer(m_pOutBuffer,m_OutBuffSize);
m_nBandCount = 0;
return NO_ERROR;
}
开发者ID:zdohnal,项目名称:hplip,代码行数:26,代码来源:Hbpl1.cpp
示例3: sendBuffer
int CSocket::sendMessage(CBuffer& pSource, char* pIp, int pPort)
{
if(udp)
return sendBuffer(pSource, pIp, pPort);
CBuffer sendBuff;
sendBuff.writeuShort(pSource.length());
sendBuff.writeBuffer(pSource);
return sendBuffer(sendBuff);
}
开发者ID:Guthius,项目名称:gs2emu-googlecode,代码行数:9,代码来源:CSocket.cpp
示例4: RELEASE_LOG_IF_ALLOWED
void NetworkResourceLoader::didReceiveBuffer(Ref<SharedBuffer>&& buffer, int reportedEncodedDataLength)
{
if (!m_hasReceivedData) {
RELEASE_LOG_IF_ALLOWED("didReceiveBuffer: Started receiving data (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", m_parameters.webPageID, m_parameters.webFrameID, m_parameters.identifier);
m_hasReceivedData = true;
}
#if ENABLE(NETWORK_CACHE)
ASSERT(!m_cacheEntryForValidation);
if (m_bufferedDataForCache) {
// Prevent memory growth in case of streaming data.
const size_t maximumCacheBufferSize = 10 * 1024 * 1024;
if (m_bufferedDataForCache->size() + buffer->size() <= maximumCacheBufferSize)
m_bufferedDataForCache->append(buffer.get());
else
m_bufferedDataForCache = nullptr;
}
#endif
// FIXME: At least on OS X Yosemite we always get -1 from the resource handle.
unsigned encodedDataLength = reportedEncodedDataLength >= 0 ? reportedEncodedDataLength : buffer->size();
m_bytesReceived += buffer->size();
if (m_bufferedData) {
m_bufferedData->append(buffer.get());
m_bufferedDataEncodedDataLength += encodedDataLength;
startBufferingTimerIfNeeded();
return;
}
sendBuffer(buffer, encodedDataLength);
}
开发者ID:eocanha,项目名称:webkit,代码行数:31,代码来源:NetworkResourceLoader.cpp
示例5: ConfigHeader_hton
void ConfigChannel::readParamArray(cvg_int id, cvg_char *buffer, cvg_int length) {
cvg_bool closeChannelOnError = true;
try {
ConfigHeader header;
header.signature = PROTOCOL_CONFIG_SIGNATURE;
header.info.mode = CONFIG_READ;
header.info.paramId = id;
header.info.dataLength = 0;
ConfigHeader_hton(&header);
sendBuffer(&header, sizeof(ConfigHeader), true);
recvBuffer(&header, sizeof(ConfigHeader));
ConfigHeader_ntoh(&header);
if ((header.info.mode != CONFIG_WRITE && header.info.mode != CONFIG_NACK) || header.info.paramId != id) {
throw cvgException("bad response");
}
if (header.info.dataLength > length) {
throw cvgException("data too long");
}
if (header.info.mode == CONFIG_NACK) {
closeChannelOnError = false;
throw cvgException("bad parameter specification");
}
recvBuffer(buffer, length);
} catch(cvgException e) {
if (closeChannelOnError) close();
throw cvgException(cvgString("[ConfigChannel] Error writing parameter ID ") + id + ". Reason: " + e.getMessage());
}
}
开发者ID:ankit5311,项目名称:mavwork,代码行数:28,代码来源:ConfigChannel.cpp
示例6: sendBuffer
void WorkerProtocolImpl::sendSolution(const SolutionCertificate& solution)
{
msgpack::sbuffer sbuf;
msgpack::pack(&sbuf, static_cast<message_id_t>(SOLUTION_REPORT_ID));
msgpack::pack(&sbuf, solution);
sendBuffer(socket, sbuf);
}
开发者ID:junks,项目名称:GenomicsProject,代码行数:7,代码来源:protocol_impl.cpp
示例7: sendHeader
void Settings::sendSysInfo()
{
if ( debug )
{
Serial.println ( "[I] Getting sysinfo json" );
}
sendHeader ( 200, "text/json", getSysInfoSize () );
String json = "{";
json += "\"freememory\":\"" + ( String ) ESP.getFreeHeap () + "\",";
json += "\"deauthpackets\":\"" + ( String ) deauthpackets + "\",";
json += "\"beaconpackets\":\"" + ( String ) beaconpackets + "\",";
json += "\"uptime\":\"" + ( String ) millis () + "\",";
json += "\"ipaddress\":\"" + ( String ) WiFi.localIP ().toString () + "\",";
json += "\"gateway\":\"" + ( String ) WiFi.gatewayIP ().toString () + "\",";
json += "\"bootmode\":\"" + ( String ) ESP.getBootMode () + "\",";
json += "\"bootversion\":\"" + ( String ) ESP.getBootVersion () + "\",";
json += "\"sdkversion\":\"" + ( String ) ESP.getSdkVersion () + "\",";
json += "\"chipid\":\"" + ( String ) ESP.getChipId () + "\",";
json += "\"flashchipid\":\"" + ( String ) ESP.getFlashChipId () + "\",";
json += "\"flashchipsize\":\"" + ( String ) ESP.getFlashChipSize () + "\",";
json += "\"flashchiprealsize\":\"" +
( String ) ESP.getFlashChipRealSize () +
"\"}";
sendToBuffer ( json );
sendBuffer ();
if ( debug )
{
Serial.println ( "\n[+] Done" );
}
}
开发者ID:awesome-pentest-gadgets,项目名称:fluxion-esp8266,代码行数:32,代码来源:Settings.cpp
示例8: openUsbDevice
void Communicator::initiateUsbConnection(uint32_t vendorId, uint32_t productId, uint32_t sessionId)
{
openUsbDevice((uint16_t)vendorId, (uint16_t)productId); //initUsbDevice((uint16_t)vendorId, (uint16_t)productId);
if (isInitialized())
{
// send back the vendorId and productId
int len = 4 + 4 + (PTP_HEADER * 2);
uint8_t *buf = (uint8_t *)malloc(len);
bzero(&buf[0], len);
*(uint32_t *)&buf[0] = (uint32_t)htole32(len);
setPtpHeader(buf, 4, PTP_HEADER + 4 , 0x0002, 0x0001, sessionId);
*(uint16_t *)&buf[4 + PTP_HEADER] = htole16(mVendorId);
*(uint16_t *)&buf[4 + PTP_HEADER + 2] = htole16(mProductId);
syslog(LOG_INFO, "vendor: %d product: %d", mVendorId, mProductId);
syslog(LOG_INFO, "vendor: %d product: %d", htole16(mVendorId), htole16(mProductId));
setPtpHeader(buf, 4 + PTP_HEADER + 4, PTP_HEADER , 0x0003, 0x2001, sessionId);
sendBuffer(buf, len);
free(buf);
} else
sendResponsePacket(isInitialized() ? 0x2001 : 0x2002, sessionId);
}
开发者ID:Ivo924,项目名称:DslrDashboardServer,代码行数:25,代码来源:communicator.cpp
示例9: packetManager
void packetManager(struct PlinkBuffer * commandBuffer) {
if (deFormatBuffer(commandBuffer)) {
DEBUG(LOG_DEBUG, "Packet received");
logBuffer(LOG_DEBUG,commandBuffer);
int cmd_not_recognized=1;
int i;
for (i=0;i<Pmax_NBCOMMAND;i++) {
if (findCommand(commandBuffer, &PmaxCommand[i])) {
PmaxCommand[i].action(commandBuffer);
cmd_not_recognized=0;
break;
}
}
if ( cmd_not_recognized==1 ) {
DEBUG(LOG_INFO, "Packet not recognized");
logBuffer(LOG_INFO, commandBuffer);
sendBuffer(&PowerlinkCommand[Pmax_ACK]);
}
}
else {
DEBUG(LOG_ERR, "Packet not correctly formated");
logBuffer(LOG_ERR,commandBuffer);
}
//command has been treated, reset the commandbuffer
commandBuffer->size=0;
DEBUG(LOG_DEBUG, "End of packet treatment");
}
开发者ID:thefrip,项目名称:pmaxd,代码行数:28,代码来源:pmaxd.c
示例10: throw
void PollUGenInternal::processBlock(bool& shouldDelete, const unsigned int blockID, const int /*channel*/) throw()
{
const int numSamplesToProcess = uGenOutput.getBlockSize();
float* outputSamples = uGenOutput.getSampleData();
float* const trigSamples = inputs[Trig].processBlock(shouldDelete, blockID, 0);
for(int sample = 0; sample < numSamplesToProcess; sample++)
{
float thisTrig = trigSamples[sample];
if(thisTrig > 0.f && lastTrig <= 0.f)
{
const int numChannels = inputs[Input].getNumChannels();
Buffer poll = Buffer::newClear(numChannels);
float * const pollSamples = poll.getData(0);
for(int channel = 0; channel < numChannels; channel++)
{
float* const inputSamples = inputs[Input].processBlock(shouldDelete, blockID, channel);
pollSamples[channel] = inputSamples[sample];
}
sendBuffer(poll);
}
*outputSamples++ = 0.f;
lastTrig = thisTrig;
}
}
开发者ID:kazu2012,项目名称:ofxUGen,代码行数:29,代码来源:ugen_Poll.cpp
示例11: memcpy
DRIVER_ERROR Hbpl1::Encapsulate (RASTERDATA *InputRaster, bool bLastPlane)
{
DRIVER_ERROR err = NO_ERROR;
++m_nScanLineCount;
if ( m_numScanLines == -1)
{
if((int)m_JA.media_attributes.printable_height % m_nStripHeight)
m_numStrips++;
err = m_pHbpl1Wrapper->InitStripBuffer(m_nScanLineSize * 3 * m_nStripHeight);
}
if (m_numScanLines < m_nStripHeight && m_pbyStripData)
{
memcpy((BYTE*)&(m_pbyStripData[m_numScanLines * m_nScanLineSize * 3]),InputRaster->rasterdata[COLORTYPE_COLOR],InputRaster->rastersize[COLORTYPE_COLOR]);
m_numScanLines++;
}
if (m_numScanLines >= m_nStripHeight && m_pbyStripData)
{
++m_nBandCount;
m_pHbpl1Wrapper->Encapsulate(m_pbyStripData, m_nStripSize, m_nStripHeight, (void**)&m_pOutBuffer, &m_OutBuffSize);
memset(m_pbyStripData,0xFF,m_nStripSize);
m_numScanLines = 0;
err = sendBuffer(static_cast<const BYTE *>(m_pOutBuffer), m_OutBuffSize);
m_pHbpl1Wrapper->FreeBuffer(m_pOutBuffer, m_OutBuffSize);
}
return err;
}
开发者ID:zdohnal,项目名称:hplip,代码行数:31,代码来源:Hbpl1.cpp
示例12: main
void main()
{
lcdInit();
spiOn();
spiOff();
sendByte(out);
sendArray(array);
lcdOn();
lcdOff();
sendBuffer();
sendPart(3, 7, LCD_Buffer);
clear();
clearPart(5, 76);
clearPartColor(5, 76, clBLACK);
setPenColor(clBLACK);
setBackColor(clWHITE);
delay_nsek(40);
scsOn();
scsOff();
i = getValue(LCD_Buffer, 23, 266);
setValue(LCD_Buffer, 23, 266, 0x3F);
setCharge();
resetCharge();
drawPixel(5, 5, LCD_Buffer);
drawVLine(5, 5, 5, LCD_Buffer);
drawHLine(5, 5, 5, LCD_Buffer);
drawLine(5, 5, 55, 55, LCD_Buffer);
drawRect(5, 5, 55, 55, LCD_Buffer);
drawFillRect(5, 5, 55, 55, clWHITE, LCD_Buffer);
drawCircle(10, 10, 5, LCD_Buffer);
}
开发者ID:sphincs,项目名称:LCD,代码行数:31,代码来源:main.c
示例13: htonl
void UDPThread::prepareBuffer() {
uint8_t *packetBuffer = new uint8_t[m_payloadSize];
uint8_t *data;
ssize_t transmittedBytes = 0;
uint16_t frameCount = 0;
struct CannelloniDataPacket *dataPacket;
struct timeval currentTime;
m_frameBuffer->swapBuffers();
if (m_sort)
m_frameBuffer->sortIntermediateBuffer();
std::list<canfd_frame*> *buffer = m_frameBuffer->getIntermediateBuffer();
data = packetBuffer+CANNELLONI_DATA_PACKET_BASE_SIZE;
for (auto it = buffer->begin(); it != buffer->end(); it++) {
canfd_frame *frame = *it;
/* Check for packet overflow */
if ((data-packetBuffer
+CANNELLONI_FRAME_BASE_SIZE
+canfd_len(frame)
+((frame->len & CANFD_FRAME)?sizeof(frame->flags):0)) > m_payloadSize) {
/* Move all remaining frames back to m_buffer */
m_frameBuffer->returnIntermediateBuffer(it);
break;
}
canid_t tmp = htonl(frame->can_id);
memcpy(data, &tmp, sizeof(canid_t));
/* += 4 */
data += sizeof(canid_t);
*data = frame->len;
/* += 1 */
data += sizeof(frame->len);
/* If this is a CAN FD frame, also send the flags */
if (frame->len & CANFD_FRAME) {
*data = frame->flags;
/* += 1 */
data += sizeof(frame->flags);
}
if ((frame->can_id & CAN_RTR_FLAG) == 0) {
memcpy(data, frame->data, canfd_len(frame));
data+=canfd_len(frame);
}
frameCount++;
}
dataPacket = (struct CannelloniDataPacket*) packetBuffer;
dataPacket->version = CANNELLONI_FRAME_VERSION;
dataPacket->op_code = DATA;
dataPacket->seq_no = m_sequenceNumber++;
dataPacket->count = htons(frameCount);
transmittedBytes = sendBuffer(packetBuffer, data-packetBuffer);
if (transmittedBytes != data-packetBuffer) {
lerror << "UDP Socket error. Error while transmitting" << std::endl;
} else {
m_txCount++;
}
m_frameBuffer->unlockIntermediateBuffer();
m_frameBuffer->mergeIntermediateBuffer();
delete[] packetBuffer;
}
开发者ID:yegorich,项目名称:cannelloni,代码行数:60,代码来源:udpthread.cpp
示例14: sendBuffer
/**
* addModel() - adds an opulence model to collection
*
* @params *model being added
*/
void BufferCourier::addModel(Model *model)
{
model->id = activeModels.size();
activeModels.push_back(model);
sendBuffer(model);
}
开发者ID:addisonbgross,项目名称:opulence,代码行数:12,代码来源:BufferCourier.cpp
示例15: receiveBuffer
Socket::Error Socket::bufferSize(unsigned bufsize)
{
Error err = receiveBuffer(bufsize);
if(err == errSuccess)
err = sendBuffer(bufsize);
return err;
}
开发者ID:oudream,项目名称:ucommon,代码行数:8,代码来源:socket.cpp
示例16: sendFullMessage
void sendFullMessage(sf::TcpSocket * socket)
{
Buffer toSend;
toSend.pointer = (unsigned char *) "CALCULIB2_SERVER_FULL";
toSend.size = 21;
sendBuffer(socket, &toSend);
logger.printLog("Full: Refused a Client !");
}
开发者ID:nessotrin,项目名称:Calculib2_server,代码行数:8,代码来源:main.cpp
示例17: sendBuffer
Socket::SendStatus Socket::sendToServer(BinaryQueue &queue) {
m_sendQueue.appendMoveFrom(queue);
SendStatus status = sendBuffer();
if (status != SendStatus::ALL_DATA_SENT)
return status;
if (m_sendQueue.size() > m_sendBuffer.size())
m_sendBuffer.resize(m_sendQueue.size());
m_sendBufferEnd = m_sendQueue.size();
m_sendBufferPos = 0;
m_sendQueue.flattenConsume(m_sendBuffer.data(), m_sendQueue.size());
return sendBuffer();
}
开发者ID:fredcadete,项目名称:cynara,代码行数:17,代码来源:Socket.cpp
示例18: while
void MacBase::onSend(NetEventDescriptor& ned) {
// must be an ethernet send request
if(ned.eventType!=NetEventDescriptor::NetEventType::ETHERNET_TRANSMIT_REQUEST)
return;
EthernetTransmitRequestEvent& event=static_cast<EthernetTransmitRequestEvent&>(ned);
EthernetFrameData *efd;
// we cannot transmit data out of flash memory because the flash banks are
// not connected to the Ethernet DMA bus on the STM32. More's the pity.
uint32_t ub=reinterpret_cast<uint32_t>(event.networkBuffer->getUserBuffer());
if(ub && IS_FLASH_ADDRESS(ub)) {
delete event.networkBuffer;
this->setError(ErrorProvider::ERROR_PROVIDER_NET_MAC,E_NO_FLASH_DATA);
return;
}
// the NetBuffer needs to get an ethernet header
efd=reinterpret_cast<EthernetFrameData *>(event.networkBuffer->moveWritePointerBack(getDatalinkTransmitHeaderSize()));
efd->eth_destinationAddress=event.macAddress;
efd->eth_sourceAddress=_params.mac_address;
efd->eth_etherType=NetUtil::htons(static_cast<uint16_t>(event.etherType));
uint32_t now=MillisecondTimer::millis();
while(!sendBuffer(event.networkBuffer)) {
if(errorProvider.isLastError(ErrorProvider::ERROR_PROVIDER_NET_MAC,E_BUSY)) {
// DMA still has our TX descriptor. If we're not running in an IRQ context then we
// can wait to see if it frees up
if(Nvic::isAnyIrqActive()) {
delete event.networkBuffer;
return;
}
if(MillisecondTimer::hasTimedOut(now,_params.mac_txWaitMillis)) {
delete event.networkBuffer;
return;
}
}
else {
delete event.networkBuffer;
return; // other error
}
}
// it was sent and the net buffer will be deleted when the TX interrupt is processed
event.succeeded=true;
}
开发者ID:ADTL,项目名称:stm32plus,代码行数:58,代码来源:MacBase.cpp
示例19: switch
void P2PThread::OnMessage(talk_base::Message *msg)
{
switch (msg->message_id) {
case MSG_CONNECT_TO_PEER:
{
talk_base::TypedMessageData<int> *msgData =
static_cast< talk_base::TypedMessageData<int> *>(msg->pdata);
int peer_id = msgData->data();
conductor_->ConnectToPeer(peer_id);
}
break;
case MSG_SEND_STRING:
{
talk_base::TypedMessageData<std::string> *msgData =
static_cast< talk_base::TypedMessageData<std::string> *>(msg->pdata);
std::string data = msgData->data();
StreamProcess * stream = conductor_->GetStreamProcess();
//stream->WriteData(data.c_str(),data.length());
}
break;
case MSG_WRITE_BUFFER:
{
talk_base::scoped_ptr<talk_base::TypedMessageData<talk_base::Buffer> >msgData (
static_cast< talk_base::TypedMessageData<talk_base::Buffer> *>(msg->pdata));
StreamProcess * stream = conductor_->GetStreamProcess();
//stream->WriteBuffer(msgData->data());
}
break;
case MSG_SEND_TO_PEER:
{
talk_base::scoped_ptr<talk_base::TypedMessageData<std::string> >msgData (
static_cast< talk_base::TypedMessageData<std::string> *>(msg->pdata));
conductor_->UIThreadCallback(ServerConductor::SEND_MESSAGE_TO_PEER,&msgData->data());
break;
}
case MSG_SEND_STREAM:
{
talk_base::TypedMessageData<int> *msgData =
static_cast< talk_base::TypedMessageData<int> *>(msg->pdata);
int buffer_len = msgData->data();
char * buffer = new char[buffer_len];
for(int i=0;i<buffer_len;i++){
buffer[i] = static_cast<char>(rand());
}
talk_base::Buffer sendBuffer(buffer,buffer_len);
StreamProcess * stream = conductor_->GetStreamProcess();
// stream->WriteBuffer(sendBuffer);
this->PostDelayed(10,this,MSG_SEND_STREAM,msgData);
}
break;
default:
break;
}
}
开发者ID:JasonOldWoo,项目名称:webrtc-qt,代码行数:58,代码来源:p2pthread.cpp
示例20: sendBuffer
void HandlerTask::finish()
{
sendBuffer(true);
if (m_headerClosed) { // HTTP header is not closed when error is reported
// thus no need to send the zero chunk to close content
m_parent->socket().send("0\r\n\r\n", 5);
}
}
开发者ID:michael-popov,项目名称:clockworkdb,代码行数:9,代码来源:handler.cpp
注:本文中的sendBuffer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论