blob: 3d27a6810af4af78203de1680a9480abe7c1cc79 [file] [log] [blame]
San Mehatdc266072009-05-06 11:16:52 -07001/*
2 * Copyright (C) 2008 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#ifndef _SUPPLICANTLISTENER_H__
17#define _SUPPLICANTLISTENER_H__
18
19#include <pthread.h>
20
21#include <sysutils/SocketListener.h>
22
23struct wpa_ctrl;
24class Supplicant;
25
26class SupplicantListener: public SocketListener {
27private:
28 struct wpa_ctrl *mMonitor;
29 Supplicant *mSupplicant;
30 pthread_t mThread;
31
32public:
33 SupplicantListener(Supplicant *supplicant, struct wpa_ctrl *monitor);
34 virtual ~SupplicantListener() {}
35 int startListener();
36 int stopListener();
37
38 struct wpa_ctrl *getMonitor() { return mMonitor; }
39 Supplicant *getSupplicant() { return mSupplicant; }
40
41protected:
42 virtual bool onDataAvailable(int socket);
43
44private:
45 static void *threadStart(void *obj);
46};
47
48#endif