summaryrefslogtreecommitdiffstats
path: root/kmilo/kmilo_kvaio/kvaiodriverinterface.h
blob: 3e41ac60aacc48ca826b00354c53df999de37e91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
   This file declares the KVaioDrierInterface class.
   It provides an event-oriented wrapper for the kernel sonypi driver. 

   $ Author: Mirko Boehm $
   $ Copyright: (C) 1996-2003, Mirko Boehm $
   $ Contact: mirko@kde.org
         http://www.kde.org
         http://www.hackerbuero.org $
   $ License: LGPL with the following explicit clarification:
         This code may be linked against any version of the TQt toolkit
         from Troll Tech, Norway. $

   $Id$
*/

#ifndef KVAIO_DRIVERINTERFACE_H
#define KVAIO_DRIVERINTERFACE_H

#include <tqobject.h>

class TQTimer;

extern "C"
{
#include <fcntl.h>
#include <sys/select.h>

#include "./sonypi.h"
}

class TQSocketNotifier;

class KVaioDriverInterface : public TQObject
{
    TQ_OBJECT
  
public:
    KVaioDriverInterface(TQObject *parent=0);
    bool connectToDriver(bool listen = true);
    void disconnectFromDriver();
    /** Return the current display brightness, a value between 0 and
        255. Returns -1 if the setting cannot be retrieved. */
    int brightness();
    /** Get the battery status. */
    bool getBatteryStatus(bool& bat1Avail, int& bat1Remaining, int& bat1Max,
			  bool& bat2Avail, int& bat2Remaining, int& bat2Max,
			  bool& acConnected);
public slots:
    /** Set the display brightness. 0<= value <=255. */
    void setBrightness(int);
protected:
    int mFd;
    fd_set mRfds;
    TQSocketNotifier *mNotifier;
signals:
    void vaioEvent(int);
    // void brightnessChanged(int);
protected slots:
    void socketActivated(int);
};

#endif // KVAIO_DRIVERINTERFACE_H