author | harlekin <harlekin> | 2002-07-22 21:39:08 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-22 21:39:08 (UTC) |
commit | 0433711d6f7190073c476a2f771dfce879ef87e5 (patch) (unidiff) | |
tree | 1f7e1f90aefd9e96ec2011b98baff3524d9e787d /noncore/net/opietooth/manager/rfcommhelper.h | |
parent | 41182706349e2ab92afbb7a5cc635e672cccf065 (diff) | |
download | opie-0433711d6f7190073c476a2f771dfce879ef87e5.zip opie-0433711d6f7190073c476a2f771dfce879ef87e5.tar.gz opie-0433711d6f7190073c476a2f771dfce879ef87e5.tar.bz2 |
wrapper arround rfcomm command line tool
Diffstat (limited to 'noncore/net/opietooth/manager/rfcommhelper.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/rfcommhelper.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/noncore/net/opietooth/manager/rfcommhelper.h b/noncore/net/opietooth/manager/rfcommhelper.h new file mode 100644 index 0000000..545998c --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommhelper.h | |||
@@ -0,0 +1,69 @@ | |||
1 | |||
2 | #ifndef OPIETOOTH_RFCOMM_HELPER_H | ||
3 | #define OPIETOOTH_RFCOMM_HELPER_H | ||
4 | |||
5 | #include <sys/types.h> | ||
6 | |||
7 | #include <qcstring.h> | ||
8 | #include <qstring.h> | ||
9 | |||
10 | namespace OpieTooth { | ||
11 | /** | ||
12 | * RfCommHelper helps to attach to a remote | ||
13 | * channel of a bt device. | ||
14 | * It uses the commandline tool rfcomm fo the job | ||
15 | * it tries to attach to afree node and either succeeds | ||
16 | * or fails. | ||
17 | * Later RfCommHelper can be used to detach the device | ||
18 | * from the remote device | ||
19 | */ | ||
20 | class RfCommHelper { | ||
21 | public: | ||
22 | /** | ||
23 | * c'tor | ||
24 | */ | ||
25 | RfCommHelper(); | ||
26 | |||
27 | /** | ||
28 | * d'tor removes the device | ||
29 | */ | ||
30 | ~RfCommHelper(); // kills the process | ||
31 | |||
32 | /** | ||
33 | * gives the device name of the attached device | ||
34 | */ | ||
35 | QCString attachedDevice() const; | ||
36 | |||
37 | /** | ||
38 | * detach a device | ||
39 | * kills the rfcomm process | ||
40 | */ | ||
41 | void detach(); | ||
42 | |||
43 | /** | ||
44 | * tries to connect to a remote device | ||
45 | * @param bd_addr the bluetooth address | ||
46 | * @param port The port of the remote device | ||
47 | */ | ||
48 | bool attach(const QString& bd_addr, int port ); | ||
49 | |||
50 | /** | ||
51 | * If the original user of the bond exists | ||
52 | * it may regroup the rfcomm process | ||
53 | */ | ||
54 | void regroup(); | ||
55 | private: | ||
56 | bool connect( int dev, const QString& bdaddr, int port ); | ||
57 | static void signal_handler(int); | ||
58 | void setupComChild(); | ||
59 | bool m_connected:1; | ||
60 | static pid_t m_pid; | ||
61 | QCString m_device; | ||
62 | int m_fd[2]; | ||
63 | int m_in2out[2]; | ||
64 | int m_out2in[2]; | ||
65 | static bool terminate ; | ||
66 | }; | ||
67 | }; | ||
68 | |||
69 | #endif | ||