Exemplo n.º 1
0
void LLXmlTreeNode::writeNoChild(std::string &buffer, const std::string &indent) const
{
	if (!mContents.empty()) {
		writeStart(buffer, indent);
		writeEnd(buffer, indent);
	} else {
		buffer += indent + '<' + mName;
		writeAttributes(buffer);
		buffer += "/>\n";
	}
}
Exemplo n.º 2
0
void ROBOT_JOIN(void){
	int started = writeStart(my_sock, my_name);
	if(started == -1){
		puts("Failed to write start");
		int closed = close(my_sock);
		if(closed == -1){
			perror("closed");
		}
		exit(EXIT_FAILURE);
	}
}
Exemplo n.º 3
0
void BooRedisAsync::writeComplete(const boost::system::error_code &error)
{
    if (!error)
    {
        m_writeBuffer.pop_front();
        if (!m_writeBuffer.empty())
            writeStart();
        else
            m_writeInProgress = false;
    }
    else
        onError(error);
}
Exemplo n.º 4
0
//------------------------------------------------------------------------------
bool SdSpiCard::writeBlocks(uint32_t block, const uint8_t* src, size_t count) {
  if (!writeStart(block)) {
    goto fail;
  }
  for (size_t b = 0; b < count; b++, src += 512) {
    if (!writeData(src)) {
      goto fail;
    }
  }
  return writeStop();

 fail:
  spiStop();
  return false;
}
Exemplo n.º 5
0
void BooRedisAsync::connectComplete(const boost::system::error_code& error)
{
    if (!error)
    {
        m_connectTimer->cancel();
        readStart();
        m_onceConnected = true;
        m_connected = true;

        onLogMessage("Successfully connected to Redis " + endpointToString(getEndpointIterator()),LOG_LEVEL_INFO);
        onConnect();

        if (!m_writeInProgress && !m_writeBuffer.empty())
            writeStart();
    }
    else
        onError(error);
}
Exemplo n.º 6
0
Error SMSC95xxUSB::transmit(NetworkQueue::Packet *pkt)
{
    DEBUG("size = " << pkt->size);

    // Check packet size
    if (pkt->size > m_packetSize - TransmitCommandSize)
    {
        ERROR("packet size too large: " << pkt->size);
        return ERANGE;
    }
    // Prepend the physical header to the packet.
    // Note that the Ethernet/IP and/or other headers
    // are already in place inside the packet buffer.

    // Fill command word A
    u32 tx_cmd_a = (pkt->size - TransmitCommandSize) | TxCommandAFirstSeg | TxCommandALastSeg;
    pkt->data[0] = (tx_cmd_a >> 0)  & 0xff;
    pkt->data[1] = (tx_cmd_a >> 8)  & 0xff;
    pkt->data[2] = (tx_cmd_a >> 16) & 0xff;
    pkt->data[3] = (tx_cmd_a >> 24) & 0xff;

    // Fill command word B
    u32 tx_cmd_b = (pkt->size - TransmitCommandSize);
    pkt->data[4] = (tx_cmd_b >> 0)  & 0xff;
    pkt->data[5] = (tx_cmd_b >> 8)  & 0xff;
    pkt->data[6] = (tx_cmd_b >> 16) & 0xff;
    pkt->data[7] = (tx_cmd_b >> 24) & 0xff;

    // Submit packet for transmit
    m_smsc->getTransmitQueue()->push(pkt);

    // begin write, if not already doing
    if (!m_txPacket)
        writeStart();

    // Packet in transmission
    return pkt->size;
}
Exemplo n.º 7
0
void SMSC95xxUSB::writeFinished(FileSystemMessage *message)
{
    DEBUG("identifier = " << message->identifier << " result = " << (int)message->result);

    if (!m_txPacket)
    {
        ERROR("no transmit packet in progress");
        return;
    }

    // Clean transmit packet
    m_smsc->getTransmitQueue()->release(m_txPacket);
    m_txPacket = 0;

    // Release USB transfer
    finishTransfer(message);

    // TODO: this should not be done like this
    // Trigger retry of all FileSystemRequests here.
    // m_server->interruptHandler(0);

    // Continue with the next packet(s)
    writeStart();
}
Exemplo n.º 8
0
void BooRedisAsync::doWrite(const std::string &msg)
{
    m_writeBuffer.push_back(msg);
    if (connected() && !m_writeInProgress)
        writeStart();
}