Commit a1d90127 authored by Navid Nikaein's avatar Navid Nikaein
Browse files

Check if the file is openned first

parent 40141270
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "NR_UE-CapabilityRAT-ContainerList.h" #include "NR_UE-CapabilityRAT-ContainerList.h"
#include "LTE_UE-CapabilityRAT-ContainerList.h" #include "LTE_UE-CapabilityRAT-ContainerList.h"
#include "NR_CG-Config.h" #include "NR_CG-Config.h"
#include "executables/softmodem-common.h"
int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m) { int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m) {
if (CG_ConfigInfo->criticalExtensions.present == NR_CG_ConfigInfo__criticalExtensions_PR_c1) { if (CG_ConfigInfo->criticalExtensions.present == NR_CG_ConfigInfo__criticalExtensions_PR_c1) {
...@@ -95,33 +96,48 @@ int generate_CG_Config(gNB_RRC_INST *rrc, ...@@ -95,33 +96,48 @@ int generate_CG_Config(gNB_RRC_INST *rrc,
(const char *)buffer, (const char *)buffer,
(enc_rval.encoded+7)>>3); (enc_rval.encoded+7)>>3);
total_size = (enc_rval.encoded+7)>>3; total_size = (enc_rval.encoded+7)>>3;
LOG_I(RRC,"Dumping NR_RRCReconfiguration message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
for (int i=0; i<(enc_rval.encoded+7)>>3; i++) { FILE *fd; // file to be generated for nr-ue
printf("%02x",((uint8_t *)buffer)[i]); if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0) {
// This is for phytest only, emulate first X2 message if uecap.raw file is present
LOG_I(RRC,"Dumping NR_RRCReconfiguration message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
for (int i=0; i<(enc_rval.encoded+7)>>3; i++) {
printf("%02x",((uint8_t *)buffer)[i]);
}
printf("\n");
fd = fopen("reconfig.raw","w");
if (fd != NULL) {
fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
}
fclose(fd);
} }
printf("\n");
FILE *fd = fopen("reconfig.raw","w");
fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
fclose(fd);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig, NULL, (void *)rbconfig, buffer, 1024); enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig, NULL, (void *)rbconfig, buffer, 1024);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config = calloc(1,sizeof(OCTET_STRING_t)); cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config = calloc(1,sizeof(OCTET_STRING_t));
OCTET_STRING_fromBuf(cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config, OCTET_STRING_fromBuf(cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config,
(const char *)buffer, (const char *)buffer,
(enc_rval.encoded+7)>>3); (enc_rval.encoded+7)>>3);
LOG_I(RRC,"Dumping scg_RB_Config message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
for (int i=0; i<(enc_rval.encoded+7)>>3; i++) {
printf("%02x",((uint8_t *)buffer)[i]);
}
printf("\n");
fd = fopen("rbconfig.raw","w"); if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0) {
fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
fclose(fd); LOG_I(RRC,"Dumping scg_RB_Config message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
for (int i=0; i<(enc_rval.encoded+7)>>3; i++) {
printf("%02x",((uint8_t *)buffer)[i]);
}
printf("\n");
fd = fopen("rbconfig.raw","w");
if (fd != NULL) {
fwrite((void *)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
}
fclose(fd);
}
total_size = total_size + ((enc_rval.encoded+7)>>3); total_size = total_size + ((enc_rval.encoded+7)>>3);
return(total_size); return(total_size);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment