Dheeraj Shetty | cc23101 | 2014-07-02 21:27:57 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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 RIL_SOCKET_H_INCLUDED |
| 18 | #define RIL_SOCKET_H_INCLUDED |
Colin Cross | b9e88c8 | 2015-12-16 14:15:42 -0800 | [diff] [blame] | 19 | #include <libril/ril_ex.h> |
Dheeraj Shetty | cc23101 | 2014-07-02 21:27:57 +0200 | [diff] [blame] | 20 | #include "rilSocketQueue.h" |
| 21 | #include <ril_event.h> |
| 22 | |
Dheeraj Shetty | cc23101 | 2014-07-02 21:27:57 +0200 | [diff] [blame] | 23 | /** |
| 24 | * Abstract socket class representing sockets in rild. |
| 25 | * <p> |
| 26 | * This class performs the following functions : |
| 27 | * <ul> |
| 28 | * <li> Start socket listen. |
| 29 | * <li> Handle socket listen and command callbacks. |
| 30 | * </ul> |
| 31 | */ |
| 32 | class RilSocket { |
| 33 | protected: |
| 34 | |
| 35 | /** |
| 36 | * Socket name. |
| 37 | */ |
| 38 | const char* name; |
| 39 | |
| 40 | /** |
| 41 | * Socket id. |
| 42 | */ |
| 43 | RIL_SOCKET_ID id; |
| 44 | |
Dheeraj Shetty | cc23101 | 2014-07-02 21:27:57 +0200 | [diff] [blame] | 45 | public: |
| 46 | |
| 47 | /** |
| 48 | * Constructor. |
| 49 | * |
| 50 | * @param Socket name. |
| 51 | * @param Socket id. |
| 52 | */ |
| 53 | RilSocket(const char* socketName, RIL_SOCKET_ID socketId) { |
| 54 | name = socketName; |
| 55 | id = socketId; |
| 56 | } |
| 57 | |
| 58 | /** |
Martin Bouchet | 0d4bbaf | 2017-09-23 04:54:37 -0300 | [diff] [blame^] | 59 | * Get socket id. |
Dheeraj Shetty | cc23101 | 2014-07-02 21:27:57 +0200 | [diff] [blame] | 60 | * |
Martin Bouchet | 0d4bbaf | 2017-09-23 04:54:37 -0300 | [diff] [blame^] | 61 | * @return RIL_SOCKET_ID socket id. |
Dheeraj Shetty | cc23101 | 2014-07-02 21:27:57 +0200 | [diff] [blame] | 62 | */ |
Martin Bouchet | 0d4bbaf | 2017-09-23 04:54:37 -0300 | [diff] [blame^] | 63 | RIL_SOCKET_ID getSocketId(void) { |
| 64 | return id; |
| 65 | } |
Dheeraj Shetty | cc23101 | 2014-07-02 21:27:57 +0200 | [diff] [blame] | 66 | |
| 67 | virtual ~RilSocket(){} |
Dheeraj Shetty | cc23101 | 2014-07-02 21:27:57 +0200 | [diff] [blame] | 68 | }; |
| 69 | |
Dheeraj Shetty | cc23101 | 2014-07-02 21:27:57 +0200 | [diff] [blame] | 70 | #endif |