Nexus: Clean up supplicant events, protocol, and continue plumbing

    - Create SupplicantEvent classes for events
    - New SupplicantEventFactory for creating events
    - Extract Controller -> NetworkManager callbacks into IControllerHandler
    - Move ScanResult handling from Supplicant -> WifiController
    - Plumb more 'onConnected()' code
    - Instead of re-creating NetworkList every-time, merge in
      new entries
    - Extract SupplicantListener -> Supplicant callbacks into
      ISupplicantEventHandler
    - Move SupplicantListener callback handling to WifiController
    - Add unlocked version of lookupNetwork()
    - Save supplicant config after setting a WifiNetwork variable
    - Move property registration from WifiNetwork -> Supplicant
    - Change wifi enable broadcast messages
    - Add 3 new events: 'onAssociating', 'onAssociated', 'onConnectionTimeout'
    - Add support for handling KeyManagement

Signed-off-by: San Mehat <san@google.com>
diff --git a/nexus/SupplicantEvent.cpp b/nexus/SupplicantEvent.cpp
index 2e6d665..faf7b45 100644
--- a/nexus/SupplicantEvent.cpp
+++ b/nexus/SupplicantEvent.cpp
@@ -23,74 +23,7 @@
 
 #include "libwpa_client/wpa_ctrl.h"
 
-SupplicantEvent::SupplicantEvent(char *event, size_t len) {
-
-    if (event[0] == '<') {
-        char *match = strchr(event, '>');
-        if (match) {
-            char tmp[16];
-
-            strncpy(tmp, &event[1], (match - event));
-            mLevel = atoi(tmp);
-            event += (match - event) + 1;
-        } else
-            LOGW("Unclosed level brace in event");
-    } else
-        LOGW("No level specified in event");
-
-    /*
-     * <N>CTRL-EVENT-XXX
-     *    ^
-     *    +---- event
-     */
-
-    if (!strncmp(event, WPA_EVENT_CONNECTED, strlen(WPA_EVENT_CONNECTED)))
-        mType = SupplicantEvent::EVENT_CONNECTED;
-    else if (!strncmp(event, WPA_EVENT_DISCONNECTED, strlen(WPA_EVENT_DISCONNECTED)))
-        mType = SupplicantEvent::EVENT_DISCONNECTED;
-    else if (!strncmp(event, WPA_EVENT_TERMINATING, strlen(WPA_EVENT_TERMINATING)))
-        mType = SupplicantEvent::EVENT_TERMINATING;
-    else if (!strncmp(event, WPA_EVENT_PASSWORD_CHANGED, strlen(WPA_EVENT_PASSWORD_CHANGED)))
-        mType = SupplicantEvent::EVENT_PASSWORD_CHANGED;
-    else if (!strncmp(event, WPA_EVENT_EAP_NOTIFICATION, strlen(WPA_EVENT_EAP_NOTIFICATION)))
-        mType = SupplicantEvent::EVENT_EAP_NOTIFICATION;
-    else if (!strncmp(event, WPA_EVENT_EAP_STARTED, strlen(WPA_EVENT_EAP_STARTED)))
-        mType = SupplicantEvent::EVENT_EAP_STARTED;
-    else if (!strncmp(event, WPA_EVENT_EAP_METHOD, strlen(WPA_EVENT_EAP_METHOD)))
-        mType = SupplicantEvent::EVENT_EAP_METHOD;
-    else if (!strncmp(event, WPA_EVENT_EAP_SUCCESS, strlen(WPA_EVENT_EAP_SUCCESS)))
-        mType = SupplicantEvent::EVENT_EAP_SUCCESS;
-    else if (!strncmp(event, WPA_EVENT_EAP_FAILURE, strlen(WPA_EVENT_EAP_FAILURE)))
-        mType = SupplicantEvent::EVENT_EAP_FAILURE;
-    else if (!strncmp(event, WPA_EVENT_SCAN_RESULTS, strlen(WPA_EVENT_SCAN_RESULTS)))
-        mType = SupplicantEvent::EVENT_SCAN_RESULTS;
-    else if (!strncmp(event, WPA_EVENT_STATE_CHANGE, strlen(WPA_EVENT_STATE_CHANGE)))
-        mType = SupplicantEvent::EVENT_STATE_CHANGE;
-    else if (!strncmp(event, WPA_EVENT_LINK_SPEED, strlen(WPA_EVENT_LINK_SPEED)))
-        mType = SupplicantEvent::EVENT_LINK_SPEED;
-    else if (!strncmp(event, WPA_EVENT_DRIVER_STATE, strlen(WPA_EVENT_DRIVER_STATE)))
-        mType = SupplicantEvent::EVENT_DRIVER_STATE;
-    else {
-        LOGW("Unknown supplicant event '%s'", event);
-        mType = SupplicantEvent::EVENT_UNKNOWN;
-    }
-
-    for (event; *event != ' '; event++);
-    event++;
-
-    /*
-     * <N>CTRL-EVENT-XXX YYYY
-     *                   ^
-     *                   +---- event
-     */
-
-    for (event; *event == ' '; event++);
-
-    mEvent = strdup(event);
-    mLen = len;
-}
-
-SupplicantEvent::~SupplicantEvent() {
-    if (mEvent)
-        free(mEvent);
+SupplicantEvent::SupplicantEvent(int type, int level) {
+    mType = type;
+    mLevel = level;
 }