blob: dab70cc22282cf327ad379758672f1970fa7af7e [file] [log] [blame]
Tomasz Wasilczyk9ddc87f2021-10-25 20:20:49 -07001/*
2 * Copyright (C) 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#include <libradiocompat/RadioResponse.h>
18
19#include "debug.h"
20
Tomasz Wasilczyk9ddc87f2021-10-25 20:20:49 -070021#define RADIO_MODULE "Common"
22
23namespace android::hardware::radio::compat {
24
Sarah Chine98dd0e2021-12-09 00:33:37 -080025RadioResponse::RadioResponse(std::shared_ptr<DriverContext> context) : mContext(context) {}
26
Tomasz Wasilczyk9ddc87f2021-10-25 20:20:49 -070027Return<void> RadioResponse::acknowledgeRequest(int32_t serial) {
28 LOG_CALL << serial;
Tomasz Wasilczyk9c922972022-01-05 13:05:41 -080029 /* We send ACKs to all callbacks instead of the one requested it to make implementation simpler.
30 * If it turns out to be a problem, we would have to track where serials come from and make sure
31 * this tracking data (e.g. a map) doesn't grow indefinitely.
32 */
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080033 if (mDataCb) mDataCb.get()->acknowledgeRequest(serial);
34 if (mMessagingCb) mMessagingCb.get()->acknowledgeRequest(serial);
35 if (mModemCb) mModemCb.get()->acknowledgeRequest(serial);
36 if (mNetworkCb) mNetworkCb.get()->acknowledgeRequest(serial);
37 if (mSimCb) mSimCb.get()->acknowledgeRequest(serial);
38 if (mVoiceCb) mVoiceCb.get()->acknowledgeRequest(serial);
Tomasz Wasilczyk9ddc87f2021-10-25 20:20:49 -070039 return {};
40}
41
Tomasz Wasilczyk9ddc87f2021-10-25 20:20:49 -070042} // namespace android::hardware::radio::compat