Commit 2403529e authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

fix issues related to PC5D transmission/reception

parent dd3ed7a5
......@@ -797,9 +797,11 @@ void ue_send_sl_sdu(module_id_t module_idP,
NULL);
} else { //SL_DISCOVERY
LOG_I( MAC, "SL DISCOVERY \n");
//call mac_rrc_data_ind
uint16_t len;
//call mac_rrc_data_ind
uint16_t len = sdu_len;
printf("SL DISCOVERY: ");
for (int i=0;i<len;i++) printf("%x ",((uint8_t*)sdu)[i]);
printf("\n");
mac_rrc_data_ind(module_idP,
CC_id,
frameP,subframeP,
......
......@@ -515,6 +515,7 @@ mac_rrc_data_ind(
//TTN (for D2D)
if(srb_idP == SL_DISCOVERY) {
LOG_I(RRC,"[UE %d] Received SDU (%d bytes) for SL_DISCOVERY on SRB %d from eNB %d\n",module_idP, sdu_lenP, srb_idP,eNB_indexP);
decode_SL_Discovery_Message(&ctxt, eNB_indexP, sduP, sdu_lenP);
}
......
......@@ -5837,7 +5837,9 @@ int decode_SL_Discovery_Message(
int prose_addr_len;
char send_buf[BUFSIZE];
int n;
struct sidelink_ctrl_element *sl_ctrl_msg_recv = NULL;
LOG_I(RRC,"[decode_SL_Discovery_Message] received %d bytes (sizeof(struct sidelink_ctrl_element) %d)\n",Sdu_len, sizeof(struct sidelink_ctrl_element));
//from the main program, listen for the incoming messages from control socket (ProSe App)
prose_addr_len = sizeof(prose_app_addr);
......@@ -5845,18 +5847,21 @@ int decode_SL_Discovery_Message(
memcpy((void*)&UE_rrc_inst[ctxt_pP->module_id].SL_Discovery[0].Rx_buffer.Payload[0], (void*)Sdu, Sdu_len);
UE_rrc_inst[ctxt_pP->module_id].SL_Discovery[0].Rx_buffer.payload_size = Sdu_len;
sl_ctrl_msg_recv = calloc(1, sizeof(struct sidelink_ctrl_element));
memcpy((void *)sl_ctrl_msg_recv, (void *)Sdu, sizeof(struct sidelink_ctrl_element));
LOG_I(RRC,"[decode_SL_Discovery_Message] Message type %d\n", sl_ctrl_msg_recv->type);
memset(send_buf, 0, BUFSIZE);
//send to ProSeApp
memcpy((void *)send_buf, (void*)Sdu, Sdu_len);
prose_addr_len = sizeof(prose_app_addr);
n = sendto(ctrl_sock_fd, (char *)send_buf, Sdu_len, 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
// free(sl_ctrl_msg_send);
if (n < 0){
LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
exit(EXIT_FAILURE);
//exit(EXIT_FAILURE);
}
free(sl_ctrl_msg_recv);
return(0);
}
......
......@@ -805,7 +805,7 @@ void ue_stub_rx_handler(unsigned int num_bytes, char *rx_buffer) {
0,
pdu->header.absSF/10,
pdu->header.absSF%10,
pdu->payload,
sldch->payload,
sldch->payload_length,
0,
SL_DISCOVERY_FLAG_YES);
......
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