author | harlekin <harlekin> | 2002-07-22 21:39:08 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-22 21:39:08 (UTC) |
commit | 0433711d6f7190073c476a2f771dfce879ef87e5 (patch) (side-by-side diff) | |
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 @@ + +#ifndef OPIETOOTH_RFCOMM_HELPER_H +#define OPIETOOTH_RFCOMM_HELPER_H + +#include <sys/types.h> + +#include <qcstring.h> +#include <qstring.h> + +namespace OpieTooth { + /** + * RfCommHelper helps to attach to a remote + * channel of a bt device. + * It uses the commandline tool rfcomm fo the job + * it tries to attach to afree node and either succeeds + * or fails. + * Later RfCommHelper can be used to detach the device + * from the remote device + */ + class RfCommHelper { + public: + /** + * c'tor + */ + RfCommHelper(); + + /** + * d'tor removes the device + */ + ~RfCommHelper(); // kills the process + + /** + * gives the device name of the attached device + */ + QCString attachedDevice() const; + + /** + * detach a device + * kills the rfcomm process + */ + void detach(); + + /** + * tries to connect to a remote device + * @param bd_addr the bluetooth address + * @param port The port of the remote device + */ + bool attach(const QString& bd_addr, int port ); + + /** + * If the original user of the bond exists + * it may regroup the rfcomm process + */ + void regroup(); + private: + bool connect( int dev, const QString& bdaddr, int port ); + static void signal_handler(int); + void setupComChild(); + bool m_connected:1; + static pid_t m_pid; + QCString m_device; + int m_fd[2]; + int m_in2out[2]; + int m_out2in[2]; + static bool terminate ; + }; +}; + +#endif |