Amit Mahajan | cd77a5b | 2016-08-25 11:19:21 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2016 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 | #ifndef ANDROID_RIL_INTERNAL_H |
| 18 | #define ANDROID_RIL_INTERNAL_H |
| 19 | |
| 20 | #include <binder/Parcel.h> |
| 21 | |
| 22 | namespace android { |
| 23 | |
| 24 | #define SOCKET_NAME_RIL "rild" |
| 25 | #define SOCKET2_NAME_RIL "rild2" |
| 26 | #define SOCKET3_NAME_RIL "rild3" |
| 27 | #define SOCKET4_NAME_RIL "rild4" |
| 28 | |
| 29 | /* Constants for response types */ |
| 30 | #define RESPONSE_SOLICITED 0 |
| 31 | #define RESPONSE_UNSOLICITED 1 |
| 32 | #define RESPONSE_SOLICITED_ACK 2 |
| 33 | #define RESPONSE_SOLICITED_ACK_EXP 3 |
| 34 | #define RESPONSE_UNSOLICITED_ACK_EXP 4 |
| 35 | |
| 36 | typedef struct CommandInfo CommandInfo; |
| 37 | |
| 38 | extern "C" const char * requestToString(int request); |
| 39 | |
| 40 | typedef struct RequestInfo { |
| 41 | int32_t token; //this is not RIL_Token |
| 42 | CommandInfo *pCI; |
| 43 | struct RequestInfo *p_next; |
| 44 | char cancelled; |
| 45 | char local; // responses to local commands do not go back to command process |
| 46 | RIL_SOCKET_ID socket_id; |
| 47 | int wasAckSent; // Indicates whether an ack was sent earlier |
| 48 | } RequestInfo; |
| 49 | |
| 50 | typedef struct CommandInfo { |
| 51 | int requestNumber; |
| 52 | // todo: remove |
| 53 | void (*dispatchFunction) (Parcel &p, struct RequestInfo *pRI); |
| 54 | // todo: change parcel to serial |
| 55 | int(*responseFunction) (Parcel &p, int slotId, int requestNumber, int responseType, int token, |
| 56 | RIL_Errno e, void *response, size_t responselen); |
| 57 | } CommandInfo; |
| 58 | |
| 59 | int addRequestToList(RequestInfo *pRI, int request, int token, RIL_SOCKET_ID socket_id); |
| 60 | |
| 61 | char * RIL_getRilSocketName(); |
| 62 | |
| 63 | } // namespace android |
| 64 | |
| 65 | #endif //ANDROID_RIL_INTERNAL_H |