OLD | NEW |
1 // Copyright (c) 2010, 2011 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010, 2011 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SRC_DEVICE_H_ | 5 #ifndef SRC_DEVICE_H_ |
6 #define SRC_DEVICE_H_ | 6 #define SRC_DEVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include <base/basictypes.h> // NOLINT | 10 #include <base/basictypes.h> // NOLINT |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 virtual const std::string& GetCarrier() const = 0; | 46 virtual const std::string& GetCarrier() const = 0; |
47 | 47 |
48 // get interface name for this device (e.g., "usb0") | 48 // get interface name for this device (e.g., "usb0") |
49 // returns empty string if we don't know | 49 // returns empty string if we don't know |
50 virtual const std::string& GetInterface() const = 0; | 50 virtual const std::string& GetInterface() const = 0; |
51 | 51 |
52 // Service methods | 52 // Service methods |
53 | 53 |
54 // start a new byte counter from 0 | 54 // start a new byte counter from 0 |
55 // there must not be an existing byte counter | 55 // there must not be an existing byte counter |
56 // |parent_| will receive periodic updates via Service::OnByteCounterUpdate | 56 // parent service will receive periodic updates via OnByteCounterUpdate |
57 // returns true on success and false on failure | 57 // returns true on success and false on failure |
58 virtual bool StartByteCounter() = 0; | 58 virtual bool StartByteCounter() = 0; |
59 | 59 |
60 // destroy any existing byte counter | 60 // destroy any existing byte counter |
61 // |parent_| will no longer receive updates after this call | 61 // parent service will no longer receive updates after this call |
62 virtual void StopByteCounter() = 0; | 62 virtual void StopByteCounter() = 0; |
63 | 63 |
64 // is the byte counter running? | 64 // is the byte counter running? |
65 virtual bool ByteCounterRunning() const = 0; | 65 virtual bool ByteCounterRunning() const = 0; |
66 | 66 |
| 67 // reset byte counter to an arbitrary baseline value |
| 68 // counter will continue to run and increment relative to new baseline |
| 69 // there must be an existing byte counter |
| 70 // parent service must already have received at least one update |
| 71 virtual void ResetByteCounter(uint64 rx_bytes, uint64 tx_bytes) = 0; |
| 72 |
67 // factory | 73 // factory |
68 static Device* NewDevice(Service * const parent, | 74 static Device* NewDevice(Service * const parent, |
69 DBus::Connection& connection, // NOLINT | 75 DBus::Connection& connection, // NOLINT |
70 const DBus::Path& path); | 76 const DBus::Path& path); |
71 | 77 |
72 private: | 78 private: |
73 DISALLOW_COPY_AND_ASSIGN(Device); | 79 DISALLOW_COPY_AND_ASSIGN(Device); |
74 }; | 80 }; |
75 | 81 |
76 } // namespace cashew | 82 } // namespace cashew |
77 | 83 |
78 #endif // SRC_DEVICE_H_ | 84 #endif // SRC_DEVICE_H_ |
OLD | NEW |