Send DRB PDUs as JSON to TTCN3

master
Daniel Willmann 5 years ago committed by Andre Puschmann
parent 31f1516d74
commit 0b88161b3c

@ -27,6 +27,7 @@
#include "srslte/mac/pdu.h"
#include "ttcn3_interfaces.h"
#include "ttcn3_port_handler.h"
#include <srslte/asn1/asn1_utils.h>
#include <srslte/interfaces/ue_interfaces.h>
using namespace srslte;
@ -49,11 +50,12 @@ public:
return port_listen();
}
void tx(unique_byte_buffer_t pdu)
void tx(std::string out)
{
if (initialized) {
log->info_hex(pdu->msg, pdu->N_bytes, "Sending %d B to Titan\n", pdu->N_bytes);
send(pdu->msg, pdu->N_bytes);
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());
} else {
log->error("Trying to transmit but port not connected.\n");
}

@ -1023,6 +1023,8 @@ void ttcn3_syssim::write_pdu(uint32_t lcid, unique_byte_buffer_t pdu)
cells[pcell_idx]->cell.id,
pdu->N_bytes);
// push content to Titan
if (lcid <= 2) {
// check cell ID
if (cells[pcell_idx]->cell.id > 256) {
log->error("Cell ID too large to fit in single byte.\n");
@ -1039,11 +1041,11 @@ void ttcn3_syssim::write_pdu(uint32_t lcid, unique_byte_buffer_t pdu)
*pdu->msg = static_cast<uint8_t>(cells[pcell_idx]->cell.id);
pdu->N_bytes++;
// push content to Titan
if (lcid <= 2) {
srb.tx(std::move(pdu));
} else {
drb.tx(std::move(pdu));
std::string out = ttcn3_helpers::get_drb_common_ind_for_pdu(lcid, cells[pcell_idx]->name, std::move(pdu));
log->error("DRB send:\n%s", out.c_str());
drb.tx(out);
}
}

Loading…
Cancel
Save