author | erik <erik> | 2007-02-08 01:43:09 (UTC) |
---|---|---|
committer | erik <erik> | 2007-02-08 01:43:09 (UTC) |
commit | 853b61f97e718359bef95147ab3c7beb0705acda (patch) (unidiff) | |
tree | 7b374511f636951a2ab9ff0f9fec7ec2d64abd2a | |
parent | c36a2e25a8875a31957968482ba8a0831a8b0aba (diff) | |
download | opie-853b61f97e718359bef95147ab3c7beb0705acda.zip opie-853b61f97e718359bef95147ab3c7beb0705acda.tar.gz opie-853b61f97e718359bef95147ab3c7beb0705acda.tar.bz2 |
This commit adds support for the HTC Universal bluetooth device to
bluezapplet. This commit is based on a patch submitted by GoXbox Live
<goxboxlive at gmail dot com> to the opie-devel mailing list.
Thanks GoXbox Live!
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 8498afc..787abc6 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp | |||
@@ -93,96 +93,100 @@ namespace OpieTooth { | |||
93 | BluezApplet::~BluezApplet() { | 93 | BluezApplet::~BluezApplet() { |
94 | if ( btDevice ) { | 94 | if ( btDevice ) { |
95 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); | 95 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); |
96 | delete btDevice; | 96 | delete btDevice; |
97 | } | 97 | } |
98 | if ( btManager ) { | 98 | if ( btManager ) { |
99 | delete btManager; | 99 | delete btManager; |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | int BluezApplet::position() | 103 | int BluezApplet::position() |
104 | { | 104 | { |
105 | return 6; | 105 | return 6; |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | bool BluezApplet::checkBluezStatus() { | 109 | bool BluezApplet::checkBluezStatus() { |
110 | if (btDevice) { | 110 | if (btDevice) { |
111 | if (btDevice->isLoaded() ) { | 111 | if (btDevice->isLoaded() ) { |
112 | odebug << "btDevice isLoaded" << oendl; | 112 | odebug << "btDevice isLoaded" << oendl; |
113 | return true; | 113 | return true; |
114 | } else { | 114 | } else { |
115 | odebug << "btDevice is NOT loaded" << oendl; | 115 | odebug << "btDevice is NOT loaded" << oendl; |
116 | return false; | 116 | return false; |
117 | } | 117 | } |
118 | } else { | 118 | } else { |
119 | odebug << "btDevice is ZERO" << oendl; | 119 | odebug << "btDevice is ZERO" << oendl; |
120 | return false; | 120 | return false; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | int BluezApplet::setBluezStatus(int c, bool sync) { | 124 | int BluezApplet::setBluezStatus(int c, bool sync) { |
125 | 125 | ||
126 | if ( c == 1 ) { | 126 | if ( c == 1 ) { |
127 | switch ( ODevice::inst()->model() ) { | 127 | switch ( ODevice::inst()->model() ) { |
128 | case Model_iPAQ_H39xx: | 128 | case Model_iPAQ_H39xx: |
129 | btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); | 129 | btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); |
130 | break; | 130 | break; |
131 | 131 | ||
132 | case Model_iPAQ_H5xxx: | 132 | case Model_iPAQ_H5xxx: |
133 | btDevice = new Device( "/dev/tts/1", "any", "921600" ); | 133 | btDevice = new Device( "/dev/tts/1", "any", "921600" ); |
134 | break; | 134 | break; |
135 | 135 | ||
136 | #if OPIE_VERSION >= 102010 | 136 | #if OPIE_VERSION >= 102010 |
137 | case Model_MyPal_716: | 137 | case Model_MyPal_716: |
138 | btDevice = new Device( "/dev/ttyS1", "bcsp", "921600" ); | 138 | btDevice = new Device( "/dev/ttyS1", "bcsp", "921600" ); |
139 | break; | 139 | break; |
140 | #endif | 140 | #endif |
141 | case Model_HTC_Universal: | ||
142 | btDevice = new Device( "/dev/ttyS1", "texas", "115200" ); | ||
143 | break; | ||
144 | |||
141 | case Model_iPAQ_H22xx: | 145 | case Model_iPAQ_H22xx: |
142 | btDevice = new Device( "/dev/tts/3", "any", "921600" ); | 146 | btDevice = new Device( "/dev/tts/3", "any", "921600" ); |
143 | break; | 147 | break; |
144 | 148 | ||
145 | default: | 149 | default: |
146 | btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); | 150 | btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); |
147 | break; | 151 | break; |
148 | } | 152 | } |
149 | m_sync = sync; | 153 | m_sync = sync; |
150 | connect(btDevice, SIGNAL(device(const QString&, bool)), | 154 | connect(btDevice, SIGNAL(device(const QString&, bool)), |
151 | this, SLOT(slotDevice(const QString&, bool))); | 155 | this, SLOT(slotDevice(const QString&, bool))); |
152 | 156 | ||
153 | } else { | 157 | } else { |
154 | setObexRecieveStatus(0); | 158 | setObexRecieveStatus(0); |
155 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); | 159 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); |
156 | if ( btManager ) { | 160 | if ( btManager ) { |
157 | delete btManager; | 161 | delete btManager; |
158 | btManager = 0; | 162 | btManager = 0; |
159 | } | 163 | } |
160 | if ( btDevice ) { | 164 | if ( btDevice ) { |
161 | delete btDevice; | 165 | delete btDevice; |
162 | btDevice = 0; | 166 | btDevice = 0; |
163 | } | 167 | } |
164 | } | 168 | } |
165 | return 0; | 169 | return 0; |
166 | } | 170 | } |
167 | 171 | ||
168 | int BluezApplet::checkBluezDiscoveryStatus() { | 172 | int BluezApplet::checkBluezDiscoveryStatus() { |
169 | return isScanning; | 173 | return isScanning; |
170 | } | 174 | } |
171 | 175 | ||
172 | int BluezApplet::setBluezDiscoveryStatus(int d) { | 176 | int BluezApplet::setBluezDiscoveryStatus(int d) { |
173 | return bluezDiscoveryActive = d; | 177 | return bluezDiscoveryActive = d; |
174 | } | 178 | } |
175 | 179 | ||
176 | int BluezApplet::setObexRecieveStatus(int d) { | 180 | int BluezApplet::setObexRecieveStatus(int d) { |
177 | { | 181 | { |
178 | QCopEnvelope e ( "QPE/Obex", "btreceive(int)" ); | 182 | QCopEnvelope e ( "QPE/Obex", "btreceive(int)" ); |
179 | e << ( d ? 1 : 0 ); | 183 | e << ( d ? 1 : 0 ); |
180 | } | 184 | } |
181 | bluezReceiveActive = (bool)(d != 0); | 185 | bluezReceiveActive = (bool)(d != 0); |
182 | bluezReceiveChanged = true; | 186 | bluezReceiveChanged = true; |
183 | return d; | 187 | return d; |
184 | } | 188 | } |
185 | 189 | ||
186 | // FIXME mbhaynie | 190 | // FIXME mbhaynie |
187 | // receiver for QCopChannel("QPE/Bluetooth") messages. | 191 | // receiver for QCopChannel("QPE/Bluetooth") messages. |
188 | void BluezApplet::slotMessage( const QCString& str, const QByteArray& ) | 192 | void BluezApplet::slotMessage( const QCString& str, const QByteArray& ) |