       return
     }
     if(isBleConnected){
-    // take the message to send from the head of the tx buffer queue
-    var cmdToSend : NSData = BLETxDataBuffer[0] as! NSData
-    vmlog("cmdToSend:",cmdToSend)
-    let datastring = NSString(data: (cmdToSend as NSData) as Data, encoding:String.Encoding.utf8.rawValue)
-    vmlog("datastring:",datastring!)
-
-    // we can only send 20B at a time in BLE
-    let rangedata = NSMakeRange(0, 20)
-    // loop through and send 20B at a time, make sure to handle <20B in the last send.
-    while cmdToSend.length > 0 {
-      if (cmdToSend.length<=20) {
-        vmlog("cmdToSend if length < 20:",cmdToSend)
-        sendBytes = cmdToSend as Data
-        vmlog("sendBytes if length < 20:",sendBytes)
-        
-        let try2Str = NSString(data: (sendBytes as NSData) as Data, encoding:String.Encoding.utf8.rawValue)
-        vmlog("try2Str....:",try2Str!)
-
-        
-        cmdToSend = NSMutableData()
-      } else {
-        sendBytes = cmdToSend.subdata(with: rangedata)
-        vmlog("20B chunks....:",sendBytes)
-       
-        let try1Str = NSString(data: (sendBytes as NSData) as Data, encoding:String.Encoding.utf8.rawValue)
-        vmlog("try1Str....:",try1Str!)
-
-        let leftdata = NSMakeRange(20,cmdToSend.length-20)
-        cmdToSend = NSData(data: cmdToSend.subdata(with: leftdata))
-      }
-      // write the byte chunk to the VI
-      openXCPeripheral.writeValue(sendBytes, for: openXCWriteChar, type: CBCharacteristicWriteType.withResponse)
-      // increment the tx write semaphore
-      BLETxWriteCount += 1
-    }
-    }
-
+      // take the message to send from the head of the tx buffer queue
+      var cmdToSend : NSData = BLETxDataBuffer[0] as! NSData
+      vmlog("cmdToSend:",cmdToSend)
+      let datastring = NSString(data: (cmdToSend as NSData) as Data, encoding:String.Encoding.utf8.rawValue)
+      vmlog("datastring:",datastring!)
+      
+      // we can only send 20B at a time in BLE
+      let rangedata = NSMakeRange(0, 20)
+      // loop through and send 20B at a time, make sure to handle <20B in the last send.
+      while cmdToSend.length > 0 {
+        if (cmdToSend.length<=20) {
+          vmlog("cmdToSend if length < 20:",cmdToSend)
+          sendBytes = cmdToSend as Data
+          vmlog("sendBytes if length < 20:",sendBytes)
+          
+          let try2Str = NSString(data: (sendBytes as NSData) as Data, encoding:String.Encoding.utf8.rawValue)
+          vmlog("try2Str....:",try2Str!)
+          
+          
+          cmdToSend = NSMutableData()
+        } else {
+          sendBytes = cmdToSend.subdata(with: rangedata)
+          vmlog("20B chunks....:",sendBytes)
+          
+          let try1Str = NSString(data: (sendBytes as NSData) as Data, encoding:String.Encoding.utf8.rawValue)
+          vmlog("try1Str....:",try1Str!)
+          
+          let leftdata = NSMakeRange(20,cmdToSend.length-20)
+          cmdToSend = NSData(data: cmdToSend.subdata(with: leftdata))
+        }
+        // write the byte chunk to the VI
+        openXCPeripheral.writeValue(sendBytes, for: openXCWriteChar, type: CBCharacteristicWriteType.withResponse)
+        // increment the tx write semaphore
+        BLETxWriteCount += 1
+      }
+    }
+    
     // remove the message from the tx buffer queue once all parts of it have been sent
     BLETxDataBuffer.removeObject(at: 0)
     

          rsp.event = event
          
          // capture this message into the dictionary of latest messages
          latestVehicleMeasurements[name] = rsp
          
          // look for a specific callback for this measurement name
          var found=false

            if let payloadX = json["payload"] as? NSString {
              payload = payloadX
              print("payload : \(payload)")
              //
              //            var payload : Data?
              //            if let payloadX = json["payload"] as? NSString {
              //
              //                payload = payloadX.data(using: String.Encoding.utf8.rawValue, allowLossyConversion: false)
              //                print("payload : \(payload)")
              
              //            var payload : [UInt8] = []
              //            if let payloadX = json["payload"] as? String {
              //                payload = Array(payloadX.utf8)
              //                print("payload : \(payload)")
              
            }
            var value : NSInteger?
            if let valueX = json["value"] as? NSInteger {
