Commit 7b8850b1 authored by Maxime Perrotin's avatar Maxime Perrotin

Complete GUI body code

parent fa0bcde1
......@@ -126,6 +126,39 @@ void @_LOWER:Name_@_startup(void)
}
}
// Function polling the message queue for incoming message from the user
void @_LOWER:Name_@_PI_poll(void)
{
struct mq_attr msgq_attr;
char* msgcontent = NULL;
T_@_LOWER:Name_@_RI_list message_recieved_type;
if ((msgcontent = (char*)malloc(sizeof(RI_Messages))) == NULL) {
perror("Error when allocating memory in GUI polling function");
exit (-1);
}
mq_getattr(@_LOWER:Name_@_RI_queue_id, &msgq_attr);
while (!retrieve_message_from_queue(@_LOWER:Name_@_RI_queue_id,
sizeof(RI_Messages),
msgcontent,
(int *)&message_recieved_type)) {
switch(message_recieved_type) {
@@TABLE@@
case i_@_LOWER:List_Of_ASync_RIs_@:
@_LOWER:Name_@_RI_@_LOWER:List_Of_ASync_RIs_@((asn1Scc@_REPLACE_ALL(-/_):ASync_RI_Param_Type_@ *)msgcontent);
break;
@@END_TABLE@@
default : break;
}
}
free(msgcontent);
return;
}
@@TABLE@@
@_Provided_Interfaces_@
......
......@@ -34,9 +34,9 @@ asn1Scc@_REPLACE_ALL((-)/_):Param_Types_@ *OUT_@_LOWER:Param_Names_@
@@END_TABLE@@
}
@@ELSE@@
@@IF@@ @_LOWER:Name_@ /= poll
void @_LOWER:Parent_Function_@_PI_@_LOWER:Name_@(void)
{
@@IF@@ @_LOWER:Name_@ /= poll
write_message_to_queue
(@_LOWER:Parent_Function_@_PI_queue_id,
0, // Message parameter size is 0 since there is no parameter
......@@ -48,34 +48,6 @@ void @_LOWER:Parent_Function_@_PI_@_LOWER:Name_@(void)
0,
NULL,
i_@_LOWER:Name_@);
@@ELSE@@ @@-- GUI polling function
struct mq_attr msgq_attr;
char* msgcontent = NULL;
T_ground_RI_list message_recieved_type;
if ((msgcontent = (char*)malloc(sizeof(RI_Messages))) == NULL) {
perror("Error when allocating memory in GUI polling function");
exit (-1);
}
mq_getattr(ground_RI_queue_id, &msgq_attr);
while (!retrieve_message_from_queue(ground_RI_queue_id,
sizeof(RI_Messages),
msgcontent,
(int *)&message_recieved_type))
{
switch(message_recieved_type)
{
// case i_run_forrest : INVOKE_RI_run_forrest (msgcontent);
// break;
default : break;
}
}
free(msgcontent);
return;
@@END_IF@@
}
@@END_IF@@
@@END_IF@@
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