Add event name to SetSpeedEvent data

Change-Id: Ida95790d78d016952da7d2a2afa0940edbe0aa7b
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/gen-fan-zone-defs.py b/control/gen-fan-zone-defs.py
index 0539ef9..994ad6b 100755
--- a/control/gen-fan-zone-defs.py
+++ b/control/gen-fan-zone-defs.py
@@ -137,7 +137,7 @@
     Generates the source code of an event and returns it as a string
     """
     e = "SetSpeedEvent{\n"
-
+    e += "\"" + event['name'] + "\",\n"
     e += "Group{\n"
     for group in event['groups']:
         for member in group['members']:
@@ -494,6 +494,9 @@
     """
     event = {}
 
+    # Add set speed event name
+    event['name'] = e['name']
+
     # Add set speed event groups
     event['groups'] = getGroups(zone_num, zone_conditions, e, events_data)
 
@@ -531,6 +534,10 @@
     structures to generate a precondition for a set speed event.
     """
     precond = {}
+
+    # Add set speed event precondition name
+    precond['pcname'] = event['name']
+
     # Add set speed event precondition group
     precond['pcgrps'] = getGroups(zNum,
                                   zCond,
@@ -610,6 +617,7 @@
     if 'events' in events_data:
         for e in events_data['events']:
             event = {}
+
             # Add precondition if given
             if ('precondition' in e) and \
                (e['precondition'] is not None):
diff --git a/control/templates/fan_zone_defs.mako.cpp b/control/templates/fan_zone_defs.mako.cpp
index e64bff5..eaac9e3 100644
--- a/control/templates/fan_zone_defs.mako.cpp
+++ b/control/templates/fan_zone_defs.mako.cpp
@@ -99,6 +99,7 @@
                     %if ('pc' in event) and \
                         (event['pc'] is not None):
                     SetSpeedEvent{
+                        "${event['pc']['pcname']}",
                         Group{
                         %for group in event['pc']['pcgrps']:
                         %for member in group['members']:
@@ -140,12 +141,14 @@
                         %endfor
                     std::vector<SetSpeedEvent>{
                     %for pcevt in event['pc']['pcevts']:
-                    SetSpeedEvent{\
+                    SetSpeedEvent{
+                        "${pcevt['name']}",\
                     ${indent(genSSE(event=pcevt), 6)}\
                     },
                     %endfor
                     %else:
-                    SetSpeedEvent{\
+                    SetSpeedEvent{
+                        "${event['name']}",\
                     ${indent(genSSE(event=event), 6)}
                     %endif
                     %if ('pc' in event) and (event['pc'] is not None):
diff --git a/control/types.hpp b/control/types.hpp
index 72c5db0..55be27d 100644
--- a/control/types.hpp
+++ b/control/types.hpp
@@ -81,10 +81,12 @@
 using TimerConf = std::tuple<std::chrono::microseconds,
                              TimerType>;
 
-constexpr auto groupPos = 0;
-constexpr auto actionsPos = 1;
-constexpr auto triggerPos = 2;
-using SetSpeedEvent = std::tuple<Group,
+constexpr auto sseNamePos = 0;
+constexpr auto groupPos = 1;
+constexpr auto actionsPos = 2;
+constexpr auto triggerPos = 3;
+using SetSpeedEvent = std::tuple<std::string,
+                                 Group,
                                  std::vector<Action>,
                                  std::vector<Trigger>>;