Robot Agent  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
task_report.c
Go to the documentation of this file.
1 
11 /* -- Includes -- */
12 /* system libraries */
13 
14 /* project libraries */
15 #include "task.h"
16 
20 void task_report(void)
21  {
22  // Check if task is enabled
24  {
25  // Check pipe for event
27  {
28  // Local variables
29  int i;
30  victim_t victim;
31 
32  // Check if this victim is new
33  for(i = 0; i < g_task_mission_data.victim_count; i++)
34  {
35  // If there is victim with the same ID -> stop searching
37  {
38  break;
39  }
40  }
41  // If counter is the same as victim count -> new victim is found
42  // Report victim
44  {
45  // Save victim position
46  victim.x = g_robot->x;
47  victim.y = g_robot->y;
48  // Save victim ID
49  strncpy(victim.id, g_tp_refine_report.victim_id, 11);
50 
51  // Redirect victim data to mission
52  g_tp_report_mission.victim = victim;
53  // Set event
55 
56  // Send victim data (add data to communication queue)
58 
59  // Reset event
61  }
62  }
63 
64  }
65 }
int enabled
Definition: task.h:46
taskpipe_refine_report_t g_tp_refine_report
Definition: task.c:52
robot_t * g_robot
Definition: task.c:27
doublylinkedlist_t * g_list_send
Definition: task.c:32
#define s_TASK_EVENT_SET
Definition: task.h:111
task_t g_task_report
Definition: task.c:43
Victim structure.
Definition: def.h:28
taskpipe_report_mission_t g_tp_report_mission
Definition: task.c:53
victim_t victims[s_CONFIG_VICTIM_MAX_COUNT]
Definition: task.h:57
char id[11]
Definition: def.h:32
#define s_TASK_EVENT_RESET
Definition: task.h:112
task_mission_t g_task_mission_data
Definition: task.c:48
void doublylinkedlist_insert_end(doublylinkedlist_t *dlls, void *data, int data_type)
#define s_TRUE
Definition: def.h:60
#define s_DATA_STRUCT_TYPE_VICTIM
Definition: def.h:69
void task_report(void)
Definition: task_report.c:20