21 #include "spdlog/spdlog.h"
22 #include "srslte/asn1/rrc_asn1_utils.h"
24 using asn1::rrc::mcch_msg_type_c;
25 using asn1::rrc::bcch_dl_sch_msg_mbms_s;
26 using asn1::rrc::bcch_dl_sch_msg_type_mbms_r14_c;
27 using asn1::rrc::sib_type1_mbms_r14_s;
28 using asn1::rrc::sib_type_mbms_r14_e;
29 using asn1::rrc::sched_info_mbms_r14_s;
32 spdlog::trace(
"rrc: write_pdu_mch");
33 if (pdu->N_bytes <= 0 || pdu->N_bytes >= SRSLTE_MAX_BUFFER_SIZE_BITS) {
36 asn1::cbit_ref bref(pdu->msg, pdu->N_bytes);
37 asn1::rrc::mcch_msg_s msg;
38 if (msg.unpack(bref) != asn1::SRSASN_SUCCESS ||
39 msg.msg.type().value != mcch_msg_type_c::types_opts::c1) {
40 spdlog::error(
"Failed to unpack MCCH message");
43 asn1::json_writer json_writer;
44 msg.to_json(json_writer);
45 spdlog::debug(
"BCCH-DLSCH message content:\n{}", json_writer.to_string());
47 srslte::mcch_msg_t mcch = srslte::make_mcch_msg(msg);
50 for (uint32_t i = 0; i < mcch.nof_pmch_info; i++) {
51 for (uint32_t j = 0; j < mcch.pmch_info_list[i].nof_mbms_session_info; j++) {
52 uint32_t lcid = mcch.pmch_info_list[i].mbms_session_info_list[j].lc_ch_id;
53 if (!_rlc.has_bearer_mrb(lcid)) {
54 _rlc.add_bearer_mrb(lcid);
68 bcch_dl_sch_msg_mbms_s dlsch_msg;
69 asn1::cbit_ref dlsch_bref(pdu->msg, pdu->N_bytes);
70 asn1::SRSASN_CODE err = dlsch_msg.unpack(dlsch_bref);
72 if (err != asn1::SRSASN_SUCCESS || dlsch_msg.msg.type().value != bcch_dl_sch_msg_type_mbms_r14_c::types_opts::c1) {
73 spdlog::error(
"Could not unpack BCCH DL-SCH message ({} B).", pdu->N_bytes);
77 asn1::json_writer json_writer;
78 dlsch_msg.to_json(json_writer);
79 spdlog::debug(
"BCCH-DLSCH message content:\n{}", json_writer.to_string());
81 if (dlsch_msg.msg.c1().type() == bcch_dl_sch_msg_type_mbms_r14_c::c1_c_::types::sib_type1_mbms_r14) {
82 spdlog::debug(
"Processing SIB1-MBMS (1/1)");
83 handle_sib1(dlsch_msg.msg.c1().sib_type1_mbms_r14());
87 void Rrc::handle_sib1(
const sib_type1_mbms_r14_s& sib1) {
88 spdlog::debug(
"SIB1-MBMS received, si_window={}",
89 sib1.si_win_len_r14.to_number());
92 for (
auto& i : sib1.sched_info_list_mbms_r14) {
93 sched_info_mbms_r14_s::si_periodicity_r14_e_ p = i.si_periodicity_r14;
94 for (
auto t : i.sib_map_info_r14) {
95 spdlog::info(
"SIB scheduling info, sib_type={}, si_periodicity={}",
96 t.to_number(), p.to_number());
101 if (!_rlc.has_bearer_mrb(0)) {
102 _rlc.add_bearer_mrb(0);
106 _state = ACQUIRE_AREA_CONFIG;