X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=control%2FrcE2SmRc.go;h=2f9a9d4f53e1e48db704f07f914df2ef995d6ffd;hb=c05b223e6e1d8d90acbe8db414eb0e1ccf330b45;hp=e2a8498ef35cf9b654d292c7b22a23263f5ba25b;hpb=960885a60feb1ef3f9f654c7f4caf73f7a25dc4a;p=ric-app%2Frc.git diff --git a/control/rcE2SmRc.go b/control/rcE2SmRc.go index e2a8498..2f9a9d4 100644 --- a/control/rcE2SmRc.go +++ b/control/rcE2SmRc.go @@ -15,7 +15,8 @@ import ( _"encoding/binary" "encoding/hex" "strings" - "strconv" + //"strconv" + "fmt" ) type E2sm struct { @@ -28,6 +29,7 @@ func (c *E2sm) SetRicControlHeader(buffer []byte, ueIdData *UEid, ricControlStyl //cptr_ueIDbuf := unsafe.Pointer(&ueIDbuf[0]) lplmnIdBuf := strings.Join(strings.Fields(ueIdData.pLMNIdentitybuf), "") + /* lIntvar, _ := strconv.Atoi(lplmnIdBuf) xapp.Logger.Info("lIntvar = %d\n", lIntvar) @@ -35,6 +37,13 @@ func (c *E2sm) SetRicControlHeader(buffer []byte, ueIdData *UEid, ricControlStyl //ml.MavLog(ml.INFO, lTransId, " lIntegerByte = %v\n", lIntegerByte) xapp.Logger.Info(" lIntegerByte = %v\n", lIntegerByte) lOutByte := get_bytepack_plmnId(lIntegerByte) + */ + lOutByte, err := hex.DecodeString(lplmnIdBuf) + if err != nil { + panic(err) + } + fmt.Println(lOutByte) + fmt.Printf("% x", lOutByte) xapp.Logger.Info("lOutByte Len:%d\n", len(lOutByte)) xapp.Logger.Info("lOutByte = %02X\n", lOutByte) cptrRanParameterValue := unsafe.Pointer(&lOutByte[0]) @@ -80,12 +89,23 @@ func (c *E2sm) SetRicControlHeader(buffer []byte, ueIdData *UEid, ricControlStyl return } -func (c *E2sm) SetRicControlMessage(buffer []byte, targetPrimaryCell int64, targetCell int64, nrCGIOrECGI int64, nrOrEUtraCell int64, ranParameterValue []byte) (newBuffer []byte, err error) { +func (c *E2sm) SetRicControlMessage(buffer []byte, targetPrimaryCell int64, targetCell int64, nrCGIOrECGI int64, nrOrEUtraCell int64, pLMNIdentitybuf string,NRcellIdbuf []byte) (newBuffer []byte, err error) { xapp.Logger.Info("SetRicControlMessagei Enter ") + //lOutByte, err := hex.DecodeString(string(ranParameterValue)) + lplmnIdBuf := strings.Join(strings.Fields(pLMNIdentitybuf), "") + //lOutByte, err := hex.DecodeString(lplmnIdBuf) + //if err != nil { + // return + //} + NRCGI:="00"+lplmnIdBuf+string(NRcellIdbuf) + lOutByte, _ := hex.DecodeString(NRCGI) + //tmp_plmn:=[]byte(lplmnIdBuf) + cptrRanParameterValue := unsafe.Pointer(&lOutByte[0]) + cptr := unsafe.Pointer(&buffer[0]) - cptrRanParameterValue := unsafe.Pointer(&ranParameterValue[0]) + //cptrRanParameterValue2 := unsafe.Pointer(&NRcellIdbuf[0]) /* lIntvar, _ := strconv.Atoi(string(ranParameterValue)) @@ -100,7 +120,7 @@ func (c *E2sm) SetRicControlMessage(buffer []byte, targetPrimaryCell int64, targ */ size := C.e2sm_encode_ric_control_message(cptr, C.size_t(len(buffer)), C.long(targetPrimaryCell), - C.long(targetCell), C.long(nrOrEUtraCell), C.long(nrCGIOrECGI), cptrRanParameterValue, C.size_t(len(ranParameterValue))) + C.long(targetCell), C.long(nrOrEUtraCell), C.long(nrCGIOrECGI), cptrRanParameterValue,C.size_t(len(lOutByte))) if size < 0 { return make([]byte, 0), errors.New("e2sm wrapper is unable to set RicControlMessage due to wrong or invalid input") @@ -117,10 +137,10 @@ func (c *E2sm) GetControlOutcome(buffer []byte) (controlOutcome *ControlOutcomeM //ml.MavLog(ml.INFO, lTransId, "Decode Control Outcome: ") xapp.Logger.Info("Decode Control Outcome: ") decodedMsg := C.e2sm_decode_ric_call_process_outcome(cptr, C.size_t(len(buffer))) + defer C.e2sm_free_ric_call_process_outcome(decodedMsg) if decodedMsg == nil { return controlOutcome, errors.New("e2sm wrapper is unable to get ControlOutcome due to wrong or invalid input") } - defer C.e2sm_free_ric_call_process_outcome(decodedMsg) //ml.MavLog(ml.INFO, lTransId, "Decoded Control Outcome: ") controlOutcome.ControlOutcomeType = int32(decodedMsg.ric_controlOutcome_formats.present) if controlOutcome.ControlOutcomeType == 1 {