-
Notifications
You must be signed in to change notification settings - Fork 48
Description
Summary
There are two issues here.
First, I cannot seem to use bluetooth + dart + chrome on my ubuntu desktop. I have a working BT adapter, and I can pair to devices using the blueman manager. I can also access the BT stack from Java via the bluecove libs (bluecove-gpl-2.1.0.jar, bluecove-emu-2.1.0.jar, bluecove-2.1.0.jar).
Second, I cannot seem to catch the exception that is being thrown in dart:core-patch/object_patch.dart:45. The stack trace is being printed by somewhere else in the stack, as neither my catch clause nor my onError clause are entered into.
Is bluetooth + dart + chrome even supported on ubuntu?
Code
library foo.bluetooth;
import 'package:logging/logging.dart';
import 'package:chrome/chrome_app.dart' as chrome;
final Logger log = new Logger("FooBluetooth");
class FooBluetoothService {
static void init() {
try{
if(chrome.bluetooth == null){ throw new StateError("Chrome.bluetooth extensions not present");}
chrome.bluetooth.onAdapterStateChanged.listen((chrome.AdapterState e) {
log.info("Bluetooth Adapter: ${e}");
}, onError: (e){
log.severe("Bluetooth Adapter Error: ${e}");
});
}catch(e){
log.severe("Bluetooth Adapter Error: ${e}");
}
}
}
Error
Exception: Uncaught Error: The null object does not have a method '[]'.
NoSuchMethodError: method not found: '[]'
Receiver: null
Arguments: ["onAdapterStateChanged"]
Stack Trace:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#1 _ensureHandlerAdded (package:chrome/src/common.dart:174:25)
#2 _runGuarded (dart:async/stream_controller.dart:664)
#3 _BroadcastStreamController._subscribe (dart:async/broadcast_stream_controller.dart:199)
#4 _ControllerStream._createSubscription (dart:async/stream_controller.dart:682)
#5 _StreamImpl.listen (dart:async/stream_impl.dart:474)
#6 FooBluetoothService.init (package:myapp/foo_bluetooth.dart:14:52)
#7 FooApp.attached (chrome-extension://dpccenibohdmiogacpmcnnnnndgnokpc/elements/foo_app.dart:126:29)
#8 Blink_Utils.register (dart:_blink:31036)
#9 _Utils._register (dart:html:41634)
#10 _Utils.register (dart:html:41630)
#11 HtmlDocument.registerElement (dart:html:17289)
#12 PolymerDeclaration.registerType (package:polymer/src/declaration.dart:180:29)
#13 PolymerDeclaration.register (package:polymer/src/declaration.dart:123:17)
#14 _hookJsPolymer.registerDart.<anonymous closure> (package:polymer/src/loader.dart:122:75)
#15 _rootRun (dart:async/zone.dart:895)
#16 _CustomZone.run (dart:async/zone.dart:796)
#17 _hookJsPolymer.registerDart (package:polymer/src/loader.dart:121:22)
System
Ubuntu 14.x:
Linux green 3.13.0-46-generic #77-Ubuntu SMP Mon Mar 2 18:23:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Adapter
Bus 005 Device 005: ID 0a5c:2148 Broadcom Corp. BCM92046DG-CL1ROM Bluetooth 2.1 Adapter
Bluez Libs
ii bluez 4.101-0ubuntu13.1 amd64 Bluetooth tools and daemons
ii bluez-alsa:amd64 4.101-0ubuntu13.1 amd64 Bluetooth ALSA support
ii bluez-cups 4.101-0ubuntu13.1 amd64 Bluetooth printer driver for CUPS
ii bluez-gstreamer 4.101-0ubuntu13.1 amd64 Bluetooth GStreamer support