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


C++ qToBigEndian函数代码示例

本文整理汇总了C++中qToBigEndian函数的典型用法代码示例。如果您正苦于以下问题:C++ qToBigEndian函数的具体用法?C++ qToBigEndian怎么用?C++ qToBigEndian使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qToBigEndian函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LOG

/**
 * SendResendRequest:
 * Request RAOP client to resend missed RTP packets
 */
void MythRAOPConnection::SendResendRequest(uint64_t timestamp,
                                           uint16_t expected, uint16_t got)
{
    if (!m_clientControlSocket)
        return;

    int16_t missed = (got < expected) ?
                (int16_t)(((int32_t)got + UINT16_MAX + 1) - expected) :
                got - expected;

    LOG(VB_GENERAL, LOG_INFO, LOC +
        QString("Missed %1 packet(s): expected %2 got %3 ts:%4")
        .arg(missed).arg(expected).arg(got).arg(timestamp));

    char req[8];
    req[0] = 0x80;
    req[1] = RANGE_RESEND | 0x80;
    *(uint16_t *)(req + 2) = qToBigEndian(m_seqNum++);
    *(uint16_t *)(req + 4) = qToBigEndian(expected);   // missed seqnum
    *(uint16_t *)(req + 6) = qToBigEndian(missed);     // count

    if (m_clientControlSocket->writeDatagram(req, sizeof(req),
                                             m_peerAddress, m_clientControlPort)
        == sizeof(req))
    {
        for (uint16_t count = 0; count < missed; count++)
        {
            LOG(VB_GENERAL, LOG_INFO, LOC + QString("Sent resend for %1")
                .arg(expected + count));
            m_resends.insert(expected + count, timestamp);
        }
    }
    else
        LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to send resend request.");
}
开发者ID:stunami,项目名称:mythtv,代码行数:39,代码来源:mythraopconnection.cpp

示例2: writeHeader

void RpcConnection::writeHeader(char* header, quint16 type, quint16 method, 
                                quint32 length)
{
    *((quint16*)(header+0)) = qToBigEndian(type);
    *((quint16*)(header+2)) = qToBigEndian(method);
    *((quint32*)(header+4)) = qToBigEndian(length);
}
开发者ID:anju61188,项目名称:ostinato,代码行数:7,代码来源:rpcconn.cpp

示例3: gettimeofday

/**
 * SendTimeRequest:
 * Send a time request to the RAOP client.
 */
void MythRAOPConnection::SendTimeRequest(void)
{
    if (!m_clientControlSocket) // should never happen
        return;

    timeval t;
    gettimeofday(&t, NULL);

    char req[32];
    req[0] = 0x80;
    req[1] = TIMING_REQUEST | 0x80;
    // this is always 0x00 0x07 according to http://blog.technologeek.org/airtunes-v2
    // no other value works
    req[2] = 0x00;
    req[3] = 0x07;
    *(uint32_t *)(req + 4)  = (uint32_t)0;
    *(uint64_t *)(req + 8)  = (uint64_t)0;
    *(uint64_t *)(req + 16) = (uint64_t)0;
    *(uint32_t *)(req + 24) = qToBigEndian((uint32_t)t.tv_sec);
    *(uint32_t *)(req + 28) = qToBigEndian((uint32_t)t.tv_usec);

    if (m_clientTimingSocket->writeDatagram(req, sizeof(req), m_peerAddress, m_clientTimingPort) != sizeof(req))
    {
        LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to send resend time request.");
        return;
    }
    LOG(VB_GENERAL, LOG_DEBUG, LOC +
        QString("Requesting master time (Local %1.%2)")
        .arg(t.tv_sec).arg(t.tv_usec));
}
开发者ID:stunami,项目名称:mythtv,代码行数:34,代码来源:mythraopconnection.cpp

示例4: qWarning

