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 <string> 27 28 // Original included files, if any 29 // #include <frameworks/proto_logging/stats/enums/bluetooth/le/enums.pb.h> 30 31 #include "os/metrics.h" 32 #include "types/raw_address.h" 33 34 // Mocked compile conditionals, if any 35 namespace test { 36 namespace mock { 37 namespace main_shim_metrics_api { 38 39 // Shared state between mocked functions and tests 40 // Name: LogMetricLinkLayerConnectionEvent 41 // Params: const RawAddress* raw_address, uint32_t connection_handle, 42 // android::bluetooth::DirectionEnum direction, uint16_t link_type, uint32_t 43 // hci_cmd, uint16_t hci_event, uint16_t hci_ble_event, uint16_t cmd_status, 44 // uint16_t reason_code Returns: void 45 struct LogMetricLinkLayerConnectionEvent { 46 std::function<void(const RawAddress* raw_address, uint32_t connection_handle, 47 android::bluetooth::DirectionEnum direction, 48 uint16_t link_type, uint32_t hci_cmd, uint16_t hci_event, 49 uint16_t hci_ble_event, uint16_t cmd_status, 50 uint16_t reason_code)> 51 body{[](const RawAddress* /* raw_address */, 52 uint32_t /* connection_handle */, 53 android::bluetooth::DirectionEnum /* direction */, 54 uint16_t /* link_type */, uint32_t /* hci_cmd */, 55 uint16_t /* hci_event */, uint16_t /* hci_ble_event */, 56 uint16_t /* cmd_status */, uint16_t /* reason_code */) {}}; operatorLogMetricLinkLayerConnectionEvent57 void operator()(const RawAddress* raw_address, uint32_t connection_handle, 58 android::bluetooth::DirectionEnum direction, 59 uint16_t link_type, uint32_t hci_cmd, uint16_t hci_event, 60 uint16_t hci_ble_event, uint16_t cmd_status, 61 uint16_t reason_code) { 62 body(raw_address, connection_handle, direction, link_type, hci_cmd, 63 hci_event, hci_ble_event, cmd_status, reason_code); 64 }; 65 }; 66 extern struct LogMetricLinkLayerConnectionEvent 67 LogMetricLinkLayerConnectionEvent; 68 // Name: LogMetricA2dpAudioUnderrunEvent 69 // Params: const RawAddress& raw_address, uint64_t encoding_interval_millis, int 70 // num_missing_pcm_bytes Returns: void 71 struct LogMetricA2dpAudioUnderrunEvent { 72 std::function<void(const RawAddress& raw_address, 73 uint64_t encoding_interval_millis, 74 int num_missing_pcm_bytes)> 75 body{[](const RawAddress& /* raw_address */, 76 uint64_t /* encoding_interval_millis */, 77 int /* num_missing_pcm_bytes */) {}}; operatorLogMetricA2dpAudioUnderrunEvent78 void operator()(const RawAddress& raw_address, 79 uint64_t encoding_interval_millis, 80 int num_missing_pcm_bytes) { 81 body(raw_address, encoding_interval_millis, num_missing_pcm_bytes); 82 }; 83 }; 84 extern struct LogMetricA2dpAudioUnderrunEvent LogMetricA2dpAudioUnderrunEvent; 85 // Name: LogMetricA2dpAudioOverrunEvent 86 // Params: const RawAddress& raw_address, uint64_t encoding_interval_millis, int 87 // num_dropped_buffers, int num_dropped_encoded_frames, int 88 // num_dropped_encoded_bytes Returns: void 89 struct LogMetricA2dpAudioOverrunEvent { 90 std::function<void(const RawAddress& raw_address, 91 uint64_t encoding_interval_millis, int num_dropped_buffers, 92 int num_dropped_encoded_frames, 93 int num_dropped_encoded_bytes)> 94 body{[](const RawAddress& /* raw_address */, 95 uint64_t /* encoding_interval_millis */, 96 int /* num_dropped_buffers */, 97 int /* num_dropped_encoded_frames */, 98 int /* num_dropped_encoded_bytes */) {}}; operatorLogMetricA2dpAudioOverrunEvent99 void operator()(const RawAddress& raw_address, 100 uint64_t encoding_interval_millis, int num_dropped_buffers, 101 int num_dropped_encoded_frames, 102 int num_dropped_encoded_bytes) { 103 body(raw_address, encoding_interval_millis, num_dropped_buffers, 104 num_dropped_encoded_frames, num_dropped_encoded_bytes); 105 }; 106 }; 107 extern struct LogMetricA2dpAudioOverrunEvent LogMetricA2dpAudioOverrunEvent; 108 // Name: LogMetricA2dpPlaybackEvent 109 // Params: const RawAddress& raw_address, int playback_state, int 110 // audio_coding_mode Returns: void 111 struct LogMetricA2dpPlaybackEvent { 112 std::function<void(const RawAddress& raw_address, int playback_state, 113 int audio_coding_mode)> 114 body{[](const RawAddress& /* raw_address */, int /* playback_state */, 115 int /* audio_coding_mode */) {}}; operatorLogMetricA2dpPlaybackEvent116 void operator()(const RawAddress& raw_address, int playback_state, 117 int audio_coding_mode) { 118 body(raw_address, playback_state, audio_coding_mode); 119 }; 120 }; 121 extern struct LogMetricA2dpSessionMetricsEvent LogMetricA2dpSessionMetricsEvent; 122 // Name: LogMetricA2dpSessionMetricsEvent 123 // Params: const RawAddress& raw_address, int playback_state, int 124 // audio_coding_mode Returns: void 125 struct LogMetricA2dpSessionMetricsEvent { 126 std::function<void(const RawAddress& raw_address, int64_t audio_duration_ms, 127 int media_timer_min_ms, int media_timer_max_ms, 128 int media_timer_avg_ms, int total_scheduling_count, 129 int buffer_overruns_max_count, int buffer_overruns_total, 130 float buffer_underruns_average, int buffer_underruns_count, 131 int64_t codec_index, bool is_a2dp_offload)> 132 body{[](const RawAddress& /* raw_address */, 133 int64_t /* audio_duration_ms */, int /* media_timer_min_ms */, 134 int /* media_timer_max_ms */, int /* media_timer_avg_ms */, 135 int /* total_scheduling_count */, 136 int /* buffer_overruns_max_count */, 137 int /* buffer_overruns_total */, 138 float /* buffer_underruns_average */, 139 int /* buffer_underruns_count */, int64_t /* codec_index */, 140 bool /* is_a2dp_offload */) {}}; operatorLogMetricA2dpSessionMetricsEvent141 void operator()(const RawAddress& raw_address, int64_t audio_duration_ms, 142 int media_timer_min_ms, int media_timer_max_ms, 143 int /* media_timer_avg_ms */, int total_scheduling_count, 144 int buffer_overruns_max_count, int buffer_overruns_total, 145 float buffer_underruns_average, int buffer_underruns_count, 146 int64_t codec_index, bool is_a2dp_offload) { 147 body(raw_address, audio_duration_ms, media_timer_min_ms, media_timer_max_ms, 148 audio_duration_ms, total_scheduling_count, buffer_overruns_max_count, 149 buffer_overruns_total, buffer_underruns_average, 150 buffer_underruns_count, codec_index, is_a2dp_offload); 151 }; 152 }; 153 extern struct LogMetricA2dpPlaybackEvent LogMetricA2dpPlaybackEvent; 154 // Name: LogMetricHfpPacketLossStats 155 // Params: const RawAddress& raw_address, int num_decoded_frames, double 156 // packet_loss_ratio, uint16_t codec_type Returns: void 157 struct LogMetricHfpPacketLossStats { 158 std::function<void(const RawAddress& raw_address, int num_decoded_frames, 159 double packet_loss_ratio, uint16_t codec_type)> 160 body{[](const RawAddress& /* raw_address */, int /* num_decoded_frames */, 161 double /* packet_loss_ratio */, uint16_t /* codec_type */) {}}; operatorLogMetricHfpPacketLossStats162 void operator()(const RawAddress& raw_address, int num_decoded_frames, 163 double packet_loss_ratio, uint16_t codec_type) { 164 body(raw_address, num_decoded_frames, packet_loss_ratio, codec_type); 165 }; 166 }; 167 extern struct LogMetricHfpPacketLossStats LogMetricHfpPacketLossStats; 168 // Name: LogMetricMmcTranscodeRttStats 169 // Params: int maximum_rtt, double mean_rtt, int num_requests, int codec_type 170 // Return: void 171 struct LogMetricMmcTranscodeRttStats { 172 std::function<void(int maximum_rtt, double mean_rtt, int num_requests, 173 int codec_type)> 174 body{[](int /* maximum_rtt */, double /* mean_rtt */, 175 int /* num_requests */, int /* codec_type */) {}}; operatorLogMetricMmcTranscodeRttStats176 void operator()(int maximum_rtt, double mean_rtt, int num_requests, 177 int codec_type) { 178 body(maximum_rtt, mean_rtt, num_requests, codec_type); 179 }; 180 }; 181 extern struct LogMetricMmcTranscodeRttStats LogMetricMmcTranscodeRttStats; 182 // Name: LogMetricReadRssiResult 183 // Params: const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status, 184 // int8_t rssi Returns: void 185 struct LogMetricReadRssiResult { 186 std::function<void(const RawAddress& raw_address, uint16_t handle, 187 uint32_t cmd_status, int8_t rssi)> 188 body{[](const RawAddress& /* raw_address */, uint16_t /* handle */, 189 uint32_t /* cmd_status */, int8_t /* rssi */) {}}; operatorLogMetricReadRssiResult190 void operator()(const RawAddress& raw_address, uint16_t handle, 191 uint32_t cmd_status, int8_t rssi) { 192 body(raw_address, handle, cmd_status, rssi); 193 }; 194 }; 195 extern struct LogMetricReadRssiResult LogMetricReadRssiResult; 196 // Name: LogMetricReadFailedContactCounterResult 197 // Params: const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status, 198 // int32_t failed_contact_counter Returns: void 199 struct LogMetricReadFailedContactCounterResult { 200 std::function<void(const RawAddress& raw_address, uint16_t handle, 201 uint32_t cmd_status, int32_t failed_contact_counter)> 202 body{[](const RawAddress& /* raw_address */, uint16_t /* handle */, 203 uint32_t /* cmd_status */, 204 int32_t /* failed_contact_counter */) {}}; operatorLogMetricReadFailedContactCounterResult205 void operator()(const RawAddress& raw_address, uint16_t handle, 206 uint32_t cmd_status, int32_t failed_contact_counter) { 207 body(raw_address, handle, cmd_status, failed_contact_counter); 208 }; 209 }; 210 extern struct LogMetricReadFailedContactCounterResult 211 LogMetricReadFailedContactCounterResult; 212 // Name: LogMetricReadTxPowerLevelResult 213 // Params: const RawAddress& raw_address, uint16_t handle, uint32_t cmd_status, 214 // int32_t transmit_power_level Returns: void 215 struct LogMetricReadTxPowerLevelResult { 216 std::function<void(const RawAddress& raw_address, uint16_t handle, 217 uint32_t cmd_status, int32_t transmit_power_level)> 218 body{[](const RawAddress& /* raw_address */, uint16_t /* handle */, 219 uint32_t /* cmd_status */, 220 int32_t /* transmit_power_level */) {}}; operatorLogMetricReadTxPowerLevelResult221 void operator()(const RawAddress& raw_address, uint16_t handle, 222 uint32_t cmd_status, int32_t transmit_power_level) { 223 body(raw_address, handle, cmd_status, transmit_power_level); 224 }; 225 }; 226 extern struct LogMetricReadTxPowerLevelResult LogMetricReadTxPowerLevelResult; 227 // Name: LogMetricSmpPairingEvent 228 // Params: const RawAddress& raw_address, uint16_t smp_cmd, 229 // android::bluetooth::DirectionEnum direction, uint8_t smp_fail_reason Returns: 230 // void 231 struct LogMetricSmpPairingEvent { 232 std::function<void(const RawAddress& raw_address, uint16_t smp_cmd, 233 android::bluetooth::DirectionEnum direction, 234 uint16_t smp_fail_reason)> 235 body{[](const RawAddress& /* raw_address */, uint16_t /* smp_cmd */, 236 android::bluetooth::DirectionEnum /* direction */, 237 uint16_t /* smp_fail_reason */) {}}; operatorLogMetricSmpPairingEvent238 void operator()(const RawAddress& raw_address, uint16_t smp_cmd, 239 android::bluetooth::DirectionEnum direction, 240 uint16_t smp_fail_reason) { 241 body(raw_address, smp_cmd, direction, smp_fail_reason); 242 }; 243 }; 244 extern struct LogMetricSmpPairingEvent LogMetricSmpPairingEvent; 245 // Name: LogMetricClassicPairingEvent 246 // Params: const RawAddress& raw_address, uint16_t handle, uint32_t hci_cmd, 247 // uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code, int64_t 248 // event_value Returns: void 249 struct LogMetricClassicPairingEvent { 250 std::function<void(const RawAddress& raw_address, uint16_t handle, 251 uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status, 252 uint16_t reason_code, int64_t event_value)> 253 body{[](const RawAddress& /* raw_address */, uint16_t /* handle */, 254 uint32_t /* hci_cmd */, uint16_t /* hci_event */, 255 uint16_t /* cmd_status */, uint16_t /* reason_code */, 256 int64_t /* event_value */) {}}; operatorLogMetricClassicPairingEvent257 void operator()(const RawAddress& raw_address, uint16_t handle, 258 uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status, 259 uint16_t reason_code, int64_t event_value) { 260 body(raw_address, handle, hci_cmd, hci_event, cmd_status, reason_code, 261 event_value); 262 }; 263 }; 264 extern struct LogMetricClassicPairingEvent LogMetricClassicPairingEvent; 265 // Name: LogMetricSdpAttribute 266 // Params: const RawAddress& raw_address, uint16_t protocol_uuid, uint16_t 267 // attribute_id, size_t attribute_size, const char* attribute_value Returns: 268 // void 269 struct LogMetricSdpAttribute { 270 std::function<void(const RawAddress& raw_address, uint16_t protocol_uuid, 271 uint16_t attribute_id, size_t attribute_size, 272 const char* attribute_value)> 273 body{[](const RawAddress& /* raw_address */, uint16_t /* protocol_uuid */, 274 uint16_t /* attribute_id */, size_t /* attribute_size */, 275 const char* /* attribute_value */) {}}; operatorLogMetricSdpAttribute276 void operator()(const RawAddress& raw_address, uint16_t protocol_uuid, 277 uint16_t attribute_id, size_t attribute_size, 278 const char* attribute_value) { 279 body(raw_address, protocol_uuid, attribute_id, attribute_size, 280 attribute_value); 281 }; 282 }; 283 extern struct LogMetricSdpAttribute LogMetricSdpAttribute; 284 // Name: LogMetricSocketConnectionState 285 // Params: const RawAddress& raw_address, int port, int type, 286 // android::bluetooth::SocketConnectionstateEnum connection_state, int64_t 287 // tx_bytes, int64_t rx_bytes, int uid, int server_port, 288 // android::bluetooth::SocketRoleEnum socket_role Returns: void 289 struct LogMetricSocketConnectionState { 290 std::function<void( 291 const RawAddress& raw_address, int port, int type, 292 android::bluetooth::SocketConnectionstateEnum connection_state, 293 int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port, 294 android::bluetooth::SocketRoleEnum socket_role)> 295 body{[](const RawAddress& /* raw_address */, int /* port */, 296 int /* type */, 297 android::bluetooth:: 298 SocketConnectionstateEnum /* connection_state */, 299 int64_t /* tx_bytes */, int64_t /* rx_bytes */, int /* uid */, 300 int /* server_port */, 301 android::bluetooth::SocketRoleEnum /* socket_role */) {}}; operatorLogMetricSocketConnectionState302 void operator()( 303 const RawAddress& raw_address, int port, int type, 304 android::bluetooth::SocketConnectionstateEnum connection_state, 305 int64_t tx_bytes, int64_t rx_bytes, int uid, int server_port, 306 android::bluetooth::SocketRoleEnum socket_role) { 307 body(raw_address, port, type, connection_state, tx_bytes, rx_bytes, uid, 308 server_port, socket_role); 309 }; 310 }; 311 extern struct LogMetricSocketConnectionState LogMetricSocketConnectionState; 312 // Name: LogMetricManufacturerInfo 313 // Params: const RawAddress& raw_address, android::bluetooth::DeviceInfoSrcEnum 314 // source_type, const std::string& source_name, const std::string& manufacturer, 315 // const std::string& model, const std::string& hardware_version, const 316 // std::string& software_version Returns: void 317 struct LogMetricManufacturerInfo { 318 std::function<void(const RawAddress& raw_address, 319 android::bluetooth::AddressTypeEnum address_type, 320 android::bluetooth::DeviceInfoSrcEnum source_type, 321 const std::string& source_name, 322 const std::string& manufacturer, const std::string& model, 323 const std::string& hardware_version, 324 const std::string& software_version)> 325 body{[](const RawAddress& /* raw_address */, 326 android::bluetooth::AddressTypeEnum /* address_type */, 327 android::bluetooth::DeviceInfoSrcEnum /* source_type */, 328 const std::string& /* source_name */, 329 const std::string& /* manufacturer */, 330 const std::string& /* model */, 331 const std::string& /* hardware_version */, 332 const std::string& /* software_version */) {}}; operatorLogMetricManufacturerInfo333 void operator()(const RawAddress& raw_address, 334 android::bluetooth::AddressTypeEnum address_type, 335 android::bluetooth::DeviceInfoSrcEnum source_type, 336 const std::string& source_name, 337 const std::string& manufacturer, const std::string& model, 338 const std::string& hardware_version, 339 const std::string& software_version) { 340 body(raw_address, address_type, source_type, source_name, manufacturer, 341 model, hardware_version, software_version); 342 }; 343 }; 344 extern struct LogMetricManufacturerInfo LogMetricManufacturerInfo; 345 346 // Name: LogMetricBluetoothLEConnectionMetricEvent 347 // Params: const RawAddress& raw_address, 348 // android::bluetooth::le::LeConnectionOriginType origin_type, 349 // android::bluetooth::le::LeConnectionType connection_type, 350 // android::bluetooth::le::LeConnectionState transaction_state, 351 // std::vector<std::pair<bluetooth::metrics::ArgumentType, int>> 352 // argument_list 353 struct LogMetricBluetoothLEConnectionMetricEvent { 354 std::function<void( 355 const RawAddress& raw_address, 356 android::bluetooth::le::LeConnectionOriginType origin_type, 357 android::bluetooth::le::LeConnectionType connection_type, 358 android::bluetooth::le::LeConnectionState transaction_state, 359 std::vector<std::pair<bluetooth::os::ArgumentType, int>> argument_list)> 360 body{[](const RawAddress& /* raw_address */, 361 android::bluetooth::le::LeConnectionOriginType /* origin_type */, 362 android::bluetooth::le::LeConnectionType /* connection_type */, 363 android::bluetooth::le::LeConnectionState 364 /* transaction_state */, 365 std::vector<std::pair<bluetooth::os::ArgumentType, int>> 366 /* argument_list */) {}}; operatorLogMetricBluetoothLEConnectionMetricEvent367 void operator()( 368 const RawAddress& raw_address, 369 android::bluetooth::le::LeConnectionOriginType origin_type, 370 android::bluetooth::le::LeConnectionType connection_type, 371 android::bluetooth::le::LeConnectionState transaction_state, 372 std::vector<std::pair<bluetooth::os::ArgumentType, int>> 373 argument_list) { 374 body(raw_address, origin_type, connection_type, transaction_state, 375 argument_list); 376 }; 377 }; 378 379 } // namespace main_shim_metrics_api 380 } // namespace mock 381 } // namespace test 382 383 // END mockcify generation 384