• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * Generated mock file from original source file
19  *   Functions generated:12
20  *
21  *  mockcify.pl ver 0.2
22  */
23 
24 #include <cstdint>
25 #include <functional>
26 #include <map>
27 #include <string>
28 
29 #include "test/common/mock_functions.h"
30 
31 // Original included files, if any
32 // NOTE: Since this is a mock file with mock definitions some number of
33 //       include files may not be required.  The include-what-you-use
34 //       still applies, but crafting proper inclusion is out of scope
35 //       for this effort.  This compilation unit may compile as-is, or
36 //       may need attention to prune the inclusion set.
37 #include "gd/hci/address.h"
38 #include "gd/os/metrics.h"
39 #include "main/shim/helpers.h"
40 #include "main/shim/metrics_api.h"
41 #include "types/raw_address.h"
42 #include <frameworks/proto_logging/stats/enums/bluetooth/le/enums.pb.h>
43 
44 
45 // Mocked compile conditionals, if any
46 #ifndef UNUSED_ATTR
47 #define UNUSED_ATTR
48 #endif
49 
50 namespace test {
51 namespace mock {
52 namespace main_shim_metrics_api {
53 
54 // Shared state between mocked functions and tests
55 // Name: LogMetricLinkLayerConnectionEvent
56 // Params: const RawAddress* raw_address, uint32_t connection_handle,
57 // android::bluetooth::DirectionEnum direction, uint16_t link_type, uint32_t
58 // hci_cmd, uint16_t hci_event, uint16_t hci_ble_event, uint16_t cmd_status,
59 // uint16_t reason_code Returns: void
60 struct LogMetricLinkLayerConnectionEvent {
61   std::function<void(const RawAddress* raw_address, uint32_t connection_handle,
62                      android::bluetooth::DirectionEnum direction,
63                      uint16_t link_type, uint32_t hci_cmd, uint16_t hci_event,
64                      uint16_t hci_ble_event, uint16_t cmd_status,
65                      uint16_t reason_code)>
66       body{[](const RawAddress* raw_address, uint32_t connection_handle,
67               android::bluetooth::DirectionEnum direction, uint16_t link_type,
68               uint32_t hci_cmd, uint16_t hci_event, uint16_t hci_ble_event,
69               uint16_t cmd_status, uint16_t reason_code) {}};
operatorLogMetricLinkLayerConnectionEvent70   void operator()(const RawAddress* raw_address, uint32_t connection_handle,
71                   android::bluetooth::DirectionEnum direction,
72                   uint16_t link_type, uint32_t hci_cmd, uint16_t hci_event,
73                   uint16_t hci_ble_event, uint16_t cmd_status,
74                   uint16_t reason_code) {
75     body(raw_address, connection_handle, direction, link_type, hci_cmd,
76          hci_event, hci_ble_event, cmd_status, reason_code);
77   };
78 };
79 extern struct LogMetricLinkLayerConnectionEvent
80     LogMetricLinkLayerConnectionEvent;
81 // Name: LogMetricA2dpAudioUnderrunEvent
82 // Params: const RawAddress& raw_address, uint64_t encoding_interval_millis, int
83 // num_missing_pcm_bytes Returns: void
84 struct LogMetricA2dpAudioUnderrunEvent {
85   std::function<void(const RawAddress& raw_address,
86                      uint64_t encoding_interval_millis,
87                      int num_missing_pcm_bytes)>
88       body{[](const RawAddress& raw_address, uint64_t encoding_interval_millis,
89               int num_missing_pcm_bytes) {}};
operatorLogMetricA2dpAudioUnderrunEvent90   void operator()(const RawAddress& raw_address,
91                   uint64_t encoding_interval_millis,
92                   int num_missing_pcm_bytes) {
93     body(raw_address, encoding_interval_millis, num_missing_pcm_bytes);
94   };
95 };
96 extern struct LogMetricA2dpAudioUnderrunEvent LogMetricA2dpAudioUnderrunEvent;
97 // Name: LogMetricA2dpAudioOverrunEvent
98 // Params: const RawAddress& raw_address, uint64_t encoding_interval_millis, int
99 // num_dropped_buffers, int num_dropped_encoded_frames, int
100 // num_dropped_encoded_bytes Returns: void
101 struct LogMetricA2dpAudioOverrunEvent {
102   std::function<void(const RawAddress& raw_address,
103                      uint64_t encoding_interval_millis, int num_dropped_buffers,
104                      int num_dropped_encoded_frames,
105                      int num_dropped_encoded_bytes)>
106       body{[](const RawAddress& raw_address, uint64_t encoding_interval_millis,
107               int num_dropped_buffers, int num_dropped_encoded_frames,
108               int num_dropped_encoded_bytes) {}};
operatorLogMetricA2dpAudioOverrunEvent109   void operator()(const RawAddress& raw_address,
110                   uint64_t encoding_interval_millis, int num_dropped_buffers,
111                   int num_dropped_encoded_frames,
112                   int num_dropped_encoded_bytes) {
113     body(raw_address, encoding_interval_millis, num_dropped_buffers,
114          num_dropped_encoded_frames, num_dropped_encoded_bytes);
115   };
116 };
117 extern struct LogMetricA2dpAudioOverrunEvent LogMetricA2dpAudioOverrunEvent;
118 // Name: LogMetricA2dpPlaybackEvent
119 // Params: const RawAddress& raw_address, int playback_state, int
120 // audio_coding_mode Returns: void
121 struct LogMetricA2dpPlaybackEvent {
122   std::function<void(const RawAddress& raw_address, int playback_state,
123                      int audio_coding_mode)>
124       body{[](const RawAddress& raw_address, int playback_state,
125               int audio_coding_mode) {}};
operatorLogMetricA2dpPlaybackEvent126   void operator()(const RawAddress& raw_address, int playback_state,
127                   int audio_coding_mode) {
128     body(raw_address, playback_state, audio_coding_mode);
129   };
130 };
131 extern struct LogMetricA2dpPlaybackEvent LogMetricA2dpPlaybackEvent;
132 // Name: LogMetricHfpPacketLossStats
133 // Params: const RawAddress& raw_address, int num_decoded_frames, double
134 // packet_loss_ratio Returns: void
135 struct LogMetricHfpPacketLossStats {
136   std::function<void(const RawAddress& raw_address, int num_decoded_frames,
137                      double packet_loss_ratio)>
138       body{[](const RawAddress& raw_address, int num_decoded_frames,
139               double packet_loss_ratio) {}};
operatorLogMetricHfpPacketLossStats140   void operator()(const RawAddress& raw_address, int num_decoded_frames,
141                   double packet_loss_ratio) {
142     body(raw_address, num_decoded_frames, packet_loss_ratio);
143   };
144 };
145 extern struct LogMetricHfpPacketLossStats LogMetricHfpPacketLossStats;
146 // Name: LogMetricReadRssiResult
147 // Params: const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
148 // int8_t rssi Returns: void
149 struct LogMetricReadRssiResult {
150   std::function<void(const RawAddress& raw_address, uint16_t handle,
151                      uint32_t cmd_status, int8_t rssi)>
152       body{[](const RawAddress& raw_address, uint16_t handle,
153               uint32_t cmd_status, int8_t rssi) {}};
operatorLogMetricReadRssiResult154   void operator()(const RawAddress& raw_address, uint16_t handle,
155                   uint32_t cmd_status, int8_t rssi) {
156     body(raw_address, handle, cmd_status, rssi);
157   };
158 };
159 extern struct LogMetricReadRssiResult LogMetricReadRssiResult;
160 // Name: LogMetricReadFailedContactCounterResult
161 // Params: const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
162 // int32_t failed_contact_counter Returns: void
163 struct LogMetricReadFailedContactCounterResult {
164   std::function<void(const RawAddress& raw_address, uint16_t handle,
165                      uint32_t cmd_status, int32_t failed_contact_counter)>
166       body{[](const RawAddress& raw_address, uint16_t handle,
167               uint32_t cmd_status, int32_t failed_contact_counter) {}};
operatorLogMetricReadFailedContactCounterResult168   void operator()(const RawAddress& raw_address, uint16_t handle,
169                   uint32_t cmd_status, int32_t failed_contact_counter) {
170     body(raw_address, handle, cmd_status, failed_contact_counter);
171   };
172 };
173 extern struct LogMetricReadFailedContactCounterResult
174     LogMetricReadFailedContactCounterResult;
175 // Name: LogMetricReadTxPowerLevelResult
176 // Params: const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
177 // int32_t transmit_power_level Returns: void
178 struct LogMetricReadTxPowerLevelResult {
179   std::function<void(const RawAddress& raw_address, uint16_t handle,
180                      uint32_t cmd_status, int32_t transmit_power_level)>
181       body{[](const RawAddress& raw_address, uint16_t handle,
182               uint32_t cmd_status, int32_t transmit_power_level) {}};
operatorLogMetricReadTxPowerLevelResult183   void operator()(const RawAddress& raw_address, uint16_t handle,
184                   uint32_t cmd_status, int32_t transmit_power_level) {
185     body(raw_address, handle, cmd_status, transmit_power_level);
186   };
187 };
188 extern struct LogMetricReadTxPowerLevelResult LogMetricReadTxPowerLevelResult;
189 // Name: LogMetricSmpPairingEvent
190 // Params: const RawAddress& raw_address, uint16_t smp_cmd,
191 // android::bluetooth::DirectionEnum direction, uint8_t smp_fail_reason Returns:
192 // void
193 struct LogMetricSmpPairingEvent {
194   std::function<void(const RawAddress& raw_address, uint16_t smp_cmd,
195                      android::bluetooth::DirectionEnum direction,
196                      uint16_t smp_fail_reason)>
197       body{[](const RawAddress& raw_address, uint16_t smp_cmd,
198               android::bluetooth::DirectionEnum direction,
199               uint16_t smp_fail_reason) {}};
operatorLogMetricSmpPairingEvent200   void operator()(const RawAddress& raw_address, uint16_t smp_cmd,
201                   android::bluetooth::DirectionEnum direction,
202                   uint16_t smp_fail_reason) {
203     body(raw_address, smp_cmd, direction, smp_fail_reason);
204   };
205 };
206 extern struct LogMetricSmpPairingEvent LogMetricSmpPairingEvent;
207 // Name: LogMetricClassicPairingEvent
208 // Params: const RawAddress& raw_address, uint16_t handle, uint32_t hci_cmd,
209 // uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code, int64_t
210 // event_value Returns: void
211 struct LogMetricClassicPairingEvent {
212   std::function<void(const RawAddress& raw_address, uint16_t handle,
213                      uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status,
214                      uint16_t reason_code, int64_t event_value)>
215       body{[](const RawAddress& raw_address, uint16_t handle, uint32_t hci_cmd,
216               uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code,
217               int64_t event_value) {}};
operatorLogMetricClassicPairingEvent218   void operator()(const RawAddress& raw_address, uint16_t handle,
219                   uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status,
220                   uint16_t reason_code, int64_t event_value) {
221     body(raw_address, handle, hci_cmd, hci_event, cmd_status, reason_code,
222          event_value);
223   };
224 };
225 extern struct LogMetricClassicPairingEvent LogMetricClassicPairingEvent;
226 // Name: LogMetricSdpAttribute
227 // Params: const RawAddress& raw_address, uint16_t protocol_uuid, uint16_t
228 // attribute_id, size_t attribute_size, const char* attribute_value Returns:
229 // void
230 struct LogMetricSdpAttribute {
231   std::function<void(const RawAddress& raw_address, uint16_t protocol_uuid,
232                      uint16_t attribute_id, size_t attribute_size,
233                      const char* attribute_value)>
234       body{[](const RawAddress& raw_address, uint16_t protocol_uuid,
235               uint16_t attribute_id, size_t attribute_size,
236               const char* attribute_value) {}};
operatorLogMetricSdpAttribute237   void operator()(const RawAddress& raw_address, uint16_t protocol_uuid,
238                   uint16_t attribute_id, size_t attribute_size,
239                   const char* attribute_value) {
240     body(raw_address, protocol_uuid, attribute_id, attribute_size,
241          attribute_value);
242   };
243 };
244 extern struct LogMetricSdpAttribute LogMetricSdpAttribute;
245 // Name: LogMetricSocketConnectionState
246 // Params: const RawAddress& raw_address, int port, int type,
247 // android::bluetooth::SocketConnectionstateEnum connection_state, int64_t
248 // tx_bytes, int64_t rx_bytes, int uid, int server_port,
249 // android::bluetooth::SocketRoleEnum socket_role Returns: void
250 struct LogMetricSocketConnectionState {
251   std::function<void(
252       const RawAddress& raw_address, int port, int type,
253       android::bluetooth::SocketConnectionstateEnum connection_state,
254       int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port,
255       android::bluetooth::SocketRoleEnum socket_role)>
256       body{[](const RawAddress& raw_address, int port, int type,
257               android::bluetooth::SocketConnectionstateEnum connection_state,
258               int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port,
259               android::bluetooth::SocketRoleEnum socket_role) {}};
operatorLogMetricSocketConnectionState260   void operator()(
261       const RawAddress& raw_address, int port, int type,
262       android::bluetooth::SocketConnectionstateEnum connection_state,
263       int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port,
264       android::bluetooth::SocketRoleEnum socket_role) {
265     body(raw_address, port, type, connection_state, tx_bytes, rx_bytes, uid,
266          server_port, socket_role);
267   };
268 };
269 extern struct LogMetricSocketConnectionState LogMetricSocketConnectionState;
270 // Name: LogMetricManufacturerInfo
271 // Params: const RawAddress& raw_address, android::bluetooth::DeviceInfoSrcEnum
272 // source_type, const std::string& source_name, const std::string& manufacturer,
273 // const std::string& model, const std::string& hardware_version, const
274 // std::string& software_version Returns: void
275 struct LogMetricManufacturerInfo {
276   std::function<void(const RawAddress& raw_address,
277                      android::bluetooth::AddressTypeEnum address_type,
278                      android::bluetooth::DeviceInfoSrcEnum source_type,
279                      const std::string& source_name,
280                      const std::string& manufacturer, const std::string& model,
281                      const std::string& hardware_version,
282                      const std::string& software_version)>
283       body{[](const RawAddress& raw_address,
284               android::bluetooth::AddressTypeEnum address_type,
285               android::bluetooth::DeviceInfoSrcEnum source_type,
286               const std::string& source_name, const std::string& manufacturer,
287               const std::string& model, const std::string& hardware_version,
288               const std::string& software_version) {}};
operatorLogMetricManufacturerInfo289   void operator()(const RawAddress& raw_address,
290                   android::bluetooth::AddressTypeEnum address_type,
291                   android::bluetooth::DeviceInfoSrcEnum source_type,
292                   const std::string& source_name,
293                   const std::string& manufacturer, const std::string& model,
294                   const std::string& hardware_version,
295                   const std::string& software_version) {
296     body(raw_address, address_type, source_type, source_name, manufacturer,
297          model, hardware_version, software_version);
298   };
299 };
300 extern struct LogMetricManufacturerInfo LogMetricManufacturerInfo;
301 
302 // Name: LogMetricBluetoothLEConnectionMetricEvent
303 // Params:     const RawAddress& raw_address,
304 //    android::bluetooth::le::LeConnectionOriginType origin_type,
305 //    android::bluetooth::le::LeConnectionType connection_type,
306 //    android::bluetooth::le::LeConnectionState transaction_state,
307 //    std::vector<std::pair<bluetooth::metrics::ArgumentType, int>>
308 //    argument_list
309 struct LogMetricBluetoothLEConnectionMetricEvent {
310   std::function<void(
311       const RawAddress& raw_address,
312       android::bluetooth::le::LeConnectionOriginType origin_type,
313       android::bluetooth::le::LeConnectionType connection_type,
314       android::bluetooth::le::LeConnectionState transaction_state,
315       std::vector<std::pair<bluetooth::os::ArgumentType, int>>
316           argument_list)>
317       body{[](const RawAddress& raw_address,
318               android::bluetooth::le::LeConnectionOriginType origin_type,
319               android::bluetooth::le::LeConnectionType connection_type,
320               android::bluetooth::le::LeConnectionState
321                   transaction_state,
322               std::vector<std::pair<bluetooth::os::ArgumentType, int>>
323                   argument_list) {}};
operatorLogMetricBluetoothLEConnectionMetricEvent324   void operator()(
325       const RawAddress& raw_address,
326       android::bluetooth::le::LeConnectionOriginType origin_type,
327       android::bluetooth::le::LeConnectionType connection_type,
328       android::bluetooth::le::LeConnectionState transaction_state,
329       std::vector<std::pair<bluetooth::os::ArgumentType, int>>
330           argument_list) {
331     body(raw_address, origin_type, connection_type, transaction_state,
332          argument_list);
333   };
334 };
335 
336 }  // namespace main_shim_metrics_api
337 }  // namespace mock
338 }  // namespace test
339 
340 // END mockcify generation
341