void SpectrumWarsRxController::notifyDisplay() { std::vector<uint8_t> buffer; Packet p; p.set_type(Packet_Type_RECONFIG); p.set_teamid(id_x); p.set_frequency(currentFreq_); p.set_rate(currentRate_); p.set_gain(currentGain_); buffer.resize(p.ByteSize()); p.SerializeWithCachedSizesToArray(&buffer.front()); tx_->write(buffer.begin(), buffer.end()); }
void SpectrumWarsRxController::processHaveData() { std::vector<uint8_t> buffer; if(++counter_ >= triggerNum_x) { Packet p; p.set_type(Packet_Type_COUNT); p.set_teamid(id_x); p.set_count(counter_); buffer.resize(p.ByteSize()); p.SerializeWithCachedSizesToArray(&buffer.front()); tx_->write(buffer.begin(), buffer.end()); counter_ = 0; } }