X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Fcommon_def.c;h=0e681d3e03181486136fc55f6805dceb128fa31b;hb=834004e09017b5b86cb738be98a7a1be79c0a9b0;hp=867a9c4061ecfdff6367c64144285f500ae88840;hpb=7c6820e987fadb1102e5891408ad33a8ce36ba95;p=o-du%2Fl2.git diff --git a/src/cm/common_def.c b/src/cm/common_def.c index 867a9c406..0e681d3e0 100644 --- a/src/cm/common_def.c +++ b/src/cm/common_def.c @@ -107,6 +107,40 @@ void oduCpyFixBufToMsg(uint8_t *fixBuf, Buffer *mBuf, uint16_t len) ODU_COPY_FIX_BUF_TO_MSG(fixBuf, mBuf, 0, len, (MsgLen *)©Len); } +/******************************************************************* + * + * @brief Builds PLMN ID + * + * @details + * + * Function : plmnBuildId + * + * Functionality: Building the PLMN ID + * + * @params[in] PLMNID plmn + * @params[out] PLMNID in string format + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t buildPlmnId(Plmn plmn, uint8_t *buf) +{ + uint8_t mncCnt; + mncCnt = 2; + buf[0] = ((plmn.mcc[1] << 4) | (plmn.mcc[0])); + if(mncCnt == 2) + { + buf[1] = ((0xf0) | (plmn.mcc[2])); + buf[2] = ((plmn.mnc[1] << 4) | (plmn.mnc[0])); + } + else + { + buf[1] = ((plmn.mnc[0] << 4) | (plmn.mcc[2])); + buf[2] = ((plmn.mnc[2] << 4) | (plmn.mnc[1])); + } + return ROK; +} + /********************************************************************** End of file