summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp
index e1c2341..5676e4f 100644
--- a/noncore/net/opietooth/applet/bluezapplet.cpp
+++ b/noncore/net/opietooth/applet/bluezapplet.cpp
@@ -67,96 +67,100 @@ namespace OpieTooth {
67 bluezactive = false; 67 bluezactive = false;
68 bluezDiscoveryActive = false; 68 bluezDiscoveryActive = false;
69 69
70 // TODO: determine whether this channel has to be closed at destruction time. 70 // TODO: determine whether this channel has to be closed at destruction time.
71 QCopChannel* chan = new QCopChannel("QPE/Bluetooth", this ); 71 QCopChannel* chan = new QCopChannel("QPE/Bluetooth", this );
72 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 72 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
73 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) ); 73 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) );
74 } 74 }
75 75
76 BluezApplet::~BluezApplet() { 76 BluezApplet::~BluezApplet() {
77 if ( btDevice ) { 77 if ( btDevice ) {
78 delete btDevice; 78 delete btDevice;
79 } 79 }
80 if ( btManager ) { 80 if ( btManager ) {
81 delete btManager; 81 delete btManager;
82 } 82 }
83 } 83 }
84 84
85int BluezApplet::position() 85int BluezApplet::position()
86{ 86{
87 return 6; 87 return 6;
88} 88}
89 89
90 90
91 bool BluezApplet::checkBluezStatus() { 91 bool BluezApplet::checkBluezStatus() {
92 if (btDevice) { 92 if (btDevice) {
93 if (btDevice->isLoaded() ) { 93 if (btDevice->isLoaded() ) {
94 return true; 94 return true;
95 } else { 95 } else {
96 return false; 96 return false;
97 } 97 }
98 } else { 98 } else {
99 return false; 99 return false;
100 } 100 }
101 } 101 }
102 102
103 int BluezApplet::setBluezStatus(int c) { 103 int BluezApplet::setBluezStatus(int c) {
104 104
105 if ( c == 1 ) { 105 if ( c == 1 ) {
106 switch ( ODevice::inst()->model() ) { 106 switch ( ODevice::inst()->model() ) {
107 case Model_iPAQ_H39xx: 107 case Model_iPAQ_H39xx:
108 btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); 108 btDevice = new Device( "/dev/tts/1", "bcsp", "921600" );
109 break; 109 break;
110 110
111 case Model_iPAQ_H5xxx: 111 case Model_iPAQ_H5xxx:
112 btDevice = new Device( "/dev/tts/1", "any", "921600" ); 112 btDevice = new Device( "/dev/tts/1", "any", "921600" );
113 break; 113 break;
114 114
115 case Model_MyPal_716:
116 btDevice = new Device( "/dev/ttyS1", "bcsp", "921600" );
117 break;
118
115 default: 119 default:
116 btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); 120 btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" );
117 break; 121 break;
118 } 122 }
119 } else { 123 } else {
120 if ( btDevice ) { 124 if ( btDevice ) {
121 delete btDevice; 125 delete btDevice;
122 btDevice = 0; 126 btDevice = 0;
123 } 127 }
124 } 128 }
125 return 0; 129 return 0;
126 } 130 }
127 131
128 int BluezApplet::checkBluezDiscoveryStatus() { 132 int BluezApplet::checkBluezDiscoveryStatus() {
129 return bluezDiscoveryActive; 133 return bluezDiscoveryActive;
130 } 134 }
131 135
132 int BluezApplet::setBluezDiscoveryStatus(int d) { 136 int BluezApplet::setBluezDiscoveryStatus(int d) {
133 return bluezDiscoveryActive=d; 137 return bluezDiscoveryActive=d;
134 } 138 }
135 139
136 // FIXME mbhaynie 140 // FIXME mbhaynie
137 // receiver for QCopChannel("QPE/Bluetooth") messages. 141 // receiver for QCopChannel("QPE/Bluetooth") messages.
138 void BluezApplet::slotMessage( const QCString& str, const QByteArray& ) 142 void BluezApplet::slotMessage( const QCString& str, const QByteArray& )
139 { 143 {
140 if ( str == "enableBluetooth()") { 144 if ( str == "enableBluetooth()") {
141 if (!checkBluezStatus()) { 145 if (!checkBluezStatus()) {
142 setBluezStatus(1); 146 setBluezStatus(1);
143 } 147 }
144 } else if ( str == "disableBluetooth()") { 148 } else if ( str == "disableBluetooth()") {
145 if (checkBluezStatus()) { 149 if (checkBluezStatus()) {
146 // setBluezStatus(0); 150 // setBluezStatus(0);
147 } 151 }
148 } else if ( str == "listDevices()") { 152 } else if ( str == "listDevices()") {
149 if (!btManager) 153 if (!btManager)
150 { 154 {
151 btManager = new Manager("hci0"); 155 btManager = new Manager("hci0");
152 connect( btManager, SIGNAL( foundDevices(const QString&,RemoteDevice::ValueList) ), 156 connect( btManager, SIGNAL( foundDevices(const QString&,RemoteDevice::ValueList) ),
153 this, SLOT( fillList(const QString&,RemoteDevice::ValueList) ) ) ; 157 this, SLOT( fillList(const QString&,RemoteDevice::ValueList) ) ) ;
154 } 158 }
155 159
156 btManager->searchDevices(); 160 btManager->searchDevices();
157 } 161 }
158 } 162 }
159 163
160 // Once the hcitool scan is complete, report back. 164 // Once the hcitool scan is complete, report back.
161 void BluezApplet::fillList(const QString&, RemoteDevice::ValueList deviceList) 165 void BluezApplet::fillList(const QString&, RemoteDevice::ValueList deviceList)
162 { 166 {