Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AIEngine
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-AIEngine
Commits
d9ba94d3
Commit
d9ba94d3
authored
Nov 03, 2020
by
wangdong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
尝试把Python返回的数据格式化为结构体
parent
41cfeb6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
openair2/LAYER2/MAC/pre_processor.c
openair2/LAYER2/MAC/pre_processor.c
+23
-5
No files found.
openair2/LAYER2/MAC/pre_processor.c
View file @
d9ba94d3
...
...
@@ -182,6 +182,8 @@ int rr_dl_run(module_id_t Mod_id,
return
n_rbg_sched
;
for
(;
!
rbgalloc_mask
[
rbg
];
rbg
++
)
/* fast-forward */
;
}
else
{
rnti_t
rnti
=
UE_RNTI
(
Mod_id
,
UE_id
);
subframe_t
.
rnti
[
UE_id
]
=
rnti
;
if
(
UE_info
->
UE_template
[
CC_id
][
UE_id
].
dl_buffer_total
>
0
)
{
//获取该dl的buffer,如果没Buffer就后面跳过了!!!
subframe_t
.
total_buffer
[
UE_id
]
=
UE_info
->
UE_template
[
CC_id
][
UE_id
].
dl_buffer_total
;
*
cur_UE
=
UE_id
;
...
...
@@ -193,8 +195,24 @@ skip_ue:
UE_id
=
next_ue_list_looped
(
UE_list
,
UE_id
);
}
while
(
UE_id
!=
*
start_ue
);
*
cur_UE
=
-
1
;
// mark end,巧妙的Hack!
if
(
UE_sched
.
head
<
0
)
return
n_rbg_sched
;
// no UE has a transmission
if
(
UE_sched
.
head
<
0
){
cJSON
*
data_t
=
NULL
;
// data = soctet_to_py(&subframe, RC.sockfd);sss
char
*
json_data
=
NULL
;
char
buf
[
MAXLINE
];
int
n
=
0
;
memset
(
buf
,
0
,
MAXLINE
);
cJSON
*
json_to_sent
=
struct_to_json
(
&
subframe_t
);
json_data
=
cJSON_Print
(
json_to_sent
);
//printf("[SOCKET]Brfore: %s\n", json_data);
n
=
strlen
(
json_data
);
write
(
RC
.
sockfd
,
json_data
,
n
);
read
(
RC
.
sockfd
,
buf
,
MAXLINE
);
cJSON
*
res
=
cJSON_Parse
(
buf
);
Subframe
*
temp
=
NULL
;
temp
=
json_to_struct
(
res
);
return
n_rbg_sched
;
}
// no UE has a transmission
// after allocating retransmissions: pre-allocate CCE, compute number of
// requested RBGs
// 计算每个调度帧内UE所需的RB
...
...
@@ -204,7 +222,6 @@ skip_ue:
while
(
*
cur_UE
>=
0
&&
max_num_ue
>
0
)
{
const
int
UE_id
=
*
cur_UE
;
cur_UE
=
&
UE_sched
.
next
[
UE_id
];
// go to next
rnti_t
rnti
=
UE_RNTI
(
Mod_id
,
UE_id
);
const
uint8_t
cqi
=
UE_info
->
UE_sched_ctrl
[
UE_id
].
dl_cqi
[
CC_id
];
const
int
idx
=
CCE_try_allocate_dlsch
(
Mod_id
,
CC_id
,
subframe
,
UE_id
,
cqi
);
...
...
@@ -218,7 +235,6 @@ skip_ue:
const
uint32_t
B
=
UE_info
->
UE_template
[
CC_id
][
UE_id
].
dl_buffer_total
;
rb_required
[
UE_id
]
=
find_nb_rb_DL
(
mcs
,
B
,
n_rbg_sched
*
RBGsize
,
RBGsize
);
subframe_t
.
nb_rb_max
=
n_rbg_sched
*
RBGsize
;
subframe_t
.
rnti
[
UE_id
]
=
rnti
;
subframe_t
.
ammount
[
UE_id
]
=
rb_required
[
UE_id
];
max_num_ue
--
;
}
...
...
@@ -233,11 +249,13 @@ skip_ue:
memset
(
buf
,
0
,
MAXLINE
);
cJSON
*
json_to_sent
=
struct_to_json
(
&
subframe_t
);
json_data
=
cJSON_Print
(
json_to_sent
);
printf
(
"[SOCKET]Brfore: %s
\n
"
,
json_data
);
//
printf("[SOCKET]Brfore: %s\n", json_data);
n
=
strlen
(
json_data
);
write
(
RC
.
sockfd
,
json_data
,
n
);
read
(
RC
.
sockfd
,
buf
,
MAXLINE
);
cJSON
*
res
=
cJSON_Parse
(
buf
);
Subframe
*
temp
=
NULL
;
temp
=
json_to_struct
(
res
);
//printf("[SOCKET]After: %s\n", cJSON_Print(res));
//json_data = cJSON_Print(struct_to_json(&subframe));
//data = cJSON_Parse(json_data);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment