1/*
2 * Copyright (C) 2021 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 OHOS_RIL_H
17#define OHOS_RIL_H
18
19#include <sys/time.h>
20
21#include "hril_vendor_call_defs.h"
22#include "hril_vendor_data_defs.h"
23#include "hril_vendor_modem_defs.h"
24#include "hril_vendor_network_defs.h"
25#include "hril_vendor_sim_defs.h"
26#include "hril_vendor_sms_defs.h"
27
28#define MAX_CMD_LENGTH 500
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34typedef struct {
35    HRilLastCallErrorCode errorCode; /* Execution command causes the TA to return one or more lines of information
36                                      * text <report>, determined by the ME manufacturer, which should offer
37                                      * the user of the TA an extended report of the reason for
38                                      * the failure in the last unsuccessful call setup (originating or answering) or
39                                      * in call modification;
40                                      * the last call release;
41                                      * the last unsuccessful GPRS attach or unsuccessful PDP context activation;
42                                      * the last GPRS detach or PDP context deactivation. */
43    char *vendorError; /* Error codes of vendor. */
44} HRilLastCallErrorCodeInfo;
45
46typedef void (*HRilCallbackFun)(uint8_t *param);
47
48struct HRilReport {
49    void (*OnCallReport)(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *data, size_t dataLen);
50    void (*OnDataReport)(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *data, size_t dataLen);
51    void (*OnModemReport)(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *data, size_t dataLen);
52    void (*OnNetworkReport)(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *data, size_t dataLen);
53    void (*OnSimReport)(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *data, size_t dataLen);
54    void (*OnSmsReport)(int32_t slotId, struct ReportInfo reportInfo, const uint8_t *data, size_t dataLen);
55    void (*OnTimerCallback)(HRilCallbackFun func, uint8_t *param, const struct timeval *tv);
56};
57
58typedef struct {
59    int32_t version;
60    const HRilCallReq *callOps;
61    const HRilSimReq *simOps;
62    const HRilSmsReq *smsOps;
63    const HRilDataReq *dataOps;
64    const HRilNetworkReq *networkOps;
65    const HRilModemReq *modemOps;
66} HRilOps;
67
68const HRilOps *RilInitOps(const struct HRilReport *reportOps);
69#ifdef __cplusplus
70}
71#endif
72#endif // OHOS_HRIL_H