QByteArray SettingsFrame::dump(StreamContext& context) const
{
    if (context.identifier != 0) {
        qWarning() << "SETTINGS Frame identifier must be 0";
    }

    QByteArray payload;

    if (!ack_) {
        payload.resize(settings_.size() * 8);
        uchar* payloadPtr = reinterpret_cast<uchar*>(payload.data());

        for(SettingsType key: settings_.keys()) {
            quint32 value = settings_[key];
            qToBigEndian(static_cast<quint32>(key), payloadPtr);
            payloadPtr += sizeof(quint32);
            qToBigEndian(value, payloadPtr);
            payloadPtr += sizeof(quint32);
        }
    }

    uchar flags = 0;
    if (ack_) flags |= SETTINGS_FLAG_ACK;

    BasicFrame frame;
    frame.setType(FRAME_SETTINGS);
    frame.setFlags(flags);
    frame.setPayload(payload);
    frame.setIdentifier(0);
    return frame.dump();
}
开发者ID:h2so5,项目名称:http2-qt,代码行数:31,代码来源:settingsframe.cpp

示例5: pos

void CryptFileDevice::initCtr(CtrState *state, const unsigned char *iv)
{
    qint64 position = pos();

    state->num = position % AES_BLOCK_SIZE;

    memset(state->ecount, 0, 16);

    /* Initialise counter in 'ivec' */
    qint64 count = position / AES_BLOCK_SIZE;
    if (state->num > 0)
        count++;

    qint64 newCount = count;
    if (newCount > 0)
        newCount = qToBigEndian(count);

    memcpy(state->ivec + 8, &newCount, 8);

    /* Copy IV into 'ivec' */
    memcpy(state->ivec, iv, 8);

    if (count > 0)
    {
        count = qToBigEndian(count - 1);
        unsigned char * prevIvec = new unsigned char[16];
        memcpy(prevIvec, state->ivec, 8);

        memcpy(prevIvec + 8, &count, 8);

        AES_encrypt(prevIvec, state->ecount, &m_aesKey);
    }
}
开发者ID:Vardan07,项目名称:CryptFileDevice,代码行数:33,代码来源:cryptfiledevice.cpp

示例6: qToBigEndian

int MovePointer::serializePayload(uchar *data) const
{
	uchar *ptr = data;
	qToBigEndian(m_x, ptr); ptr += 4;
	qToBigEndian(m_y, ptr); ptr += 4;

	return ptr-data;
}
开发者ID:tokyogeometry,项目名称:Drawpile,代码行数:8,代码来源:meta2.cpp

示例7: foreach

