-rw-r--r-- | noncore/net/opietooth/lib/device.cc | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/device.h | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/manager.cc | 3 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/manager.h | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc index 18d26e4..04c50d9 100644 --- a/noncore/net/opietooth/lib/device.cc +++ b/noncore/net/opietooth/lib/device.cc | |||
@@ -1,106 +1,106 @@ | |||
1 | 1 | ||
2 | #include <signal.h> | 2 | #include <signal.h> |
3 | 3 | ||
4 | #include <opie2/oprocess.h> | 4 | #include <opie2/oprocess.h> |
5 | 5 | ||
6 | #include "device.h" | 6 | #include "device.h" |
7 | 7 | ||
8 | using namespace OpieTooth; | 8 | using namespace OpieTooth; |
9 | 9 | ||
10 | using namespace Opie::Core; | 10 | using Opie::Core::OProcess; |
11 | namespace { | 11 | namespace { |
12 | int parsePid( const QCString& par ){ | 12 | int parsePid( const QCString& par ){ |
13 | int id=0; | 13 | int id=0; |
14 | QString string( par ); | 14 | QString string( par ); |
15 | QStringList list = QStringList::split( '\n', string ); | 15 | QStringList list = QStringList::split( '\n', string ); |
16 | for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ | 16 | for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ |
17 | qWarning("parsePID: %s", (*it).latin1() ); | 17 | qWarning("parsePID: %s", (*it).latin1() ); |
18 | if( !(*it).startsWith("CSR") ){ | 18 | if( !(*it).startsWith("CSR") ){ |
19 | id = (*it).toInt(); | 19 | id = (*it).toInt(); |
20 | break; | 20 | break; |
21 | } | 21 | } |
22 | } | 22 | } |
23 | return id; | 23 | return id; |
24 | } | 24 | } |
25 | } | 25 | } |
26 | 26 | ||
27 | Device::Device(const QString &device, const QString &mode, const QString &speed ) | 27 | Device::Device(const QString &device, const QString &mode, const QString &speed ) |
28 | : QObject(0, "device") { | 28 | : QObject(0, "device") { |
29 | 29 | ||
30 | qWarning("OpieTooth::Device create" ); | 30 | qWarning("OpieTooth::Device create" ); |
31 | m_hci = 0; | 31 | m_hci = 0; |
32 | m_process = 0; | 32 | m_process = 0; |
33 | m_attached = false; | 33 | m_attached = false; |
34 | m_device = device; | 34 | m_device = device; |
35 | m_mode = mode; | 35 | m_mode = mode; |
36 | m_speed = speed; | 36 | m_speed = speed; |
37 | attach(); | 37 | attach(); |
38 | } | 38 | } |
39 | Device::~Device(){ | 39 | Device::~Device(){ |
40 | detach(); | 40 | detach(); |
41 | } | 41 | } |
42 | void Device::attach(){ | 42 | void Device::attach(){ |
43 | qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() ); | 43 | qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() ); |
44 | if(m_process == 0 ){ | 44 | if(m_process == 0 ){ |
45 | m_output.resize(0); | 45 | m_output.resize(0); |
46 | qWarning("new process to create" ); | 46 | qWarning("new process to create" ); |
47 | m_process = new OProcess(); | 47 | m_process = new OProcess(); |
48 | *m_process << "hciattach"; | 48 | *m_process << "hciattach"; |
49 | *m_process << "-p"; | 49 | *m_process << "-p"; |
50 | *m_process << m_device << m_mode << m_speed; | 50 | *m_process << m_device << m_mode << m_speed; |
51 | connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ), | 51 | connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ), |
52 | this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); | 52 | this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); |
53 | connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ), | 53 | connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ), |
54 | this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int ) ) ); | 54 | this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int ) ) ); |
55 | connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ), | 55 | connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ), |
56 | this, SLOT(slotStdErr(Opie::Core::OProcess*,char*,int) ) ); | 56 | this, SLOT(slotStdErr(Opie::Core::OProcess*,char*,int) ) ); |
57 | if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ | 57 | if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ |
58 | qWarning("Could not start" ); | 58 | qWarning("Could not start" ); |
59 | delete m_process; | 59 | delete m_process; |
60 | m_process = 0; | 60 | m_process = 0; |
61 | } | 61 | } |
62 | }; | 62 | }; |
63 | } | 63 | } |
64 | void Device::detach(){ | 64 | void Device::detach(){ |
65 | delete m_hci; | 65 | delete m_hci; |
66 | delete m_process; | 66 | delete m_process; |
67 | // kill the pid we got | 67 | // kill the pid we got |
68 | if(m_attached ){ | 68 | if(m_attached ){ |
69 | //kill the pid | 69 | //kill the pid |
70 | qWarning( "killing" ); | 70 | qWarning( "killing" ); |
71 | kill(pid, 9); | 71 | kill(pid, 9); |
72 | } | 72 | } |
73 | qWarning("detached" ); | 73 | qWarning("detached" ); |
74 | } | 74 | } |
75 | bool Device::isLoaded()const{ | 75 | bool Device::isLoaded()const{ |
76 | return m_attached; | 76 | return m_attached; |
77 | } | 77 | } |
78 | QString Device::devName()const { | 78 | QString Device::devName()const { |
79 | return QString::fromLatin1("hci0"); | 79 | return QString::fromLatin1("hci0"); |
80 | }; | 80 | }; |
81 | void Device::slotExited( OProcess* proc) | 81 | void Device::slotExited( OProcess* proc) |
82 | { | 82 | { |
83 | qWarning("prcess exited" ); | 83 | qWarning("prcess exited" ); |
84 | if(proc== m_process ){ | 84 | if(proc== m_process ){ |
85 | qWarning("proc == m_process" ); | 85 | qWarning("proc == m_process" ); |
86 | if( m_process->normalExit() ){ // normal exit | 86 | if( m_process->normalExit() ){ // normal exit |
87 | qWarning("normalExit" ); | 87 | qWarning("normalExit" ); |
88 | int ret = m_process->exitStatus(); | 88 | int ret = m_process->exitStatus(); |
89 | if( ret == 0 ){ // attached | 89 | if( ret == 0 ){ // attached |
90 | qWarning("attached" ); | 90 | qWarning("attached" ); |
91 | qWarning("Output: %s", m_output.data() ); | 91 | qWarning("Output: %s", m_output.data() ); |
92 | pid = parsePid( m_output ); | 92 | pid = parsePid( m_output ); |
93 | qWarning("Pid = %d", pid ); | 93 | qWarning("Pid = %d", pid ); |
94 | // now hciconfig hci0 up ( determine hciX FIXME) | 94 | // now hciconfig hci0 up ( determine hciX FIXME) |
95 | // and call hciconfig hci0 up | 95 | // and call hciconfig hci0 up |
96 | // FIXME hardcoded to hci0 now :( | 96 | // FIXME hardcoded to hci0 now :( |
97 | m_hci = new OProcess( ); | 97 | m_hci = new OProcess( ); |
98 | *m_hci << "hciconfig"; | 98 | *m_hci << "hciconfig"; |
99 | *m_hci << "hci0 up"; | 99 | *m_hci << "hci0 up"; |
100 | connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), | 100 | connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), |
101 | this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); | 101 | this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); |
102 | if(!m_hci->start() ){ | 102 | if(!m_hci->start() ){ |
103 | qWarning("could not start" ); | 103 | qWarning("could not start" ); |
104 | m_attached = false; | 104 | m_attached = false; |
105 | emit device("hci0", false ); | 105 | emit device("hci0", false ); |
106 | } | 106 | } |
diff --git a/noncore/net/opietooth/lib/device.h b/noncore/net/opietooth/lib/device.h index f3339fc..3631c97 100644 --- a/noncore/net/opietooth/lib/device.h +++ b/noncore/net/opietooth/lib/device.h | |||
@@ -1,88 +1,88 @@ | |||
1 | 1 | ||
2 | #ifndef OpieToothDevice_H | 2 | #ifndef OpieToothDevice_H |
3 | #define OpieToothDevice_H | 3 | #define OpieToothDevice_H |
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qvaluelist.h> | 7 | #include <qvaluelist.h> |
8 | 8 | ||
9 | #include <sys/types.h> | 9 | #include <sys/types.h> |
10 | 10 | ||
11 | namespace Opie {namespace Core {class Opie::Core::OProcess;}} | 11 | namespace Opie {namespace Core {class OProcess;}} |
12 | namespace OpieTooth { | 12 | namespace OpieTooth { |
13 | /** | 13 | /** |
14 | * Device takes care of attaching serial | 14 | * Device takes care of attaching serial |
15 | * devices to the blueZ stack. | 15 | * devices to the blueZ stack. |
16 | * After attaching it hciconfig ups it | 16 | * After attaching it hciconfig ups it |
17 | */ | 17 | */ |
18 | class Device : public QObject { | 18 | class Device : public QObject { |
19 | 19 | ||
20 | Q_OBJECT | 20 | Q_OBJECT |
21 | 21 | ||
22 | public: | 22 | public: |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Brings up an device. | 25 | * Brings up an device. |
26 | * Usage example: new Device(/dev/ttySB0, csr) | 26 | * Usage example: new Device(/dev/ttySB0, csr) |
27 | * | 27 | * |
28 | * @param &device QString the device name | 28 | * @param &device QString the device name |
29 | * @param &mode QString the mode | 29 | * @param &mode QString the mode |
30 | * @param &speed QString the speed of the device, can be left blank | 30 | * @param &speed QString the speed of the device, can be left blank |
31 | */ | 31 | */ |
32 | Device(const QString &device, const QString& mode, const QString& speed); | 32 | Device(const QString &device, const QString& mode, const QString& speed); |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * unloads the device | 35 | * unloads the device |
36 | */ | 36 | */ |
37 | ~Device(); | 37 | ~Device(); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * attach the device | 40 | * attach the device |
41 | */ | 41 | */ |
42 | void attach(); | 42 | void attach(); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * detach the device | 45 | * detach the device |
46 | */ | 46 | */ |
47 | void detach(); | 47 | void detach(); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Is the device loaded? | 50 | * Is the device loaded? |
51 | * @return bool, if the device is loaded | 51 | * @return bool, if the device is loaded |
52 | */ | 52 | */ |
53 | bool isLoaded()const; | 53 | bool isLoaded()const; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Returns the device name | 56 | * Returns the device name |
57 | * @return QString, the device name | 57 | * @return QString, the device name |
58 | */ | 58 | */ |
59 | QString devName()const ; // hci0 | 59 | QString devName()const ; // hci0 |
60 | 60 | ||
61 | signals: | 61 | signals: |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Signals devicename and up status | 64 | * Signals devicename and up status |
65 | * @return &device QString, Devicename | 65 | * @return &device QString, Devicename |
66 | * @return up bool, if the device is up or not. | 66 | * @return up bool, if the device is up or not. |
67 | */ | 67 | */ |
68 | void device(const QString& device, bool up ); | 68 | void device(const QString& device, bool up ); |
69 | private slots: | 69 | private slots: |
70 | virtual void slotExited( Opie::Core::OProcess* ); | 70 | virtual void slotExited( Opie::Core::OProcess* ); |
71 | virtual void slotStdOut(Opie::Core::OProcess*, char*, int ); | 71 | virtual void slotStdOut(Opie::Core::OProcess*, char*, int ); |
72 | virtual void slotStdErr(Opie::Core::OProcess*, char*, int ); | 72 | virtual void slotStdErr(Opie::Core::OProcess*, char*, int ); |
73 | private: | 73 | private: |
74 | class Private; | 74 | class Private; |
75 | Private *d; | 75 | Private *d; |
76 | QString m_device; | 76 | QString m_device; |
77 | bool m_attached:1; | 77 | bool m_attached:1; |
78 | Opie::Core::OProcess* m_hci; | 78 | Opie::Core::OProcess* m_hci; |
79 | Opie::Core::OProcess* m_process; | 79 | Opie::Core::OProcess* m_process; |
80 | QString m_devId; | 80 | QString m_devId; |
81 | QString m_mode; | 81 | QString m_mode; |
82 | QString m_speed; | 82 | QString m_speed; |
83 | pid_t pid; | 83 | pid_t pid; |
84 | QCString m_output; | 84 | QCString m_output; |
85 | }; | 85 | }; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | #endif | 88 | #endif |
diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc index 7c9ea5b..18e1df9 100644 --- a/noncore/net/opietooth/lib/manager.cc +++ b/noncore/net/opietooth/lib/manager.cc | |||
@@ -1,108 +1,107 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <opie2/oprocess.h> | 3 | #include <opie2/oprocess.h> |
4 | 4 | ||
5 | #include "parser.h" | 5 | #include "parser.h" |
6 | #include "manager.h" | 6 | #include "manager.h" |
7 | 7 | ||
8 | 8 | ||
9 | using namespace OpieTooth; | 9 | using namespace OpieTooth; |
10 | 10 | ||
11 | using namespace Opie::Core; | 11 | using Opie::Core::OProcess; |
12 | using namespace Opie::Core; | ||
13 | Manager::Manager( const QString& dev ) | 12 | Manager::Manager( const QString& dev ) |
14 | : QObject() | 13 | : QObject() |
15 | { | 14 | { |
16 | qWarning("created"); | 15 | qWarning("created"); |
17 | m_device = dev; | 16 | m_device = dev; |
18 | m_hcitool = 0; | 17 | m_hcitool = 0; |
19 | m_sdp = 0; | 18 | m_sdp = 0; |
20 | } | 19 | } |
21 | Manager::Manager( Device* /*dev*/ ) | 20 | Manager::Manager( Device* /*dev*/ ) |
22 | : QObject() | 21 | : QObject() |
23 | { | 22 | { |
24 | m_hcitool = 0; | 23 | m_hcitool = 0; |
25 | m_sdp = 0; | 24 | m_sdp = 0; |
26 | } | 25 | } |
27 | Manager::Manager() | 26 | Manager::Manager() |
28 | : QObject() | 27 | : QObject() |
29 | { | 28 | { |
30 | m_hcitool = 0; | 29 | m_hcitool = 0; |
31 | m_sdp = 0; | 30 | m_sdp = 0; |
32 | } | 31 | } |
33 | Manager::~Manager(){ | 32 | Manager::~Manager(){ |
34 | delete m_hcitool; | 33 | delete m_hcitool; |
35 | delete m_sdp; | 34 | delete m_sdp; |
36 | } | 35 | } |
37 | void Manager::setDevice( const QString& dev ){ | 36 | void Manager::setDevice( const QString& dev ){ |
38 | m_device = dev; | 37 | m_device = dev; |
39 | } | 38 | } |
40 | void Manager::setDevice( Device* /*dev*/ ){ | 39 | void Manager::setDevice( Device* /*dev*/ ){ |
41 | 40 | ||
42 | } | 41 | } |
43 | void Manager::isAvailable( const QString& device ){ | 42 | void Manager::isAvailable( const QString& device ){ |
44 | OProcess* l2ping = new OProcess(); | 43 | OProcess* l2ping = new OProcess(); |
45 | l2ping->setName( device.latin1() ); | 44 | l2ping->setName( device.latin1() ); |
46 | *l2ping << "l2ping" << "-c1" << device; | 45 | *l2ping << "l2ping" << "-c1" << device; |
47 | connect(l2ping, SIGNAL(processExited(Opie::Core::OProcess* ) ), | 46 | connect(l2ping, SIGNAL(processExited(Opie::Core::OProcess* ) ), |
48 | this, SLOT(slotProcessExited(Opie::Core::OProcess*) ) ); | 47 | this, SLOT(slotProcessExited(Opie::Core::OProcess*) ) ); |
49 | if (!l2ping->start() ) { | 48 | if (!l2ping->start() ) { |
50 | emit available( device, false ); | 49 | emit available( device, false ); |
51 | delete l2ping; | 50 | delete l2ping; |
52 | } | 51 | } |
53 | 52 | ||
54 | } | 53 | } |
55 | 54 | ||
56 | void Manager::isAvailable( Device* /*dev*/ ){ | 55 | void Manager::isAvailable( Device* /*dev*/ ){ |
57 | 56 | ||
58 | 57 | ||
59 | } | 58 | } |
60 | void Manager::searchDevices( const QString& device ){ | 59 | void Manager::searchDevices( const QString& device ){ |
61 | qWarning("search devices"); | 60 | qWarning("search devices"); |
62 | OProcess* hcitool = new OProcess(); | 61 | OProcess* hcitool = new OProcess(); |
63 | hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); | 62 | hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); |
64 | *hcitool << "hcitool" << "scan"; | 63 | *hcitool << "hcitool" << "scan"; |
65 | connect( hcitool, SIGNAL(processExited(Opie::Core::OProcess*) ) , | 64 | connect( hcitool, SIGNAL(processExited(Opie::Core::OProcess*) ) , |
66 | this, SLOT(slotHCIExited(Opie::Core::OProcess* ) ) ); | 65 | this, SLOT(slotHCIExited(Opie::Core::OProcess* ) ) ); |
67 | connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), | 66 | connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), |
68 | this, SLOT(slotHCIOut(Opie::Core::OProcess*, char*, int ) ) ); | 67 | this, SLOT(slotHCIOut(Opie::Core::OProcess*, char*, int ) ) ); |
69 | if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 68 | if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
70 | qWarning("could not start"); | 69 | qWarning("could not start"); |
71 | RemoteDevice::ValueList list; | 70 | RemoteDevice::ValueList list; |
72 | emit foundDevices( device, list ); | 71 | emit foundDevices( device, list ); |
73 | delete hcitool; | 72 | delete hcitool; |
74 | } | 73 | } |
75 | } | 74 | } |
76 | 75 | ||
77 | void Manager::searchDevices(Device* /*d*/ ){ | 76 | void Manager::searchDevices(Device* /*d*/ ){ |
78 | 77 | ||
79 | 78 | ||
80 | } | 79 | } |
81 | void Manager::addService(const QString& name ){ | 80 | void Manager::addService(const QString& name ){ |
82 | OProcess proc; | 81 | OProcess proc; |
83 | proc << "sdptool" << "add" << name; | 82 | proc << "sdptool" << "add" << name; |
84 | bool bo = true; | 83 | bool bo = true; |
85 | if (!proc.start(OProcess::DontCare ) ) | 84 | if (!proc.start(OProcess::DontCare ) ) |
86 | bo = false; | 85 | bo = false; |
87 | emit addedService( name, bo ); | 86 | emit addedService( name, bo ); |
88 | } | 87 | } |
89 | void Manager::addServices(const QStringList& list){ | 88 | void Manager::addServices(const QStringList& list){ |
90 | QStringList::ConstIterator it; | 89 | QStringList::ConstIterator it; |
91 | for (it = list.begin(); it != list.end(); ++it ) | 90 | for (it = list.begin(); it != list.end(); ++it ) |
92 | addService( (*it) ); | 91 | addService( (*it) ); |
93 | } | 92 | } |
94 | void Manager::removeService( const QString& name ){ | 93 | void Manager::removeService( const QString& name ){ |
95 | OProcess prc; | 94 | OProcess prc; |
96 | prc << "sdptool" << "del" << name; | 95 | prc << "sdptool" << "del" << name; |
97 | bool bo = true; | 96 | bool bo = true; |
98 | if (!prc.start(OProcess::DontCare ) ) | 97 | if (!prc.start(OProcess::DontCare ) ) |
99 | bo = false; | 98 | bo = false; |
100 | emit removedService( name, bo ); | 99 | emit removedService( name, bo ); |
101 | } | 100 | } |
102 | void Manager::removeServices( const QStringList& list){ | 101 | void Manager::removeServices( const QStringList& list){ |
103 | QStringList::ConstIterator it; | 102 | QStringList::ConstIterator it; |
104 | for (it = list.begin(); it != list.end(); ++it ) | 103 | for (it = list.begin(); it != list.end(); ++it ) |
105 | removeService( (*it) ); | 104 | removeService( (*it) ); |
106 | } | 105 | } |
107 | void Manager::searchServices( const QString& remDevice ){ | 106 | void Manager::searchServices( const QString& remDevice ){ |
108 | OProcess *m_sdp =new OProcess(); | 107 | OProcess *m_sdp =new OProcess(); |
diff --git a/noncore/net/opietooth/lib/manager.h b/noncore/net/opietooth/lib/manager.h index 9b1c714..930eb56 100644 --- a/noncore/net/opietooth/lib/manager.h +++ b/noncore/net/opietooth/lib/manager.h | |||
@@ -1,110 +1,110 @@ | |||
1 | 1 | ||
2 | #ifndef OpieToothManager_H | 2 | #ifndef OpieToothManager_H |
3 | #define OpieToothManager_H | 3 | #define OpieToothManager_H |
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qmap.h> | 7 | #include <qmap.h> |
8 | #include <qvaluelist.h> | 8 | #include <qvaluelist.h> |
9 | 9 | ||
10 | #include "connection.h" | 10 | #include "connection.h" |
11 | #include "remotedevice.h" | 11 | #include "remotedevice.h" |
12 | #include "services.h" | 12 | #include "services.h" |
13 | 13 | ||
14 | namespace Opie {namespace Core {class Opie::Core::OProcess;}} | 14 | namespace Opie {namespace Core {class OProcess;}} |
15 | namespace OpieTooth { | 15 | namespace OpieTooth { |
16 | class Device; | 16 | class Device; |
17 | /** Manager manages a blueZ device (hci0 for example) | 17 | /** Manager manages a blueZ device (hci0 for example) |
18 | * without Manager you can control the things you | 18 | * without Manager you can control the things you |
19 | * could do from command line in a OO and asynchronus | 19 | * could do from command line in a OO and asynchronus |
20 | * way. | 20 | * way. |
21 | */ | 21 | */ |
22 | class Manager : public QObject { | 22 | class Manager : public QObject { |
23 | Q_OBJECT | 23 | Q_OBJECT |
24 | public: | 24 | public: |
25 | /** c'tor whichs create a new Manager | 25 | /** c'tor whichs create a new Manager |
26 | * @param device is the device to use. Either a mac or blueZ device name | 26 | * @param device is the device to use. Either a mac or blueZ device name |
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | Manager( const QString &device ); | 29 | Manager( const QString &device ); |
30 | 30 | ||
31 | /** c'tor | 31 | /** c'tor |
32 | * @param dev The Device to be managed | 32 | * @param dev The Device to be managed |
33 | * We don't care of Device so you need to delete it | 33 | * We don't care of Device so you need to delete it |
34 | */ | 34 | */ |
35 | Manager( Device* dev ); | 35 | Manager( Device* dev ); |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * c'tor | 38 | * c'tor |
39 | */ | 39 | */ |
40 | Manager(); | 40 | Manager(); |
41 | 41 | ||
42 | ~Manager(); | 42 | ~Manager(); |
43 | 43 | ||
44 | /** Set the manager to control a new device | 44 | /** Set the manager to control a new device |
45 | * @param device the new device to control (hci0 ) | 45 | * @param device the new device to control (hci0 ) |
46 | */ | 46 | */ |
47 | void setDevice( const QString& device ); | 47 | void setDevice( const QString& device ); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Convience functions for setting a new device | 50 | * Convience functions for setting a new device |
51 | */ | 51 | */ |
52 | void setDevice( Device *dev ); | 52 | void setDevice( Device *dev ); |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Wether or not a device is connected. The function | 55 | * Wether or not a device is connected. The function |
56 | * is asynchron | 56 | * is asynchron |
57 | * If device is empty it will take the currently managed | 57 | * If device is empty it will take the currently managed |
58 | * device and see if it's up | 58 | * device and see if it's up |
59 | * for Remote devices it will ping and see. | 59 | * for Remote devices it will ping and see. |
60 | * @param either mac or hciX | 60 | * @param either mac or hciX |
61 | */ | 61 | */ |
62 | void isAvailable(const QString& device= QString::null ); | 62 | void isAvailable(const QString& device= QString::null ); |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * same as above | 65 | * same as above |
66 | */ | 66 | */ |
67 | void isAvailable(Device *dev ); | 67 | void isAvailable(Device *dev ); |
68 | 68 | ||
69 | /** this searchs for devices reachable from the | 69 | /** this searchs for devices reachable from the |
70 | * currently managed device | 70 | * currently managed device |
71 | * or from device if @param device is not empty | 71 | * or from device if @param device is not empty |
72 | */ | 72 | */ |
73 | void searchDevices(const QString& device= QString::null ); | 73 | void searchDevices(const QString& device= QString::null ); |
74 | /** same as above | 74 | /** same as above |
75 | * | 75 | * |
76 | */ | 76 | */ |
77 | void searchDevices(Device *d ); | 77 | void searchDevices(Device *d ); |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * This will add the service @param name | 80 | * This will add the service @param name |
81 | * to the sdpd daemon | 81 | * to the sdpd daemon |
82 | * It will start the daemon if necessary | 82 | * It will start the daemon if necessary |
83 | */ | 83 | */ |
84 | void addService(const QString &name ); | 84 | void addService(const QString &name ); |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * This will add the services @param names | 87 | * This will add the services @param names |
88 | * to the sdpd daemon | 88 | * to the sdpd daemon |
89 | * It will start the daemon if necessary | 89 | * It will start the daemon if necessary |
90 | */ | 90 | */ |
91 | void addServices( const QStringList& names ); | 91 | void addServices( const QStringList& names ); |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * This removes a service from the sdps | 94 | * This removes a service from the sdps |
95 | */ | 95 | */ |
96 | void removeService(const QString &name ); | 96 | void removeService(const QString &name ); |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * Removes a list from the sdpd | 99 | * Removes a list from the sdpd |
100 | */ | 100 | */ |
101 | void removeServices(const QStringList& ); | 101 | void removeServices(const QStringList& ); |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * search for services on a remote device | 104 | * search for services on a remote device |
105 | * | 105 | * |
106 | */ | 106 | */ |
107 | void searchServices( const QString& remDevice ); | 107 | void searchServices( const QString& remDevice ); |
108 | 108 | ||
109 | /** | 109 | /** |
110 | * search for services on a remote device | 110 | * search for services on a remote device |