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 // Mock include file to share data between tests and mock
24 #include "test/mock/mock_main_shim_metrics_api.h"
25 
26 #include <cstdint>
27 #include <string>
28 
29 // Original included files, if any
30 #include "main/shim/metrics_api.h"
31 #include "test/common/mock_functions.h"
32 #include "types/raw_address.h"
33 
34 // Mocked compile conditionals, if any
35 // Mocked internal structures, if any
36 
37 namespace test {
38 namespace mock {
39 namespace main_shim_metrics_api {
40 
41 // Function state capture and return values, if needed
42 struct LogMetricLinkLayerConnectionEvent LogMetricLinkLayerConnectionEvent;
43 struct LogMetricA2dpAudioUnderrunEvent LogMetricA2dpAudioUnderrunEvent;
44 struct LogMetricA2dpAudioOverrunEvent LogMetricA2dpAudioOverrunEvent;
45 struct LogMetricA2dpPlaybackEvent LogMetricA2dpPlaybackEvent;
46 struct LogMetricA2dpSessionMetricsEvent LogMetricA2dpSessionMetricsEvent;
47 struct LogMetricHfpPacketLossStats LogMetricHfpPacketLossStats;
48 struct LogMetricMmcTranscodeRttStats LogMetricMmcTranscodeRttStats;
49 struct LogMetricReadRssiResult LogMetricReadRssiResult;
50 struct LogMetricReadFailedContactCounterResult LogMetricReadFailedContactCounterResult;
51 struct LogMetricReadTxPowerLevelResult LogMetricReadTxPowerLevelResult;
52 struct LogMetricSmpPairingEvent LogMetricSmpPairingEvent;
53 struct LogMetricLePairingFail LogMetricLePairingFail;
54 struct LogMetricClassicPairingEvent LogMetricClassicPairingEvent;
55 struct LogMetricSdpAttribute LogMetricSdpAttribute;
56 struct LogMetricSocketConnectionState LogMetricSocketConnectionState;
57 struct LogMetricManufacturerInfo LogMetricManufacturerInfo;
58 struct LogMetricLeConnectionStatus LogMetricLeConnectionStatus;
59 struct LogMetricLeDeviceInAcceptList LogMetricLeDeviceInAcceptList;
60 struct LogMetricLeConnectionLifecycle LogMetricLeConnectionLifecycle;
61 
62 }  // namespace main_shim_metrics_api
63 }  // namespace mock
64 }  // namespace test
65 
66 // Mocked functions, if any
LogMetricLinkLayerConnectionEvent(const RawAddress * raw_address,uint32_t connection_handle,android::bluetooth::DirectionEnum direction,uint16_t link_type,uint32_t hci_cmd,uint16_t hci_event,uint16_t hci_ble_event,uint16_t cmd_status,uint16_t reason_code)67 void bluetooth::shim::LogMetricLinkLayerConnectionEvent(const RawAddress* raw_address,
68                                                         uint32_t connection_handle,
69                                                         android::bluetooth::DirectionEnum direction,
70                                                         uint16_t link_type, uint32_t hci_cmd,
71                                                         uint16_t hci_event, uint16_t hci_ble_event,
72                                                         uint16_t cmd_status, uint16_t reason_code) {
73   inc_func_call_count(__func__);
74   test::mock::main_shim_metrics_api::LogMetricLinkLayerConnectionEvent(
75           raw_address, connection_handle, direction, link_type, hci_cmd, hci_event, hci_ble_event,
76           cmd_status, reason_code);
77 }
LogMetricA2dpAudioUnderrunEvent(const RawAddress & raw_address,uint64_t encoding_interval_millis,int num_missing_pcm_bytes)78 void bluetooth::shim::LogMetricA2dpAudioUnderrunEvent(const RawAddress& raw_address,
79                                                       uint64_t encoding_interval_millis,
80                                                       int num_missing_pcm_bytes) {
81   inc_func_call_count(__func__);
82   test::mock::main_shim_metrics_api::LogMetricA2dpAudioUnderrunEvent(
83           raw_address, encoding_interval_millis, num_missing_pcm_bytes);
84 }
LogMetricA2dpAudioOverrunEvent(const RawAddress & raw_address,uint64_t encoding_interval_millis,int num_dropped_buffers,int num_dropped_encoded_frames,int num_dropped_encoded_bytes)85 void bluetooth::shim::LogMetricA2dpAudioOverrunEvent(const RawAddress& raw_address,
86                                                      uint64_t encoding_interval_millis,
87                                                      int num_dropped_buffers,
88                                                      int num_dropped_encoded_frames,
89                                                      int num_dropped_encoded_bytes) {
90   inc_func_call_count(__func__);
91   test::mock::main_shim_metrics_api::LogMetricA2dpAudioOverrunEvent(
92           raw_address, encoding_interval_millis, num_dropped_buffers, num_dropped_encoded_frames,
93           num_dropped_encoded_bytes);
94 }
LogMetricA2dpPlaybackEvent(const RawAddress & raw_address,int playback_state,int audio_coding_mode)95 void bluetooth::shim::LogMetricA2dpPlaybackEvent(const RawAddress& raw_address, int playback_state,
96                                                  int audio_coding_mode) {
97   inc_func_call_count(__func__);
98   test::mock::main_shim_metrics_api::LogMetricA2dpPlaybackEvent(raw_address, playback_state,
99                                                                 audio_coding_mode);
100 }
LogMetricA2dpSessionMetricsEvent(const RawAddress & raw_address,int64_t audio_duration_ms,int media_timer_min_ms,int media_timer_max_ms,int,int total_scheduling_count,int buffer_overruns_max_count,int buffer_overruns_total,float buffer_underruns_average,int buffer_underruns_count,int64_t codec_index,bool is_a2dp_offload)101 void bluetooth::shim::LogMetricA2dpSessionMetricsEvent(
102         const RawAddress& raw_address, int64_t audio_duration_ms, int media_timer_min_ms,
103         int media_timer_max_ms, int /* media_timer_avg_ms */, int total_scheduling_count,
104         int buffer_overruns_max_count, int buffer_overruns_total, float buffer_underruns_average,
105         int buffer_underruns_count, int64_t codec_index, bool is_a2dp_offload) {
106   inc_func_call_count(__func__);
107   test::mock::main_shim_metrics_api::LogMetricA2dpSessionMetricsEvent(
108           raw_address, audio_duration_ms, media_timer_min_ms, media_timer_max_ms, audio_duration_ms,
109           total_scheduling_count, buffer_overruns_max_count, buffer_overruns_total,
110           buffer_underruns_average, buffer_underruns_count, codec_index, is_a2dp_offload);
111 }
LogMetricHfpPacketLossStats(const RawAddress & raw_address,int num_decoded_frames,double packet_loss_ratio,uint16_t codec_type)112 void bluetooth::shim::LogMetricHfpPacketLossStats(const RawAddress& raw_address,
113                                                   int num_decoded_frames, double packet_loss_ratio,
114                                                   uint16_t codec_type) {
115   inc_func_call_count(__func__);
116   test::mock::main_shim_metrics_api::LogMetricHfpPacketLossStats(raw_address, num_decoded_frames,
117                                                                  packet_loss_ratio, codec_type);
118 }
LogMetricMmcTranscodeRttStats(int maximum_rtt,double mean_rtt,int num_requests,int codec_type)119 void bluetooth::shim::LogMetricMmcTranscodeRttStats(int maximum_rtt, double mean_rtt,
120                                                     int num_requests, int codec_type) {
121   inc_func_call_count(__func__);
122   test::mock::main_shim_metrics_api::LogMetricMmcTranscodeRttStats(maximum_rtt, mean_rtt,
123                                                                    num_requests, codec_type);
124 }
LogMetricReadRssiResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int8_t rssi)125 void bluetooth::shim::LogMetricReadRssiResult(const RawAddress& raw_address, uint16_t handle,
126                                               uint32_t cmd_status, int8_t rssi) {
127   inc_func_call_count(__func__);
128   test::mock::main_shim_metrics_api::LogMetricReadRssiResult(raw_address, handle, cmd_status, rssi);
129 }
LogMetricReadFailedContactCounterResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int32_t failed_contact_counter)130 void bluetooth::shim::LogMetricReadFailedContactCounterResult(const RawAddress& raw_address,
131                                                               uint16_t handle, uint32_t cmd_status,
132                                                               int32_t failed_contact_counter) {
133   inc_func_call_count(__func__);
134   test::mock::main_shim_metrics_api::LogMetricReadFailedContactCounterResult(
135           raw_address, handle, cmd_status, failed_contact_counter);
136 }
LogMetricReadTxPowerLevelResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int32_t transmit_power_level)137 void bluetooth::shim::LogMetricReadTxPowerLevelResult(const RawAddress& raw_address,
138                                                       uint16_t handle, uint32_t cmd_status,
139                                                       int32_t transmit_power_level) {
140   inc_func_call_count(__func__);
141   test::mock::main_shim_metrics_api::LogMetricReadTxPowerLevelResult(
142           raw_address, handle, cmd_status, transmit_power_level);
143 }
LogMetricSmpPairingEvent(const RawAddress & raw_address,uint16_t smp_cmd,android::bluetooth::DirectionEnum direction,uint16_t smp_fail_reason)144 void bluetooth::shim::LogMetricSmpPairingEvent(const RawAddress& raw_address, uint16_t smp_cmd,
145                                                android::bluetooth::DirectionEnum direction,
146                                                uint16_t smp_fail_reason) {
147   inc_func_call_count(__func__);
148   test::mock::main_shim_metrics_api::LogMetricSmpPairingEvent(raw_address, smp_cmd, direction,
149                                                               smp_fail_reason);
150 }
LogMetricLePairingFail(const RawAddress & raw_address,uint8_t failure_reason,bool is_outgoing)151 void bluetooth::shim::LogMetricLePairingFail(const RawAddress& raw_address, uint8_t failure_reason,
152                                              bool is_outgoing) {
153   inc_func_call_count(__func__);
154   test::mock::main_shim_metrics_api::LogMetricLePairingFail(raw_address, failure_reason,
155                                                             is_outgoing);
156 }
LogMetricClassicPairingEvent(const RawAddress & raw_address,uint16_t handle,uint32_t hci_cmd,uint16_t hci_event,uint16_t cmd_status,uint16_t reason_code,int64_t event_value)157 void bluetooth::shim::LogMetricClassicPairingEvent(const RawAddress& raw_address, uint16_t handle,
158                                                    uint32_t hci_cmd, uint16_t hci_event,
159                                                    uint16_t cmd_status, uint16_t reason_code,
160                                                    int64_t event_value) {
161   inc_func_call_count(__func__);
162   test::mock::main_shim_metrics_api::LogMetricClassicPairingEvent(
163           raw_address, handle, hci_cmd, hci_event, cmd_status, reason_code, event_value);
164 }
LogMetricSdpAttribute(const RawAddress & raw_address,uint16_t protocol_uuid,uint16_t attribute_id,size_t attribute_size,const char * attribute_value)165 void bluetooth::shim::LogMetricSdpAttribute(const RawAddress& raw_address, uint16_t protocol_uuid,
166                                             uint16_t attribute_id, size_t attribute_size,
167                                             const char* attribute_value) {
168   inc_func_call_count(__func__);
169   test::mock::main_shim_metrics_api::LogMetricSdpAttribute(raw_address, protocol_uuid, attribute_id,
170                                                            attribute_size, attribute_value);
171 }
LogMetricSocketConnectionState(const RawAddress & raw_address,int port,int type,android::bluetooth::SocketConnectionstateEnum connection_state,int64_t tx_bytes,int64_t rx_bytes,int uid,int server_port,android::bluetooth::SocketRoleEnum socket_role)172 void bluetooth::shim::LogMetricSocketConnectionState(
173         const RawAddress& raw_address, int port, int type,
174         android::bluetooth::SocketConnectionstateEnum connection_state, int64_t tx_bytes,
175         int64_t rx_bytes, int uid, int server_port,
176         android::bluetooth::SocketRoleEnum socket_role) {
177   inc_func_call_count(__func__);
178   test::mock::main_shim_metrics_api::LogMetricSocketConnectionState(
179           raw_address, port, type, connection_state, tx_bytes, rx_bytes, uid, server_port,
180           socket_role);
181 }
LogMetricManufacturerInfo(const RawAddress & raw_address,android::bluetooth::AddressTypeEnum address_type,android::bluetooth::DeviceInfoSrcEnum source_type,const std::string & source_name,const std::string & manufacturer,const std::string & model,const std::string & hardware_version,const std::string & software_version)182 void bluetooth::shim::LogMetricManufacturerInfo(
183         const RawAddress& raw_address, android::bluetooth::AddressTypeEnum address_type,
184         android::bluetooth::DeviceInfoSrcEnum source_type, const std::string& source_name,
185         const std::string& manufacturer, const std::string& model,
186         const std::string& hardware_version, const std::string& software_version) {
187   inc_func_call_count(__func__);
188   test::mock::main_shim_metrics_api::LogMetricManufacturerInfo(
189           raw_address, address_type, source_type, source_name, manufacturer, model,
190           hardware_version, software_version);
191 }
CountCounterMetrics(int32_t,int64_t)192 bool bluetooth::shim::CountCounterMetrics(int32_t /* key */, int64_t /* count */) {
193   inc_func_call_count(__func__);
194   return false;
195 }
LogMetricLeConnectionStatus(bluetooth::hci::Address address,bool is_connect,bluetooth::hci::ErrorCode reason)196 void bluetooth::shim::LogMetricLeConnectionStatus(bluetooth::hci::Address address, bool is_connect,
197                                                   bluetooth::hci::ErrorCode reason) {
198   inc_func_call_count(__func__);
199   test::mock::main_shim_metrics_api::LogMetricLeConnectionStatus(address, is_connect, reason);
200 }
LogMetricLeDeviceInAcceptList(bluetooth::hci::Address address,bool is_add)201 void bluetooth::shim::LogMetricLeDeviceInAcceptList(bluetooth::hci::Address address, bool is_add) {
202   inc_func_call_count(__func__);
203   test::mock::main_shim_metrics_api::LogMetricLeDeviceInAcceptList(address, is_add);
204 }
LogMetricLeConnectionLifecycle(bluetooth::hci::Address address,bool is_connect,bool is_direct)205 void bluetooth::shim::LogMetricLeConnectionLifecycle(bluetooth::hci::Address address,
206                                                      bool is_connect, bool is_direct) {
207   inc_func_call_count(__func__);
208   test::mock::main_shim_metrics_api::LogMetricLeConnectionLifecycle(address, is_connect, is_direct);
209 }
210 // END mockcify generation
211