 			//print("FusionPacket : \(fp)")
 		}
 	}
+	func isDeviceReady()-> Bool {
+		if (device == nil) {
+			return false
+		}
+		
+		if (device.state != CBPeripheralState.Connected) {
+			return false
+		}
+		
+		return true
+	}
 	
 	func MotionStream(Enable:Bool)
 	{
+		if (isDeviceReady() == false) {
+			return
+		}
+		
 		var pkbuf = [UInt8](count:20, repeatedValue:0)
 		
 		pkbuf[0] = 0x41


	func SixAxisIMU_Stream(Enable:Bool)
	{
		var pkbuf = [UInt8](count:20, repeatedValue:0)
		
		pkbuf[0] = 0x41

	
	func PedometerStream(Enable:Bool)
	{
		if (isDeviceReady() == false) {
			return
		}
		
		var pkbuf = [UInt8](count:20, repeatedValue:0)
		
		pkbuf[0] = 0x41
