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
19 #include <libril/ril_ex.h>
20 #include "rilSocketQueue.h"
21 #include <ril_event.h>
22 
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 
45     public:
46 
47         /**
48          * Constructor.
49          *
50          * @param Socket name.
51          * @param Socket id.
52          */
RilSocket(const char * socketName,RIL_SOCKET_ID socketId)53         RilSocket(const char* socketName, RIL_SOCKET_ID socketId) {
54             name = socketName;
55             id = socketId;
56         }
57 
58         /**
59          * Get socket id.
60          *
61          * @return RIL_SOCKET_ID socket id.
62          */
getSocketId(void)63         RIL_SOCKET_ID getSocketId(void) {
64             return id;
65         }
66 
~RilSocket()67         virtual ~RilSocket(){}
68 };
69 
70 #endif
71