| Andrew de los Reyes | d57d147 | 2010-10-21 13:34:08 -0700 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 
 | 2 | // Use of this source code is governed by a BSD-style license that can be | 
 | 3 | // found in the LICENSE file. | 
 | 4 |  | 
 | 5 | #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_FLIMFLAM_PROXY_H__ | 
 | 6 | #define CHROMEOS_PLATFORM_UPDATE_ENGINE_FLIMFLAM_PROXY_H__ | 
 | 7 |  | 
 | 8 | // This class interfaces with FlimFlam to find out data about connectivity. | 
 | 9 |  | 
 | 10 | #include <base/basictypes.h> | 
 | 11 |  | 
 | 12 | #include "update_engine/dbus_interface.h" | 
 | 13 |  | 
 | 14 | namespace chromeos_update_engine { | 
 | 15 |  | 
 | 16 | extern const char* kFlimFlamDbusService; | 
 | 17 | extern const char* kFlimFlamDbusManagerInterface; | 
 | 18 | extern const char* kFlimFlamDbusManagerPath; | 
 | 19 | extern const char* kFlimFlamDbusServiceInterface; | 
 | 20 |  | 
 | 21 | extern const char* kFlimFlamNetTypeEthernet; | 
 | 22 | extern const char* kFlimFlamNetTypeWifi; | 
 | 23 | extern const char* kFlimFlamNetTypeWimax; | 
 | 24 | extern const char* kFlimFlamNetTypeBluetooth; | 
 | 25 | extern const char* kFlimFlamNetTypeCellular; | 
 | 26 |  | 
 | 27 | enum NetworkConnectionType { | 
 | 28 |   kNetEthernet = 0, | 
 | 29 |   kNetWifi, | 
 | 30 |   kNetWimax, | 
 | 31 |   kNetBluetooth, | 
 | 32 |   kNetCellular, | 
 | 33 |   kNetUnknown | 
 | 34 | }; | 
 | 35 |  | 
 | 36 | class FlimFlamProxy { | 
 | 37 |  public: | 
 | 38 |   static bool GetConnectionType(DbusGlibInterface* dbus_iface, | 
 | 39 |                                 NetworkConnectionType* out_type); | 
 | 40 |  | 
 | 41 |   static bool IsExpensiveConnectionType(NetworkConnectionType type) { | 
 | 42 |     return type == kNetWimax || type == kNetBluetooth || type == kNetCellular; | 
 | 43 |   } | 
 | 44 |   static const char* StringForConnectionType(NetworkConnectionType type); | 
 | 45 |    | 
 | 46 |  private: | 
 | 47 |   // Should never be allocated | 
 | 48 |   DISALLOW_IMPLICIT_CONSTRUCTORS(FlimFlamProxy); | 
 | 49 | }; | 
 | 50 |  | 
 | 51 | }  // namespace chromeos_update_engine | 
 | 52 |  | 
 | 53 | #endif  // CHROMEOS_PLATFORM_UPDATE_ENGINE_FLIMFLAM_PROXY_H__ |