author | zecke <zecke> | 2004-05-06 19:47:25 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-05-06 19:47:25 (UTC) |
commit | 49588c7322679fe3dadf7aaad058d7df76e0d8d3 (patch) (unidiff) | |
tree | 9428d97efa1167552d17aebf30c3607b30b6b3d8 | |
parent | ac015dbe0a2d7f52139d9efaba16d6e3069c5f2e (diff) | |
download | opie-49588c7322679fe3dadf7aaad058d7df76e0d8d3.zip opie-49588c7322679fe3dadf7aaad058d7df76e0d8d3.tar.gz opie-49588c7322679fe3dadf7aaad058d7df76e0d8d3.tar.bz2 |
Error spotted by Clement with Opie::Core and namespaces
-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,58 +1,58 @@ | |||
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" ); |
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,59 +1,59 @@ | |||
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 |
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,60 +1,59 @@ | |||
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 ){ |
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,62 +1,62 @@ | |||
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 ); |