shill: Support Cellular CDMA activation.

Still TODO is communicating the activation error codes to the Cellular service.
... And, of course, asynchronous calls throughout.

BUG=chromium-os:19305
TEST=unit tests

Change-Id: I3e0b4a5a8d3c4c74db35ce7f74b5d958677d8b66
Reviewed-on: http://gerrit.chromium.org/gerrit/6192
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
diff --git a/cellular.h b/cellular.h
index 7e3baec..90b915e 100644
--- a/cellular.h
+++ b/cellular.h
@@ -128,6 +128,9 @@
   // Asynchronously connects the modem to the network.
   void Connect();
 
+  // Asynchronously activates the modem.
+  void Activate(const std::string &carrier);
+
   void set_modem_state(ModemState state) { modem_state_ = state; }
   ModemState modem_state() const { return modem_state_; }
 
@@ -138,7 +141,9 @@
   virtual void LinkEvent(unsigned int flags, unsigned int change);
 
  private:
+  FRIEND_TEST(CellularTest, Activate);
   FRIEND_TEST(CellularTest, Connect);
+  FRIEND_TEST(CellularTest, GetCDMAActivationStateString);
   FRIEND_TEST(CellularTest, GetCDMARegistrationState);
   FRIEND_TEST(CellularTest, GetCDMASignalQuality);
   FRIEND_TEST(CellularTest, GetModemInfo);
@@ -152,12 +157,18 @@
   FRIEND_TEST(CellularTest, StartLinked);
   FRIEND_TEST(CellularTest, StartRegister);
 
+  static const char kActivationStateActivated[];
+  static const char kActivationStateActivating[];
+  static const char kActivationStateNotActivated[];
+  static const char kActivationStatePartiallyActivated[];
+  static const char kActivationStateUnknown[];
   static const char kPhoneNumberCDMA[];
   static const char kPhoneNumberGSM[];
 
   void SetState(State state);
 
   void ConnectTask(const DBusPropertiesMap &properties);
+  void ActivateTask(const std::string &carrier);
 
   // Invoked when the modem is connected to the cellular network to transition
   // to the network-connected state and bring the network interface up.
@@ -177,6 +188,8 @@
   std::string GetTypeString() const;
   static std::string GetStateString(State state);
 
+  static std::string GetCDMAActivationStateString(uint32 state);
+
   void EnableModem();
   void GetModemStatus();
   void GetGSMProperties();
@@ -206,6 +219,8 @@
 
   void HandleNewSignalQuality(uint32 strength);
 
+  void HandleNewCDMAActivationState(uint32 error);
+
   // Returns true if the modem is registered. Note that this method looks at the
   // latest CDMA/GSM registration info obtained from the modem rather than the
   // device |state_|.