• 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 // Original included files, if any
30 // NOTE: Since this is a mock file with mock definitions some number of
31 //       include files may not be required.  The include-what-you-use
32 //       still applies, but crafting proper inclusion is out of scope
33 //       for this effort.  This compilation unit may compile as-is, or
34 //       may need attention to prune the inclusion set.
35 #include "gd/hci/address.h"
36 #include "main/shim/helpers.h"
37 #include "types/raw_address.h"
38 
39 // Mock include file to share data between tests and mock
40 #include "test/mock/mock_main_shim_metrics_api.h"
41 
42 // Mocked compile conditionals, if any
43 #ifndef UNUSED_ATTR
44 #define UNUSED_ATTR
45 #endif
46 
47 // Mocked internal structures, if any
48 
49 namespace test {
50 namespace mock {
51 namespace main_shim_metrics_api {
52 
53 // Function state capture and return values, if needed
54 struct LogMetricLinkLayerConnectionEvent LogMetricLinkLayerConnectionEvent;
55 struct LogMetricA2dpAudioUnderrunEvent LogMetricA2dpAudioUnderrunEvent;
56 struct LogMetricA2dpAudioOverrunEvent LogMetricA2dpAudioOverrunEvent;
57 struct LogMetricA2dpPlaybackEvent LogMetricA2dpPlaybackEvent;
58 struct LogMetricHfpPacketLossStats LogMetricHfpPacketLossStats;
59 struct LogMetricReadRssiResult LogMetricReadRssiResult;
60 struct LogMetricReadFailedContactCounterResult
61     LogMetricReadFailedContactCounterResult;
62 struct LogMetricReadTxPowerLevelResult LogMetricReadTxPowerLevelResult;
63 struct LogMetricSmpPairingEvent LogMetricSmpPairingEvent;
64 struct LogMetricClassicPairingEvent LogMetricClassicPairingEvent;
65 struct LogMetricSdpAttribute LogMetricSdpAttribute;
66 struct LogMetricSocketConnectionState LogMetricSocketConnectionState;
67 struct LogMetricManufacturerInfo LogMetricManufacturerInfo;
68 
69 }  // namespace main_shim_metrics_api
70 }  // namespace mock
71 }  // namespace test
72 
73 // 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)74 void bluetooth::shim::LogMetricLinkLayerConnectionEvent(
75     const RawAddress* raw_address, uint32_t connection_handle,
76     android::bluetooth::DirectionEnum direction, uint16_t link_type,
77     uint32_t hci_cmd, uint16_t hci_event, uint16_t hci_ble_event,
78     uint16_t cmd_status, uint16_t reason_code) {
79   inc_func_call_count(__func__);
80   test::mock::main_shim_metrics_api::LogMetricLinkLayerConnectionEvent(
81       raw_address, connection_handle, direction, link_type, hci_cmd, hci_event,
82       hci_ble_event, cmd_status, reason_code);
83 }
LogMetricA2dpAudioUnderrunEvent(const RawAddress & raw_address,uint64_t encoding_interval_millis,int num_missing_pcm_bytes)84 void bluetooth::shim::LogMetricA2dpAudioUnderrunEvent(
85     const RawAddress& raw_address, uint64_t encoding_interval_millis,
86     int num_missing_pcm_bytes) {
87   inc_func_call_count(__func__);
88   test::mock::main_shim_metrics_api::LogMetricA2dpAudioUnderrunEvent(
89       raw_address, encoding_interval_millis, num_missing_pcm_bytes);
90 }
LogMetricA2dpAudioOverrunEvent(const RawAddress & raw_address,uint64_t encoding_interval_millis,int num_dropped_buffers,int num_dropped_encoded_frames,int num_dropped_encoded_bytes)91 void bluetooth::shim::LogMetricA2dpAudioOverrunEvent(
92     const RawAddress& raw_address, uint64_t encoding_interval_millis,
93     int num_dropped_buffers, int num_dropped_encoded_frames,
94     int num_dropped_encoded_bytes) {
95   inc_func_call_count(__func__);
96   test::mock::main_shim_metrics_api::LogMetricA2dpAudioOverrunEvent(
97       raw_address, encoding_interval_millis, num_dropped_buffers,
98       num_dropped_encoded_frames, num_dropped_encoded_bytes);
99 }
LogMetricA2dpPlaybackEvent(const RawAddress & raw_address,int playback_state,int audio_coding_mode)100 void bluetooth::shim::LogMetricA2dpPlaybackEvent(const RawAddress& raw_address,
101                                                  int playback_state,
102                                                  int audio_coding_mode) {
103   inc_func_call_count(__func__);
104   test::mock::main_shim_metrics_api::LogMetricA2dpPlaybackEvent(
105       raw_address, playback_state, audio_coding_mode);
106 }
LogMetricHfpPacketLossStats(const RawAddress & raw_address,int num_decoded_frames,double packet_loss_ratio)107 void bluetooth::shim::LogMetricHfpPacketLossStats(const RawAddress& raw_address,
108                                                   int num_decoded_frames,
109                                                   double packet_loss_ratio) {
110   inc_func_call_count(__func__);
111   test::mock::main_shim_metrics_api::LogMetricHfpPacketLossStats(
112       raw_address, num_decoded_frames, packet_loss_ratio);
113 }
LogMetricReadRssiResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int8_t rssi)114 void bluetooth::shim::LogMetricReadRssiResult(const RawAddress& raw_address,
115                                               uint16_t handle,
116                                               uint32_t cmd_status,
117                                               int8_t rssi) {
118   inc_func_call_count(__func__);
119   test::mock::main_shim_metrics_api::LogMetricReadRssiResult(
120       raw_address, handle, cmd_status, rssi);
121 }
LogMetricReadFailedContactCounterResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int32_t failed_contact_counter)122 void bluetooth::shim::LogMetricReadFailedContactCounterResult(
123     const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
124     int32_t failed_contact_counter) {
125   inc_func_call_count(__func__);
126   test::mock::main_shim_metrics_api::LogMetricReadFailedContactCounterResult(
127       raw_address, handle, cmd_status, failed_contact_counter);
128 }
LogMetricReadTxPowerLevelResult(const RawAddress & raw_address,uint16_t handle,uint32_t cmd_status,int32_t transmit_power_level)129 void bluetooth::shim::LogMetricReadTxPowerLevelResult(
130     const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status,
131     int32_t transmit_power_level) {
132   inc_func_call_count(__func__);
133   test::mock::main_shim_metrics_api::LogMetricReadTxPowerLevelResult(
134       raw_address, handle, cmd_status, transmit_power_level);
135 }
LogMetricSmpPairingEvent(const RawAddress & raw_address,uint16_t smp_cmd,android::bluetooth::DirectionEnum direction,uint16_t smp_fail_reason)136 void bluetooth::shim::LogMetricSmpPairingEvent(
137     const RawAddress& raw_address, uint16_t smp_cmd,
138     android::bluetooth::DirectionEnum direction, uint16_t smp_fail_reason) {
139   inc_func_call_count(__func__);
140   test::mock::main_shim_metrics_api::LogMetricSmpPairingEvent(
141       raw_address, smp_cmd, direction, smp_fail_reason);
142 }
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)143 void bluetooth::shim::LogMetricClassicPairingEvent(
144     const RawAddress& raw_address, uint16_t handle, uint32_t hci_cmd,
145     uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code,
146     int64_t event_value) {
147   inc_func_call_count(__func__);
148   test::mock::main_shim_metrics_api::LogMetricClassicPairingEvent(
149       raw_address, handle, hci_cmd, hci_event, cmd_status, reason_code,
150       event_value);
151 }
LogMetricSdpAttribute(const RawAddress & raw_address,uint16_t protocol_uuid,uint16_t attribute_id,size_t attribute_size,const char * attribute_value)152 void bluetooth::shim::LogMetricSdpAttribute(const RawAddress& raw_address,
153                                             uint16_t protocol_uuid,
154                                             uint16_t attribute_id,
155                                             size_t attribute_size,
156                                             const char* attribute_value) {
157   inc_func_call_count(__func__);
158   test::mock::main_shim_metrics_api::LogMetricSdpAttribute(
159       raw_address, protocol_uuid, attribute_id, attribute_size,
160       attribute_value);
161 }
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)162 void bluetooth::shim::LogMetricSocketConnectionState(
163     const RawAddress& raw_address, int port, int type,
164     android::bluetooth::SocketConnectionstateEnum connection_state,
165     int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port,
166     android::bluetooth::SocketRoleEnum socket_role) {
167   inc_func_call_count(__func__);
168   test::mock::main_shim_metrics_api::LogMetricSocketConnectionState(
169       raw_address, port, type, connection_state, tx_bytes, rx_bytes, uid,
170       server_port, socket_role);
171 }
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)172 void bluetooth::shim::LogMetricManufacturerInfo(
173     const RawAddress& raw_address,
174     android::bluetooth::AddressTypeEnum address_type,
175     android::bluetooth::DeviceInfoSrcEnum source_type,
176     const std::string& source_name, const std::string& manufacturer,
177     const std::string& model, const std::string& hardware_version,
178     const std::string& software_version) {
179   inc_func_call_count(__func__);
180   test::mock::main_shim_metrics_api::LogMetricManufacturerInfo(
181       raw_address, address_type, source_type, source_name, manufacturer, model,
182       hardware_version, software_version);
183 }
CountCounterMetrics(int32_t key,int64_t count)184 bool bluetooth::shim::CountCounterMetrics(int32_t key, int64_t count) {
185   inc_func_call_count(__func__);
186   return false;
187 
188 }
LogMetricBluetoothLEConnectionMetricEvent(const RawAddress & raw_address,android::bluetooth::le::LeConnectionOriginType origin_type,android::bluetooth::le::LeConnectionType connection_type,android::bluetooth::le::LeConnectionState transaction_state,std::vector<std::pair<bluetooth::os::ArgumentType,int>> argument_list)189 void bluetooth::shim::LogMetricBluetoothLEConnectionMetricEvent(
190     const RawAddress& raw_address,
191     android::bluetooth::le::LeConnectionOriginType origin_type,
192     android::bluetooth::le::LeConnectionType connection_type,
193     android::bluetooth::le::LeConnectionState transaction_state,
194     std::vector<std::pair<bluetooth::os::ArgumentType, int>> argument_list) {
195   inc_func_call_count(__func__);
196   // test::mock::main_shim_metrics_api::LogMetricBluetoothLEConnectionMetricEvent(raw_address, origin_type, connection_type, transaction_state, argument_list);
197 }
198 
199 // END mockcify generation
200