ttcn3: streamline DRB and SRB Tx interface

use the same tx interface with const uint8_t* and length byte instead of std::string
This commit is contained in:
Andre Puschmann 2020-06-29 09:29:13 +02:00
parent 7a25d1d300
commit 63f1ea1bec
2 changed files with 4 additions and 7 deletions

View File

@ -49,12 +49,11 @@ public:
return port_listen();
}
void tx(std::string out)
void tx(const uint8_t* buffer, uint32_t len)
{
if (initialized) {
log->info_hex(
reinterpret_cast<const uint8_t*>(out.c_str()), out.length(), "Sending %ld B to Titan\n", out.length());
send(reinterpret_cast<const uint8_t*>(out.c_str()), out.length());
log->info_hex(buffer, len, "Sending %d B to Titan\n", len);
send(buffer, len);
} else {
log->error("Trying to transmit but port not connected.\n");
}

View File

@ -1026,11 +1026,9 @@ void ttcn3_syssim::write_pdu(uint32_t lcid, unique_byte_buffer_t pdu)
// push content to Titan
if (lcid <= 2) {
std::string out = ttcn3_helpers::get_rrc_pdu_ind_for_pdu(tti, lcid, cells[pcell_idx]->name, std::move(pdu));
srb.tx(out);
srb.tx(reinterpret_cast<const uint8_t*>(out.c_str()), out.length());
} else {
std::string out = ttcn3_helpers::get_drb_common_ind_for_pdu(tti, lcid, cells[pcell_idx]->name, std::move(pdu));
log->error("DRB send:\n%s", out.c_str());
drb.tx(reinterpret_cast<const uint8_t*>(out.c_str()), out.length());
}
}