1 /*
2  * Copyright (C) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef TELEPHONY_SATELLITE_CALL_CALLBACK_STUB_H
17 #define TELEPHONY_SATELLITE_CALL_CALLBACK_STUB_H
18 
19 #include <map>
20 
21 #include "cellular_call_data_struct.h"
22 #include "iremote_stub.h"
23 #include "satellite_call_callback_interface.h"
24 #include "satellite_call_callback_ipc_interface_code.h"
25 
26 namespace OHOS {
27 namespace Telephony {
28 class SatelliteCallCallbackStub : public IRemoteStub<SatelliteCallCallbackInterface> {
29 public:
30     SatelliteCallCallbackStub();
31     virtual ~SatelliteCallCallbackStub();
32     int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
33 
34     /****************** call basic ******************/
35     int32_t DialSatelliteResponse(int32_t slotId, const RadioResponseInfo &info) override;
36     int32_t HangUpSatelliteResponse(int32_t slotId, const RadioResponseInfo &info) override;
37     int32_t RejectSatelliteResponse(int32_t slotId, const RadioResponseInfo &info) override;
38     int32_t AnswerSatelliteResponse(int32_t slotId, const RadioResponseInfo &info) override;
39     int32_t CallStateChangeReport(int32_t slotId) override;
40     int32_t GetSatelliteCallsDataResponse(int32_t slotId, const RadioResponseInfo &info) override;
41     int32_t GetSatelliteCallsDataResponse(int32_t slotId, const SatelliteCurrentCallList &callList) override;
42 
43 private:
44     void InitFuncMap();
45     void InitCallBasicFuncMap();
46 
47     /****************** call basic ******************/
48     int32_t OnDialResponseInner(MessageParcel &data, MessageParcel &reply);
49     int32_t OnHangUpResponseInner(MessageParcel &data, MessageParcel &reply);
50     int32_t OnRejectResponseInner(MessageParcel &data, MessageParcel &reply);
51     int32_t OnAnswerResponseInner(MessageParcel &data, MessageParcel &reply);
52     int32_t OnGetSatelliteCallsDataResponseInner(MessageParcel &data, MessageParcel &reply);
53     int32_t OnCallStateChangeReportInner(MessageParcel &data, MessageParcel &reply);
54     int32_t SendEvent(int32_t slotId, int32_t eventId, const RadioResponseInfo &info);
55 
56 private:
57     using RequestFuncType = std::function<int32_t(MessageParcel &data, MessageParcel &reply)>;
58     std::map<uint32_t, RequestFuncType> requestFuncMap_;
59 };
60 } // namespace Telephony
61 } // namespace OHOS
62 
63 #endif // TELEPHONY_SATELLITE_CALL_CALLBACK_STUB_H