int PenMove::serializePayload(uchar *data) const
{
	uchar *ptr = data;
	*(ptr++) = contextId();
	foreach(const PenPoint &p, _points) {
		qToBigEndian(p.x, ptr); ptr += 4;
		qToBigEndian(p.y, ptr); ptr += 4;
		qToBigEndian(p.p, ptr); ptr += 2;
	}
开发者ID:EvilKitty3,项目名称:Drawpile,代码行数:9,代码来源:pen.cpp

示例8: foreach

int PenMove::serializePayload(uchar *data) const
{
	uchar *ptr = data;
	*(ptr++) = _ctx;
	foreach(const PenPoint &p, _points) {
		qToBigEndian(p.x, ptr); ptr += 2;
		qToBigEndian(p.y, ptr); ptr += 2;
		*(ptr++) = p.p;
	}
开发者ID:hexaditidom,项目名称:Drawpile,代码行数:9,代码来源:pen.cpp

示例9: QColor

void LedGridControllerUT::setPixel()
{
    MyMock::expectOneCallAndReturnInt(QString("open_fbdev"), 1);
    LedGridController *controller = LedGridController::getInstance();
    controller->setPixel(0,0, QColor(0x80,0x0,0xFF));
    QCOMPARE(controller->frameBuffer[0], qToBigEndian((quint16)0x781F));
    controller->setPixel(3,4, QColor(0xFF,0xFF,0xFF));
    QCOMPARE(controller->frameBuffer[(4*8)+3], qToBigEndian((quint16)0xFFFF));
}
开发者ID:fantas0s,项目名称:qt-sense-hat,代码行数:9,代码来源:ledgridcontrollerut.cpp

示例10: qToBigEndian

int CanvasResize::serializePayload(uchar *data) const
{
	uchar *ptr = data;
	*(ptr++) = contextId();
	qToBigEndian(_top, ptr); ptr += 2;
	qToBigEndian(_right, ptr); ptr += 2;
	qToBigEndian(_bottom, ptr); ptr += 2;
	qToBigEndian(_left, ptr); ptr += 2;
	return ptr - data;
}
开发者ID:Acru,项目名称:Drawpile,代码行数:10,代码来源:layer.cpp

示例11: qToBigEndian

int MovePointer::serializePayload(uchar *data) const
{
	uchar *ptr = data;
	*(ptr++) = contextId();
	qToBigEndian(_x, ptr); ptr += 4;
	qToBigEndian(_y, ptr); ptr += 4;
	*(ptr++) = _persistence;

	return ptr-data;
}
开发者ID:GreenReaper,项目名称:Drawpile,代码行数:10,代码来源:meta.cpp

示例12: qToBigEndian

int PenMove::serializePayload(uchar *data) const
{
	uchar *ptr = data;
	for(const PenPoint &p : _points) {
		qToBigEndian(p.x, ptr); ptr += 4;
		qToBigEndian(p.y, ptr); ptr += 4;
		qToBigEndian(p.p, ptr); ptr += 2;
	}
	return ptr - data;
}
开发者ID:Rambo2015,项目名称:Drawpile,代码行数:10,代码来源:pen.cpp

示例13: qToBigEndian

int AnnotationReshape::serializePayload(uchar *data) const
{
	uchar *ptr = data;
	*(ptr++) = contextId();
	*(ptr++) = _id;
	qToBigEndian(_x, ptr); ptr += 4;
	qToBigEndian(_y, ptr); ptr += 4;
	qToBigEndian(_w, ptr); ptr += 2;
	qToBigEndian(_h, ptr); ptr += 2;
	return ptr - data;
}
开发者ID:GreenReaper,项目名称:Drawpile,代码行数:11,代码来源:annotation.cpp

示例14: qToBigEndian

void ClientSocket::sendDeleteKeyCommand(const QString &trackName, int row)
{
	if (!connected() ||
	    clientTracks.count(trackName) == 0)
		return;

	quint32 track = qToBigEndian((quint32)clientTracks[trackName]);
	row = qToBigEndian((quint32)row);

	unsigned char cmd = DELETE_KEY;
	send((char *)&cmd, 1, false);
	send((char *)&track, sizeof(int), false);
	send((char *)&row,   sizeof(int), true);
}
开发者ID:yonglehou,项目名称:rocket-1,代码行数:14,代码来源:clientsocket.cpp

示例15: qLog

TinySVCMDNS::TinySVCMDNS() {
  // Get all network interfaces
  QList<QNetworkInterface> network_interfaces =
      QNetworkInterface::allInterfaces();
  for (QNetworkInterface network_interface : network_interfaces) {
    // Only use up and non loopback interfaces
    if (network_interface.flags().testFlag(network_interface.IsUp) &&
        !network_interface.flags().testFlag(network_interface.IsLoopBack)) {
      uint32_t ipv4 = 0;
      QString ipv6;

      qLog(Debug) << "Interface" << network_interface.humanReadableName();

      // Now check all network addresses for this device
      QList<QNetworkAddressEntry> network_address_entries =
          network_interface.addressEntries();

      for (QNetworkAddressEntry network_address_entry :
           network_address_entries) {
        QHostAddress host_address = network_address_entry.ip();
        if (host_address.protocol() == QAbstractSocket::IPv4Protocol) {
          ipv4 = qToBigEndian(host_address.toIPv4Address());
          qLog(Debug) << "  ipv4:" << host_address.toString();
        } else if (host_address.protocol() == QAbstractSocket::IPv6Protocol) {
          ipv6 = host_address.toString();
          qLog(Debug) << "  ipv6:" << host_address.toString();
        }
      }

      // Now start the service
      CreateMdnsd(ipv4, ipv6);
    }
  }
}
开发者ID:Aceler,项目名称:Clementine,代码行数:34,代码来源:tinysvcmdns.cpp


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