static void ExchangeVersions() { SendVersion(); if (dwRC != USBIO_ERR_SUCCESS) return; ReceiveVersion(); }
void CLuaRemoteDebug::ReceiveVersion(CSerializationHelper &buffer) { buffer.Read(m_clientVersion); if (m_clientVersion != LUA_REMOTE_DEBUG_HOST_VERSION) { CryLogAlways("Warning: Lua remote debug client connected with version %d, host is version %d", m_clientVersion, LUA_REMOTE_DEBUG_HOST_VERSION); } else { CryLog("Lua remote debug client connected with version: %d, host is version: %d", m_clientVersion, LUA_REMOTE_DEBUG_HOST_VERSION); } SendVersion(); SendGameFolder(); // Make sure the debugger is enabled when the remote debugger connects ICVar* pCvar = gEnv->pConsole->GetCVar("lua_debugger"); if (pCvar) { pCvar->Set(1); } // Send Lua state to newly connected debugger if (m_bExecutionStopped && m_pHaltedLuaDebug) { SendLuaState(m_pHaltedLuaDebug); SendVariables(); } if (m_bBinaryLuaDetected) { SendBinaryFileDetected(); } }
void NetConnection::Start() { if (m_bFirstPacket) { m_bFirstPacket = false; SendCryptKey(); SendVersion(); } // 必须保证回调函数执行完之前,m_readBuff是有效的 boost::asio::async_read(m_socket, boost::asio::buffer(m_readBuff), boost::asio::transfer_at_least(10), boost::bind(&NetConnection::AsyncReadHandler, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); }
// This function sends data that has been requested. void SendPendingMKSerial(void) { // Handle only one request at a time. if (tx_request_) { // A one-time request has higher priority than a periodic "stream" of data. if (tx_request_ & MK_TX_VERSION) SendVersion(); } else if (mk_stream_ && TimestampInPast(stream_timer_)) { // A data stream is active and it is time for another transmission. switch (mk_stream_) { case MK_STREAM_CONTROL: SendControlData(); break; case MK_STREAM_KALMAN: SendKalmanData(); break; case MK_STREAM_MOTOR_SETPOINTS: SendMotorSetpoints(); break; case MK_STREAM_SENSORS: SendSensorData(); break; default: break; } stream_timer_ += stream_period_; // Prevent timer rollover for small periods. if (TimestampInPast(stream_timer_)) stream_timer_ = GetTimestamp(); // Disable the stream if no request has been renewing received in a while. if (TimestampInPast(stream_timeout_)) mk_stream_ = MK_STREAM_NONE; } }