           // bool test
           // TODO: maybe keep track of what type each rsp is?
           /*
-          if value is NSNumber {
-            let nv = value as! NSNumber
-            if nv.isEqualToValue(NSNumber(bool: true)) {
-              vmlog("it's a bool and it's true")
-            } else if nv.isEqualToValue(NSNumber(bool:false)) {
-              vmlog("it's a bool and it's true")
-            } else {
-              vmlog("it's a number")
-            }
-          } else {
-            vmlog("it's a string")
-          }
-          */
+           if value is NSNumber {
+           let nv = value as! NSNumber
+           if nv.isEqualToValue(NSNumber(bool: true)) {
+           vmlog("it's a bool and it's true")
+           } else if nv.isEqualToValue(NSNumber(bool:false)) {
+           vmlog("it's a bool and it's true")
+           } else {
+           vmlog("it's a number")
+           }
+           } else {
+           vmlog("it's a string")
+           }
+           */
           
           
           latestVehicleMeasurements.setValue(rsp, forKey:name as String)

      vmlog("no file sharing key!")
      return false
    }

    traceFilesinkEnabled = true
    traceFilesinkName = filename
  
    
    if let dir = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory,
                                                     NSSearchPathDomainMask.AllDomainsMask, true).first {
      
      let path = NSURL(fileURLWithPath: dir).URLByAppendingPathComponent(traceFilesinkName as String).path!

      vmlog("checking for file")
      if NSFileManager.defaultManager().fileExistsAtPath(path) {
        vmlog("file detected")

    
    // wait for BLE acknowledgement
    // TODO: need a timeout!
    //    while (BLETxWriteCount>0) {
    //      NSThread.sleepForTimeInterval(0.05)
    //    }
  }
  
  
  private func sendDiagCommon(cmd:VehicleDiagnosticRequest) {
    vmlog("in sendDiagCommon")
    
    let cmdjson : NSMutableString = ""
    cmdjson.appendString("{\"command\":\"diagnostic_request\",\"action\":\"add\",\"request\":{\"bus\":\(cmd.bus),\"id\":\(cmd.message_id),\"mode\":\(cmd.mode)")
    if cmd.pid != nil {
      cmdjson.appendString(",\"pid\":\(cmd.pid!)")
    }
    cmdjson.appendString("}}\0")
    
    // TODO: what about recurring diagnostic messages
    
    vmlog("sending diag cmd:",cmdjson)
