From 0433711d6f7190073c476a2f771dfce879ef87e5 Mon Sep 17 00:00:00 2001 From: harlekin Date: Mon, 22 Jul 2002 21:39:08 +0000 Subject: wrapper arround rfcomm command line tool --- (limited to 'noncore/net/opietooth/manager/rfcommhelper.h') 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 + +#include +#include + +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 -- cgit v0.9.0.2