Bluetooth Hotchpotch

I literally fought an epic battle with my Toshiba m400 since the first day I got it. For that reason I was not surprised when my colleague Frank Prengel from Microsoft Germany had some trouble with his m400 while preparing a demo with the Microsoft Robotics Studio (MSRS).

His first idea was about some issues with the April CTP 1.5 of the MSRS. Indeed, he got some errors like

<?xml version="1.0" encoding="utf-8" ?>
 <s:Fault xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d=http://schemas.microsoft.com/xw/2004/10/dssp.html xmlns:s="http://www.w3.org/2003/05/soap-envelope">
 <s:Code> 
 <s:Value>s:Receiver</s:Value> 
 <s:Subcode>
  <s:Value>d:OperationFailed</s:Value>
  </s:Subcode> 
 </s:Code> 
 <s:Reason>
 <s:Text>Unabled to configure Lego NXT</s:Text>
 </s:Reason>
</s:Fault>

Indeed, the error is a unfortunate result of a unhappy soft- and hardware combination. So, let’s see what we already have

  • A Toshiba m400
  • Windows Vista
  • Microsoft Robotics Studio 1.5 April CTP installed
  • A Lego NXT

Actually, the NXT documentation tells the NXT requires the Bluetooth stack from Widcomm or XP SP2. However, I know my m400 much much better than the people from Lego. Maybe you will realise that after installing the Lego software (either for RCX or NXT) you’ll get a message that the Lego software does not work with the Toshiba BT stack!? I.e. there is something special about the Toshiba BT stack… Fortunately, using the MSRS you don’t need any drivers or software to run the NXT. The build-in services provided by the MSRS are the one and only bits to run the NXT.

  1. Un-install the Microsoft Bluetooth Stack
  2. Install the latest Toshiba m400 BIOS
  3. Install the Toshiba BT Stack for Windows Vista
  4. Install the Toshiba BT Monitor.

Now you can easily pair your BT capable devices with your m400. In the following you can see a iRobot Create and a Lego NXT paired with my m400.

Toshiba Blootooth Settings

Frank confirmed that after following the steps above his demo now “works as a charm”.

Disabled MenuItems in WPF

Maybe this is a bug: Creating a ContextMenu as child of a Canvas, the event handlers CanExecute and Execute have never been executed? This took me almost two hours to figure out why. Basically, I do my command binding like

CommandBinding exitCmd = new CommandBinding(DesignerCommands.Exit);
exitCmd.CanExecute += new CanExecuteRoutedEventHandler(exitCmd_CanExecute);
exitCmd.Executed += new ExecutedRoutedEventHandler(exitCmd_Executed);
CommandBindings.Add(exitCmd);

To me, it looks like there is a minor problem in command binding whilst using command binding this manner in controls which never get the focus (such as a Canvas). Since the handlers are never fired. An easy workaround is to add additional command binding within your XAML code.

<ContextMenu.CommandBindings>
 <CommandBindingCommand="e:MyCommands.Exit" CanExecute="exitCmd_CanExecute" Executed="exitCmd_Executed"/>
</ContextMenu.CommandBindings>

I checked a couple of web sites and found one site, where the problem is described a bit more in detail. Also Aaron describes a second work around that requires some lines of code.