Quellcode durchsuchen

修改上传接口

leon vor 2 Jahren
Ursprung
Commit
c10d9b89b8
78 geänderte Dateien mit 3114 neuen und 1995 gelöschten Zeilen
  1. BIN
      .DS_Store
  2. BIN
      DanceGame/.DS_Store
  3. 90 90
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataAnalysis.mm
  4. 15 12
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataProcess.h
  5. 194 189
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataProcess.mm
  6. 46 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/GameInfo.h
  7. 12 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/GameInfo.m
  8. 12 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/LEONBLManager.h
  9. 46 14
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/LEONBLManager.m
  10. 0 51
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/MainShoesAnalysis.h
  11. 0 551
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/MainShoesAnalysis.mm
  12. 30 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ShoesInfo.h
  13. 12 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ShoesInfo.m
  14. 0 16
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ViceShoesAnalysis.h
  15. 0 12
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ViceShoesAnalysis.m
  16. 24 29
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/HTTPDataProcession.m
  17. 7 23
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/IOSPlatformSDK.mm
  18. 116 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrash.h
  19. 220 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrash.m
  20. 17 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashProtocol.h
  21. 37 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.h
  22. 18 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.m
  23. 25 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.h
  24. 258 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.m
  25. 25 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.h
  26. 96 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.m
  27. 24 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.h
  28. 56 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.m
  29. 26 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.h
  30. 169 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.m
  31. 23 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.h
  32. 74 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.m
  33. 24 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.h
  34. 95 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.m
  35. 29 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.h
  36. 97 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.m
  37. 34 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.h
  38. 220 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.m
  39. 29 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSString+AvoidCrash.h
  40. 204 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSString+AvoidCrash.m
  41. 16 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/BugTool.h
  42. 42 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/BugTool.m
  43. 1 1
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/MYFactoryManager.h
  44. 2 2
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/DebugView.h
  45. 3 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/DebugView.m
  46. 1 0
      DanceGame/Classes/Unity/WWWConnection.mm
  47. 0 2
      DanceGame/Info.plist
  48. 121 27
      DanceGame/Unity-iPhone.xcodeproj/project.pbxproj
  49. 7 0
      DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  50. BIN
      DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcuserdata/duowan123.xcuserdatad/UserInterfaceState.xcuserstate
  51. 4 4
      DanceGame/Unity-iPhone.xcodeproj/xcshareddata/xcschemes/Unity-iPhone.xcscheme
  52. BIN
      RunGame/.DS_Store
  53. 5 4
      RunGame/Classes/UnityAppController.mm
  54. BIN
      RunGame/SDK/.DS_Store
  55. 90 90
      RunGame/SDK/BLE/BTDataAnalysis.mm
  56. 162 132
      RunGame/SDK/BLE/BTDataProcess.mm
  57. 1 1
      RunGame/SDK/BLE/BTDataSend.m
  58. 11 0
      RunGame/SDK/BLE/LEONBLManager.h
  59. 45 13
      RunGame/SDK/BLE/LEONBLManager.m
  60. 0 51
      RunGame/SDK/BLE/MainShoesAnalysis.h
  61. 0 551
      RunGame/SDK/BLE/MainShoesAnalysis.mm
  62. 24 0
      RunGame/SDK/BLE/MotionCountObj.h
  63. 12 0
      RunGame/SDK/BLE/MotionCountObj.m
  64. 0 16
      RunGame/SDK/BLE/ViceShoesAnalysis.h
  65. 0 12
      RunGame/SDK/BLE/ViceShoesAnalysis.m
  66. 24 29
      RunGame/SDK/HTTP/HTTPDataProcession.m
  67. 4 21
      RunGame/SDK/IOSPlatformSDK.mm
  68. 16 0
      RunGame/SDK/Tool/BugTool.h
  69. 42 0
      RunGame/SDK/Tool/BugTool.m
  70. 2 2
      RunGame/SDK/Tool/MYFactoryManager.h
  71. 4 3
      RunGame/SDK/Tool/MYFactoryManager.m
  72. 0 0
      RunGame/SDK/UI/DebugView.h
  73. 0 0
      RunGame/SDK/UI/DebugView.m
  74. 1 1
      RunGame/SDK/UI/SearchDeviceViewController.m
  75. 52 42
      RunGame/Unity-iPhone.xcodeproj/project.pbxproj
  76. BIN
      RunGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcuserdata/duowan123.xcuserdatad/UserInterfaceState.xcuserstate
  77. 4 4
      RunGame/Unity-iPhone.xcodeproj/xcshareddata/xcschemes/Unity-iPhone.xcscheme
  78. 14 0
      RunGame/Unity-iPhone.xcodeproj/xcuserdata/duowan123.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

BIN
.DS_Store


BIN
DanceGame/.DS_Store


+ 90 - 90
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataAnalysis.mm

@@ -12,99 +12,99 @@
 #pragma mark ===============================================>> 校验 & 报文数据解析
 -(void)analysisCharacteristic:(NSData*)characteristic deviceType:(DEVICE_TYPE)deviceType{
         
-//    NSLog(@"接收到的数据data = %@",characteristic);
-    int frameHead = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(0, 1)]];//帧头数据aa
-    int messageLength = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(1, 1)]];//报文长度
-    int messageLengthNegation = ~messageLength;//报文长度取反
-    int dataType = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
-    
-      if (dataType == 4){//获取主动推过来的数据
-            //右脚坐标数据
-           int right_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(4, 4)];
-           int right_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(8, 4)];
-           int right_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(12, 4)];
-           int  right_pos[3] = {right_X,right_Y,right_Z};
-          //左脚坐标数据
-           int left_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(16, 4)];
-           int left_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(20, 4)];
-           int left_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(24, 4)];
-           int  left_pos[3] = {left_X,left_Y,left_Z};
-           //右脚姿势数据
-           short righrPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(28, 2)];
-           short righrPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(30, 2)];
-           short righrPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(32, 2)];
-           int  right_att[3] = {righrPosture_X,righrPosture_Y,righrPosture_Z};
-           //左脚姿势数据
-           short leftPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(34, 2)];
-           short leftPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(36, 2)];
-           short leftPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(38, 2)];
-           int  left_att[3] = {leftPosture_X,leftPosture_Y,leftPosture_Z};
-           //右脚三维数据
-           short righrAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(40, 2)];
-           short righrAcc_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(42, 2)];
-           short righrAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(44, 2)];
-           int  righr_acc[3] = {righrAcc_x,righrAcc_Y,righrAcc_z};
-           //左脚三维数据
-           short leftAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(46, 2)];
-           short leftAcc_y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(48, 2)];
-           short leftAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(50, 2)];
-           int  left_acc[3] = {leftAcc_x,leftAcc_y,leftAcc_z};
-           //左脚、右脚、蹲 、跳四个动作信息数据
-           int actionInformation =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(52, 1)]];;//0c 16进制字符串
-                       int girlShoes  = actionInformation & 16;
-                       if (girlShoes!=0){
-                           girlShoes=1;
-                       }else{
-                           girlShoes=0;
-                       }
-                       int rightZupt  = actionInformation & 8;
-                       if (rightZupt!=0){
-                           rightZupt=1;
-                       }else{
-                           rightZupt=0;
-                       }
-                       int leftZupt = actionInformation & 4;
-                       if (leftZupt!=0){
-                            leftZupt=1;
-                        }else{
-                            leftZupt=0;
-                        }
-                       int down  = actionInformation & 2;
-                       if (down!=0){
-                            down=1;
-                        }else{
-                            down=0;
-                        }
-                       int jump  = actionInformation & 1;
-                       if (jump!=0){
-                            jump=1;
-                        }else{
-                            jump=0;
-                        }
-          
-            int rssi = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(53, 1)]];//rssi 信号强度
-            int ts = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
-            int right_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(55, 2)]];//3 29新增 右鞋压力
-            int left_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(57, 2)]];//3 29新增 左鞋压力
-            int frameCheck =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(59, 1)]];//校验位
-        
-              if (deviceType==DEVICETYPE_MAIN){//主设备
-    //                   NSLog(@"主设备 接收到 鞋子动作数据 data = %@",characteristic);
-                  //调取鞋子SDK
-    //                   [self shoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righr_acc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
-                  
-              }else if (deviceType==DEVICETYPE_VICE){//副设备动作数据
-                  //调取鞋子SDK
-    //                   [self viceShoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righr_acc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
-              }
-                  
-        }else if (dataType == -95 && characteristic.length == 26){//获取的是查询的数据 char-->int a1 = -95
+////    NSLog(@"接收到的数据data = %@",characteristic);
+//    int frameHead = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(0, 1)]];//帧头数据aa
+//    int messageLength = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(1, 1)]];//报文长度
+//    int messageLengthNegation = ~messageLength;//报文长度取反
+//    int dataType = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
+//
+//      if (dataType == 4){//获取主动推过来的数据
+//            //右脚坐标数据
+//           int right_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(4, 4)];
+//           int right_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(8, 4)];
+//           int right_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(12, 4)];
+//           int  right_pos[3] = {right_X,right_Y,right_Z};
+//          //左脚坐标数据
+//           int left_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(16, 4)];
+//           int left_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(20, 4)];
+//           int left_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(24, 4)];
+//           int  left_pos[3] = {left_X,left_Y,left_Z};
+//           //右脚姿势数据
+//           short righrPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(28, 2)];
+//           short righrPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(30, 2)];
+//           short righrPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(32, 2)];
+//           int  right_att[3] = {righrPosture_X,righrPosture_Y,righrPosture_Z};
+//           //左脚姿势数据
+//           short leftPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(34, 2)];
+//           short leftPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(36, 2)];
+//           short leftPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(38, 2)];
+//           int  left_att[3] = {leftPosture_X,leftPosture_Y,leftPosture_Z};
+//           //右脚三维数据
+//           short righrAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(40, 2)];
+//           short righrAcc_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(42, 2)];
+//           short righrAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(44, 2)];
+//           int  righr_acc[3] = {righrAcc_x,righrAcc_Y,righrAcc_z};
+//           //左脚三维数据
+//           short leftAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(46, 2)];
+//           short leftAcc_y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(48, 2)];
+//           short leftAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(50, 2)];
+//           int  left_acc[3] = {leftAcc_x,leftAcc_y,leftAcc_z};
+//           //左脚、右脚、蹲 、跳四个动作信息数据
+//           int actionInformation =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(52, 1)]];;//0c 16进制字符串
+//                       int girlShoes  = actionInformation & 16;
+//                       if (girlShoes!=0){
+//                           girlShoes=1;
+//                       }else{
+//                           girlShoes=0;
+//                       }
+//                       int rightZupt  = actionInformation & 8;
+//                       if (rightZupt!=0){
+//                           rightZupt=1;
+//                       }else{
+//                           rightZupt=0;
+//                       }
+//                       int leftZupt = actionInformation & 4;
+//                       if (leftZupt!=0){
+//                            leftZupt=1;
+//                        }else{
+//                            leftZupt=0;
+//                        }
+//                       int down  = actionInformation & 2;
+//                       if (down!=0){
+//                            down=1;
+//                        }else{
+//                            down=0;
+//                        }
+//                       int jump  = actionInformation & 1;
+//                       if (jump!=0){
+//                            jump=1;
+//                        }else{
+//                            jump=0;
+//                        }
+//
+//            int rssi = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(53, 1)]];//rssi 信号强度
+//            int ts = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
+//            int right_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(55, 2)]];//3 29新增 右鞋压力
+//            int left_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(57, 2)]];//3 29新增 左鞋压力
+//            int frameCheck =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(59, 1)]];//校验位
+//
+//              if (deviceType==DEVICETYPE_MAIN){//主设备
+//    //                   NSLog(@"主设备 接收到 鞋子动作数据 data = %@",characteristic);
+//                  //调取鞋子SDK
+//    //                   [self shoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righr_acc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
+//
+//              }else if (deviceType==DEVICETYPE_VICE){//副设备动作数据
+//                  //调取鞋子SDK
+//    //                   [self viceShoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righr_acc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
+//              }
+//
+//        }else if (dataType == -95 && characteristic.length == 26){//获取的是查询的数据 char-->int a1 = -95
            //A1+1 >> 1: 设备数据(左鞋,右鞋)  aa 14 eb a1 01 64 00 1a 0000981d 64 00 17 00000000 f9
                 int leftElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(5, 1)]];
                 int rightElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(15, 1)]];//龙哥新协议
                 
                 if (deviceType==DEVICETYPE_MAIN && LEManager.peripheral!=nil){//主设备
-//                    NSLog(@"主设备 接收到 鞋子硬件数据 data 26 = %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
+                    NSLog(@"主设备 接收到 鞋子硬件数据 data 26 = %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
                     //主 设备定时器 60秒调一次   /******************ios call unity*****************/
                      [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_MAIN
                                                  name:LEManager.peripheral.name
@@ -113,7 +113,7 @@
                                           electricity:leftElectricity<=rightElectricity?leftElectricity:rightElectricity];
              
                 }else if (deviceType==DEVICETYPE_VICE && LEManager.vicePeripheral!=nil){//副设备
-//                    NSLog(@"副设备 接收到 鞋子硬件数据 26 = %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
+                    NSLog(@"副设备 接收到 鞋子硬件数据 26 = %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
                     //副 设备定时器 60秒调一次   /******************ios call unity*****************/
                      [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_VICE
                                                  name:LEManager.vicePeripheral.name
@@ -122,7 +122,7 @@
                                           electricity:leftElectricity<=rightElectricity?leftElectricity:rightElectricity];
                     
                 }
-        }
+//        }
 }
 
 

+ 15 - 12
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataProcess.h

@@ -11,13 +11,16 @@
 #import "LEONBLManager.h"
 #import "SocketRocketUtility.h"
 
-//游戏类型
-typedef NS_ENUM(int, GAME_TYPE){
-    GAME_TYPE_DEMO =0, //
-    GAME_TYPE_RUN, //
-    GAME_TYPE_DANCE, //
-    GAME_TYPE_SDAER, //
-};
+#import "ShoesInfo.h"
+#import "GameInfo.h"
+
+////游戏类型
+//typedef NS_ENUM(int, GAME_TYPE){
+//    GAME_TYPE_DEMO =0, //
+//    GAME_TYPE_RUN, //
+//    GAME_TYPE_DANCE, //
+//    GAME_TYPE_SDAER, //
+//};
 
 //蓝牙状态
 typedef NS_ENUM(NSInteger, BLETOOTH_STUTAS){
@@ -27,10 +30,13 @@ typedef NS_ENUM(NSInteger, BLETOOTH_STUTAS){
     CONNECT_LOST, // 丢失链接 /链接失败
 };
 
-@interface BTDataProcess : UIViewController
+@interface BTDataProcess : NSObject
 
 @property(assign,nonatomic)int nativeAttX;
-    
+
+@property(nonatomic,strong)ShoesInfo * shoes_info;
+@property(nonatomic,strong)GameInfo * game_info;
+
 //单例->初始化蓝牙
 +(instancetype)sharedInstance;
 
@@ -47,6 +53,3 @@ typedef NS_ENUM(NSInteger, BLETOOTH_STUTAS){
 -(void)vibrationAction:(int)type duration:(int)duration;
 
 @end
-
-
-

+ 194 - 189
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataProcess.mm

@@ -6,7 +6,7 @@
 #import "BTDataProcess.h"
 #import "IOSPlatformSDK.h"
 #include "Game.h"
-#import <JavaScriptCore/JSBase.h>
+#import "MotionCountObj.h"
 
 //#define NSLog(format, ...) printf("TIME:%s FILE:%s(%d行) FUNCTION:%s %s\n",__TIME__, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String])
 @interface BTDataProcess ()
@@ -16,13 +16,6 @@ Game *game;
 Game *viceDeviceGame;
 }
 
-//趣动跳转过来携带的mac 实际是蓝牙设备的identity
-@property(copy,nonatomic)NSString * macAddress;
-//弹窗 unity主动选择链接 主0 副1 设备
-@property(assign,nonatomic)DEVICE_TYPE deviceType;
-//游戏种类
-@property(assign,nonatomic)GAME_TYPE game_type;
-
 //ios_sdk
 @property (nonatomic,strong)IOSPlatformSDK * sdk;
 
@@ -31,17 +24,10 @@ Game *viceDeviceGame;
 //蓝牙外设数据源
 @property (strong, nonatomic)NSMutableArray  * deviceArray;
 
-//定时请求设备状态
+//定时查询设备状态
 @property(nonatomic,weak)NSTimer * timer;
-//程序在前台还是后台
-@property(assign,nonatomic)int isBackGround;
-//鞋子是否开启游戏模式
-@property(nonatomic,assign)BOOL gameModel;
-//当局游戏时间
-@property(nonatomic,strong)NSDate * firstTime;
-//当局游戏跳起、下蹲次数
-@property(assign,nonatomic)int initial_jump_count;
-@property(assign,nonatomic)int initial_down_count;
+
+@property(nonatomic,strong)MotionCountObj * motionCountObj;
 
 @end
 
@@ -53,7 +39,6 @@ static BTDataProcess* instance = nil;
 +(instancetype)sharedInstance{
      return [[self alloc] init];
 }
-
 + (instancetype)allocWithZone:(struct _NSZone *)zone{
   static dispatch_once_t onceToken;
   dispatch_once(&onceToken, ^{
@@ -61,7 +46,6 @@ static BTDataProcess* instance = nil;
   });
   return instance;
 }
-
 - (instancetype)init{
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
@@ -96,10 +80,10 @@ static BTDataProcess* instance = nil;
         return;
     }
     //主副设备:deviceType  游戏种类:game_type  mac地址:macAddress
-    self.deviceType = DEVICETYPE_MAIN;
+    self.game_info.deviceType = DEVICETYPE_MAIN;
     NSString * game_type = [MYFactoryManager getGameType];
-    self.game_type = (GAME_TYPE)[game_type intValue];
-    self.macAddress = [MYFactoryManager getGameMac];
+    self.game_info.game_type = (GAME_TYPE)[game_type intValue];
+    self.shoes_info.macAddress = [MYFactoryManager getGameMac];
     //链接蓝牙
     [self initCBCentralManager];
     
@@ -110,10 +94,10 @@ static BTDataProcess* instance = nil;
     
     /***************************初始化蓝牙数据处理工具***************************/
     //主副设备:deviceType  游戏种类:game_type  mac地址:macAddress
-    self.deviceType = (DEVICE_TYPE)type;
+    self.game_info.deviceType = (DEVICE_TYPE)type;
     NSString * game_type = [MYFactoryManager getGameType];
-    self.game_type = (GAME_TYPE)[game_type intValue];
-    self.macAddress = @"";
+    self.game_info.game_type = (GAME_TYPE)[game_type intValue];
+    self.shoes_info.macAddress = @"";
     //初始化蓝牙CBCentralManager
     [self initCBCentralManager];
 
@@ -132,9 +116,9 @@ static BTDataProcess* instance = nil;
     //点击searchVC的tableViewCell链接选中的蓝牙
     __weak __typeof(self)weakself = self;
         self.searchDeviceVC.connectDeviceBlock = ^(CBPeripheral * peripheral){
-        weakself.deviceType = (DEVICE_TYPE)type;
+        weakself.game_info.deviceType = (DEVICE_TYPE)type;
+        weakself.shoes_info.macAddress = peripheral.identifier.UUIDString;
         [weakself connectPeripheral:peripheral];
-        weakself.macAddress = peripheral.identifier.UUIDString;
     };
     
 }
@@ -143,25 +127,32 @@ static BTDataProcess* instance = nil;
 -(void)gameStartInitData{
     
     //当局游戏时间
-    self.firstTime = [NSDate date];
-    //当局动作数据
-    self.initial_down_count = 0;
-    self.initial_jump_count = 0;
+    self.game_info.firstTime = [NSDate date];
+
+    self.motionCountObj = [MotionCountObj new];
+    if (game){
+        self.motionCountObj.step = game->getMotionCount(STEP_COUNT);
+        self.motionCountObj.jump = game->getMotionCount(JUMP_COUNT);
+        self.motionCountObj.crouch = game->getMotionCount(DOWN_COUNT);
+        self.motionCountObj.tick = game->getMotionCount(KICK_COUNT);
+        self.motionCountObj.paper = game->getMotionCount(PAPER_COUNT);
+        self.motionCountObj.scissors = game->getMotionCount(SCISSORS_COUNT);
+        self.motionCountObj.rock = game->getMotionCount(ROCK_COUNT);
+        NSLog(@"self.motionCountObj = %d %d %d %d %d %d %d",self.motionCountObj.step,self.motionCountObj.jump,self.motionCountObj.crouch,self.motionCountObj.tick,self.motionCountObj.paper,self.motionCountObj.scissors,self.motionCountObj.rock);
+    }
+    
     //游戏模式 ==>> 回调剑波sdk数据
-    self.gameModel = YES;
+    self.shoes_info.gameModel = YES;
     //读写到特征后 添加测试弹窗
     dispatch_async(dispatch_get_main_queue(), ^{
         [DebugViewInstance inittestLabel];
     });
     
-    //jb
-    [DebugViewInstance clearCacheWithFilePath];
-    
 }
 
 //每结束一局游戏
 -(void)gameEndInitData{
-    self.gameModel = NO;
+//    self.shoes_info.gameModel = NO;
     //jb
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(),^{
         [DebugViewInstance uploadpPlistFile];
@@ -176,11 +167,12 @@ static BTDataProcess* instance = nil;
 #pragma mark ============================>> private
 -(void)initData{
     
-    //后台模式
-    self.isBackGround = NO;
-    //默认游戏模式关
-    self.gameModel = NO;
+    self.shoes_info = [ShoesInfo new];
+    self.shoes_info.gameModel = NO; //默认游戏模式关
     
+    self.game_info = [GameInfo new];
+    self.game_info.isBackGround = NO; //后台模式
+   
     //固定一个时间戳
     NSString * timestamp =   [AlgorithmTool returnTimestamp];
     [IOS_NSUSERDEFAULT setObject:timestamp forKey:IOSSDK_TIMESTAMP];
@@ -212,12 +204,12 @@ static BTDataProcess* instance = nil;
 
 -(void)enterBackground{
     NSLog(@"leon UIApplicationDidEnterBackgroundNotification");
-    instance.isBackGround = YES;
+    self.game_info.isBackGround = YES;
 }
 
 -(void)willEnterForeground{
     NSLog(@"leon UIApplicationWillEnterForegroundNotification");
-    instance.isBackGround = NO;
+    self.game_info.isBackGround = NO;
     NSLog(@"程序从后台返回 重连蓝牙 peripheral.state = %ld",LEManager.peripheral.state);
     [self initCBCentralManager];
 }
@@ -232,7 +224,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     NSUserDefaults* userDefault = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.Oujia.AppAndGame"];
     //趣动传过来的 invite json字符串转字典
     NSString * string = [userDefault objectForKey:@"invite"];
-    if (string == nil){
+    if (string == nil) {
         [PopupView showCusHUDA:@"邀请参数为空"];
         return;
     }
@@ -255,7 +247,6 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
 }
 
-
 //趣动 ==>> 断开蓝牙
 -(void)disConnedctBle{
     NSLog(@"趣动 call 断开蓝牙");
@@ -373,7 +364,8 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 //是否是app跳转传参 区分app跳转和弹窗搜索 type=0的时候才会执行该方法 type=0的时候才会执行该方法 当时弹框的时候type==1 不执行该方法
 -(void)ifAppJumpWithIdentifier:(CBPeripheral*)peripheral{
     
-    if (self.macAddress!=nil && [peripheral.identifier.UUIDString isEqualToString:self.macAddress]){//app跳转过来 主动链接蓝牙
+//    NSLog(@"self.shoes_info.macAddress = %@  peripheral.identifier.UUIDString = %@",self.shoes_info.macAddress,peripheral.identifier.UUIDString);
+    if (self.shoes_info.macAddress!=nil && [peripheral.identifier.UUIDString isEqualToString:self.shoes_info.macAddress]){//app跳转过来 主动链接蓝牙
         [self connectPeripheral:peripheral];
     }
     
@@ -386,21 +378,20 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     if(instance!=NULL && peripheral!=NULL){
        
         self.sdk = [IOSPlatformSDK sharedInstance];//蓝牙数据经过sdk数据转换后 ios call unity
-        self.game_type = GAME_TYPE_DANCE;
         DebugViewInstance.currentTS = 1000;
-        NSLog(@"BTDataProcess connectPeripheral self.deviceType ==>> %ld  self.game_type ==>> %d   mac ==>>  %@",(long)self.deviceType,self.game_type,self.macAddress);
+        NSLog(@"BTDataProcess connectPeripheral self.game_info.deviceType ==>> %ld  self.game_info.game_type ==>> %d   mac ==>>  %@",(long)self.game_info.deviceType,self.game_info.game_type,self.shoes_info.macAddress);
         
         //初始化运轨sdk
-        if (self.deviceType==DEVICETYPE_MAIN){
+        if (self.game_info.deviceType==DEVICETYPE_MAIN){
             LEManager.peripheral = peripheral;
-            game = new Game(self.game_type);
-        }else if (self.deviceType == DEVICETYPE_VICE){
+            game = new Game(self.game_info.game_type);
+        }else if (self.game_info.deviceType == DEVICETYPE_VICE){
             LEManager.vicePeripheral = peripheral;
-            viceDeviceGame = new Game(self.game_type);
+            viceDeviceGame = new Game(self.game_info.game_type);
         }
         
         //根据ios_sdk传入deviceType 链接 主/副 设备
-        [self connectBLEManagerData:peripheral deviceType:self.deviceType];
+        [self connectBLEManagerData:peripheral deviceType:self.game_info.deviceType];
     
     }
     
@@ -460,22 +451,36 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     LEManager.readValueForCharacteristicBlock = ^(CBPeripheral * _Nonnull peripheral, CBCharacteristic * _Nonnull characteristic, NSData * _Nonnull value, NSError * _Nonnull error, DEVICE_TYPE type){
         if ([characteristic.UUID.UUIDString isEqualToString:@"6E400003-B5A3-F393-E0A9-E50E24DCCA9E"]){//判断是不是我们设备的特征值
 //            NSLog(@"characteristic.UUID.UUIDString = %@",characteristic.UUID.UUIDString);
-            
+
             //每收到数据包读取一次蓝牙RSSI 无论1秒内请求多少次rssi值,原生api每秒都最多返回一次RSSI
             [peripheral readRSSI];
             
             //带cmd位的有效数据  计算校验位
             if ([AlgorithmTool verificationRusult:characteristic.value]==YES){
                 
-                if (characteristic.value.length > 26){
-                    //数据丢给算法计算轨迹
-                    [self shoseSDKcharacteristic:characteristic.value];
-                }else{
-                    //嵌入式原始数据解析 --->> 回调蓝牙状态/电量给unity
-                    BTDataAnalysis * anly = [BTDataAnalysis new];
-                    [anly analysisCharacteristic:characteristic.value deviceType:type];
-                }
+                int dataType = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
+//                NSLog(@"读取特征的报文 游戏数据 %ld dataType = %d %@",(long)type,dataType,characteristic.value);
+                  if (dataType == 4){//获取主动推过来的数据
+                      
+                          //数据丢给算法计算轨迹
+                          if (type == DEVICETYPE_MAIN&&LEManager.main_read == 0){
+//                              NSLog(@"LEManager.main_read = %d",LEManager.main_read);
+                              LEManager.main_read = 1;
+                              [self shoseSDK:characteristic.value];
+                          }else if (type == DEVICETYPE_VICE&&LEManager.vice_read == 0){
+                              NSLog(@"LEManager.vice_read = %d",LEManager.main_read);
+                              LEManager.vice_read = 1;
+                              [self viceShoseSDK:characteristic.value];
+                          }
+                      
+                  }else if(dataType == -95){//读取基本信息
+                          //嵌入式原始数据解析 --->> 回调蓝牙状态/电量给unity
+                          BTDataAnalysis * anly = [BTDataAnalysis new];
+                          [anly analysisCharacteristic:characteristic.value deviceType:type];
+                  }
+                      
             }
+            
          }
         
     };
@@ -492,6 +497,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
     //蓝牙连接成功
     LEManager.successfulBlock = ^(CBPeripheral * _Nonnull peripheral){
+        NSLog(@"蓝牙链接成功");
             [[AnimationView shanreAnimationView] stopAnimation];
     };
 
@@ -520,6 +526,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
                                      address:LEManager.vicePeripheral.identifier.UUIDString
                                       status:CONNECT_LOST
                                  electricity:0];
+            
         }
         
         NSLog(@"蓝牙链接丢失");
@@ -551,7 +558,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 //定时发送数据
 -(void)timingDataTransmission:(NSString*)style{
     
-    if (self.isBackGround){//程序在后台
+    if (self.game_info.isBackGround){//程序在后台
     }else{//程序在前台
         [BTDataSendInstance startGameModel];
     }
@@ -560,68 +567,77 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 }
 
 #pragma mark ===============================================>> 主设备 报文数据解析后 -- 调用蓝牙鞋子SDK装换数据 -- ios call unity 更新游戏动作
--(void)shoseSDKcharacteristic:(NSData*)characteristic{
-    
-    /********************初始化 运动轨迹算法 SDK *****************/
-    //游戏数据
-//    NSLog(@"characteristic = %@",characteristic);
-    NSData * validData= [characteristic subdataWithRange:NSMakeRange(4, characteristic.length-4)];
-//    NSLog(@"validData = %@",validData);
-    Byte * buff = (Byte*)[validData bytes];
-    game->GameProcessBuf(buff, (int)validData.length);
-    
-    int length = 4;
-    int result[length];
-    game->getGameResult(result);
-//   NSLog(@"result == %d %d %d %d \n",result[0],result[1],result[2],result[3]);
+-(void)shoseSDK:(NSData*)characteristic{
         
-    /******************左右脚动作数据处理 + 回调*****************/
-    int motionLeft = result[0];//左脚的动作
-    int motionRight = result[1];//右脚的动作
-    int motionJump = result[2];//jump
-    int motionDown = result[3];//down
-//    if (motionLeft==-1 && motionRight == -1&& motionJump == -1&& motionDown == -1){//无效动作
-//        return;
-//    }else{
-        //跳跃和蹲下的动作 双脚是同步的
-        if (motionJump == MOTION_JUMP){
-            motionLeft = motionJump;
-            motionRight = motionJump;
-            NSLog(@" 主设备 ================================== 跳起来 ");
-        }
-    
-        if (motionDown == MOTION_DOWN){
-            motionLeft = motionDown;
-            motionRight = motionDown;
-            NSLog(@" 主设备 =================================== 蹲下去 ");
-        }
-//    }
-    
-    /******************步频数据处理 + 回调*****************/
-    int leftStepStatus =  game->getStepStatus(LEFT_FOOT);
-    int leftStepFreq =  game->getStepFreq(LEFT_FOOT);
-    int leftStepCount =  game->getStepCount(LEFT_FOOT);
-    int rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
-    int rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
-    int rightStepCount =  game->getStepCount(RIGHT_FOOT);
-    
-    /******************玩家当前朝向 用户赛车*****************/
-    int attLength = 3;
-    int left[attLength];
-    int right[attLength];
-     game->getFootAtt(left, right);
-    self.nativeAttX = left[0];
-//    NSLog(@"self.nativeAttX = %d",self.nativeAttX);
-    
-    /****************** ios call unity*****************/
-        if (self.gameModel==YES){//当前是游戏模式
-            //跑酷需要回调步频
-            if (self.game_type == GAME_TYPE_RUN){
-                [self.sdk bridgingStepAction:DEVICETYPE_MAIN leftStatus:leftStepStatus rightStatus:rightStepStatus leftFrag:leftStepFreq rightFrag:rightStepFreq];
-            }
-            //左右脚动作
-            [self.sdk bridgingMotionAction:DEVICETYPE_MAIN left:motionLeft right:motionRight];
-
+        if (self.shoes_info.gameModel==YES){//当前是游戏模式
+            
+            /********************初始化 运动轨迹算法 SDK *****************/
+        //    NSLog(@"characteristic = %@",characteristic);
+            NSData * validData= [characteristic subdataWithRange:NSMakeRange(4, characteristic.length-4)];
+            Byte * buff = (Byte*)[validData bytes];
+            game->GameProcessBuf(buff, (int)validData.length);
+            
+            int length = 4;
+            int result[length];
+            game->getGameResult(result);
+        //   NSLog(@"result == %d %d %d %d \n",result[0],result[1],result[2],result[3]);
+                
+            /******************左右脚动作数据处理 + 回调*****************/
+            int motionLeft = result[0];//左脚的动作
+            int motionRight = result[1];//右脚的动作
+            int motionJump = result[2];//jump
+            int motionDown = result[3];//down
+            
+//            //无效动作
+//            if (motionLeft==-1 && motionRight == -1&& motionJump == -1&& motionDown == -1){
+//                return;
+//            }else{
+                
+                //跳跃和蹲下的动作 双脚是同步的
+                if (motionJump == MOTION_JUMP){
+                    motionLeft = motionJump;
+                    motionRight = motionJump;
+                    NSLog(@" 主设备 ================================== 跳起来 ");
+                }
+            
+                if (motionDown == MOTION_DOWN){
+                    motionLeft = motionDown;
+                    motionRight = motionDown;
+                    NSLog(@" 主设备 =================================== 蹲下去 ");
+                }
+                
+                /******************步频数据处理 + 回调*****************/
+            self.shoes_info.leftStepStatus =  game->getStepStatus(LEFT_FOOT);
+            self.shoes_info.leftStepFreq =  game->getStepFreq(LEFT_FOOT);
+            self.shoes_info.leftStepCount =  game->getStepCount(LEFT_FOOT);
+            self.shoes_info.rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
+            self.shoes_info.rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
+            self.shoes_info.rightStepCount =  game->getStepCount(RIGHT_FOOT);
+                
+                /******************玩家当前朝向 用户赛车*****************/
+            //    int attLength = 3;
+            //    int left[attLength];
+            //    int right[attLength];
+            //     game->getFootAtt(left, right);
+            //    self.nativeAttX = left[0];
+            //    NSLog(@"self.nativeAttX = %d",self.nativeAttX);
+                
+                //跑酷需要回调步频
+                if (self.game_info.game_type == GAME_TYPE_RUN){
+                    [self.sdk bridgingStepAction:DEVICETYPE_MAIN leftStatus:self.shoes_info.leftStepStatus rightStatus:self.shoes_info.rightStepStatus leftFrag:self.shoes_info.leftStepFreq rightFrag:self.shoes_info.rightStepFreq];
+                }
+                //左右脚动作
+                [self.sdk bridgingMotionAction:DEVICETYPE_MAIN left:motionLeft right:motionRight];
+                
+                //当局运动数据缓存
+                [self cacheAllMotionCount:self.shoes_info.leftStepCount+self.shoes_info.rightStepCount];
+                
+                //测试数据
+                [self tempTest:self.shoes_info.rightStepFreq leftStepFreq:self.shoes_info.leftStepFreq];
+            
+//            }
+            
+     
         }else{//当前是交互模式
 
 //            int interaction = game->getInteractionCMD();
@@ -637,30 +653,18 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 //            }
         }
     
-    /******************数据回调缓存*****************/
-    //标记初始值
-    if (self.initial_jump_count==0){
-        self.initial_jump_count = game->getGameJumpCount();
-    }
-    if (self.initial_down_count==0) {
-        self.initial_down_count = game->getGameDownCount();
-    }
-    //总数
-    int total_jump_count = game->getGameJumpCount();
-    int total_dump_count = game->getGameDownCount();
-    //当局游戏次数
-    int current_jump_count = total_jump_count - self.initial_jump_count;
-    int current_dump_count = total_dump_count - self.initial_down_count;
-    //数据回调缓存
-    [self cacheAllMotionCount:current_jump_count crouchCount:current_dump_count stepCount:leftStepCount + rightStepCount];
+}
+
+//算法需要的测试数据
+-(void)tempTest:(int)rightStepFreq leftStepFreq:(int)leftStepFreq{
     
     /********************剑波 & 威严 要的图表数据 *****************/
     NSString * aString = [NSString stringWithUTF8String:game->getGameDataStr().c_str()];
+//    NSLog(@"aString == %@",aString);
     if (aString.length <1){
         return;
     }
-//    NSLog(@"aString == %@",aString);
-
+   
     //上传即使动作数据
     [[SocketRocketUtility sharedInstance] sendData:nil withRequestURI:aString];
     if (DebugViewInstance.RSSI==nil){
@@ -686,8 +690,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
     /********************颖嘉+的ts丢包数据 *****************/
     NSString * tsString =  aArray[27];
-//    NSLog(@"tsString == %@",tsString);
-
+//    NSLog(@"剑波 getGameDataStr 时间戳 ==============>> %@\n",tsString);
     int tsInt = [tsString  intValue];
     int total;
     if (DebugViewInstance.currentTS != 1000){//颖嘉初始值未知 ios初始值==1000
@@ -703,7 +706,8 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
                 total = (255-DebugViewInstance.currentTS) + tsInt - 1;
             }
         }
-        if (total > 20){
+        if (total > 10){
+            NSLog(@"getGameDataStr 丢包 ================================>> %d",total);
             dispatch_async(dispatch_get_main_queue(), ^{
                 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
                 [PopupView showCusHUDA:[NSString stringWithFormat:@"丢包数: %d",total]];
@@ -716,41 +720,26 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 }
 
 #pragma mark ===============================================>>副设备 报文数据解析后 -- 调用蓝牙鞋子SDK装换数据 -- ios call unity 更新游戏动作
--(void)viceShoseSDKRight_pos:(int[3])right_pos
-                   Right_att:(int[3])right_att
-                   Right_acc:(int[3])right_acc
-                     LeftPos:(int[3])left_pos
-                    Left_att:(int[3])left_att
-                    Left_acc:(int[3])left_acc
-                          ts:(int)ts
-                   rightZupt:(int)rightZupt
-                    leftZupt:(int)leftZupt
-                        jump:(int)jump
-                        down:(int)down
-                        rssi:(int)rssi
-                   girlShoes:(int)girlShoes
-                 right_press:(int)right_press
-                  left_press:(int)left_press
-              characteristic:(NSData*)characteristic{
-
+-(void)viceShoseSDK:(NSData*)characteristic{
+    
     /********************初始化 运动轨迹算法 SDK *****************/
     //游戏数据
     NSData * validData= [characteristic subdataWithRange:NSMakeRange(4, characteristic.length-4)];
     Byte * buff = (Byte*)[validData bytes];
     viceDeviceGame->GameProcessBuf(buff, (int)validData.length);
-    
+
     int length = 4;
     int result[length];
     viceDeviceGame->getGameResult(result);
     //   NSLog(@"result == %d %d %d %d \n",result[0],result[1],result[2],result[3]);
 
     /********************蓝牙sdk返回的鞋子 状态 步频 步数*****************/
-    int leftStepStatus =  game->getStepStatus(LEFT_FOOT);
-    int leftStepFreq =  game->getStepFreq(LEFT_FOOT);
-    int leftStepCount =  game->getStepCount(LEFT_FOOT);
-    int rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
-    int rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
-    int rightStepCount =  game->getStepCount(RIGHT_FOOT);
+    int leftStepStatus =  viceDeviceGame->getStepStatus(LEFT_FOOT);
+    int leftStepFreq =  viceDeviceGame->getStepFreq(LEFT_FOOT);
+    int leftStepCount =  viceDeviceGame->getStepCount(LEFT_FOOT);
+    int rightStepStatus =  viceDeviceGame->getStepStatus(RIGHT_FOOT);
+    int rightStepFreq =  viceDeviceGame->getStepFreq(RIGHT_FOOT);
+    int rightStepCount =  viceDeviceGame->getStepCount(RIGHT_FOOT);
     
     /********************蓝牙sdk返回的鞋子 动作*****************/
     int motionLeft = result[0];//左脚的动作
@@ -758,9 +747,9 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     int ivce_motionJump = result[2];//jump
     int ivce_motionDown = result[3];//down
     
-//    if (motionLeft==-1 && motionRight == -1&& ivce_motionJump == -1&& ivce_motionDown == -1){//无效动作
-//        return;
-//    }else{
+    if (motionLeft==-1 && motionRight == -1&& ivce_motionJump == -1&& ivce_motionDown == -1){//无效动作
+        return;
+    }else{
         //跳跃和蹲下的动作 双脚是同步的
         if (ivce_motionJump == MOTION_JUMP){
             motionLeft = ivce_motionJump;
@@ -774,12 +763,14 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
         }
         
         //ios call unity
-        if (self.game_type == GAME_TYPE_RUN){//跑酷才需要回调
+        if (self.game_info.game_type == GAME_TYPE_RUN){//跑酷才需要回调
             [self.sdk bridgingStepAction:DEVICETYPE_VICE leftStatus:leftStepStatus rightStatus:rightStepStatus leftFrag:leftStepFreq rightFrag:rightStepFreq];//副设备左右脚速度 步频
         }
         //ios call unity
         [self.sdk bridgingMotionAction:DEVICETYPE_VICE left:motionLeft right:motionRight];//副设备左右脚动作
-
+        
+        }
+    
 }
 
 #pragma mark ===============================================>> 懒加载 -- 蓝牙设备数据源
@@ -790,27 +781,41 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     return _deviceArray;;
 }
 
-//数据存入plist
-//玩游戏过程中缓存 动作数据 和时间戳
--(void)cacheAllMotionCount:(int)jump_count crouchCount:(int)crouch_count stepCount:(int)step_count{
+#pragma mark ===============================================>>玩游戏过程中缓存 动作数据 和时间戳 数据存入plist
+-(void)cacheAllMotionCount:(int)totalStep{
     
-    //游戏持续时间
-    NSTimeInterval durationTime = [[NSDate date] timeIntervalSinceDate:self.firstTime];//游戏总共经历的时长 秒数
+    //总数
+    int total_step_count = game->getMotionCount(STEP_COUNT) - self.motionCountObj.step;
+    int total_jump_count = game->getMotionCount(JUMP_COUNT) - self.motionCountObj.jump;
+    int total_crouch_count = game->getMotionCount(DOWN_COUNT) - self.motionCountObj.crouch;
+    int total_tick_count = game->getMotionCount(KICK_COUNT) - self.motionCountObj.tick;
+    int total_paper_count = game->getMotionCount(PAPER_COUNT) - self.motionCountObj.paper;
+    int total_scissors_count = game->getMotionCount(SCISSORS_COUNT) - self.motionCountObj.scissors;
+    int total_rock_count = game->getMotionCount(ROCK_COUNT) - self.motionCountObj.rock;
+
     //缓存pilst文件
-    NSMutableDictionary * bleDict = [NSMutableDictionary new];
-    [bleDict setObject:[NSNumber numberWithInt:durationTime] forKey:@"duration"];
-    [bleDict setObject:[NSNumber numberWithInt:jump_count] forKey:@"jump"];
-    [bleDict setObject:[NSNumber numberWithInt:crouch_count] forKey:@"crouch"];
-    [bleDict setObject:[NSNumber numberWithInt:step_count] forKey:@"step"];
-    NSDictionary * dict = [NSDictionary dictionaryWithDictionary:bleDict];
+    NSMutableDictionary * motionCountObj = [NSMutableDictionary new];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_step_count] forKey:@"step"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_jump_count] forKey:@"jump"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_crouch_count] forKey:@"crouch"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_tick_count] forKey:@"tick"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_paper_count] forKey:@"paper"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_scissors_count] forKey:@"scissors"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_rock_count] forKey:@"rock"];
+    [motionCountObj setObject:[NSNumber numberWithInt:0] forKey:@"trample"];
+
+    NSMutableDictionary * movements = [NSMutableDictionary new];
+    [movements setObject:motionCountObj forKey:@"movements"];
+    NSTimeInterval durationTime = [[NSDate date] timeIntervalSinceDate:self.game_info.firstTime];//游戏总共经历的时长 秒数
+    [movements setObject:[NSNumber numberWithInt:durationTime] forKey:@"duration"];
+
+    NSDictionary * dict = [NSDictionary dictionaryWithDictionary:movements];
+        
     //归档缓存
-    [IOS_NSUSERDEFAULT setObject:dict forKey:IOSSDK_BLESDKDATA];
+    [IOS_NSUSERDEFAULT setObject:dict forKey:IOSSDK_MOTIONCOUNT];
     [IOS_NSUSERDEFAULT synchronize];
     
-   
-    
 }
 
 @end
 
-

+ 46 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/GameInfo.h

@@ -0,0 +1,46 @@
+//
+//  GameInfo.h
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/28.
+//
+
+#import <Foundation/Foundation.h>
+#import "LEONBLManager.h"
+
+//游戏类型
+typedef NS_ENUM(int, GAME_TYPE){
+    GAME_TYPE_DEMO =0, //
+    GAME_TYPE_RUN, //
+    GAME_TYPE_DANCE, //
+    GAME_TYPE_SDAER, //
+};
+
+
+@interface GameInfo : NSObject
+
+//弹窗 unity主动选择链接 主0 副1 设备
+@property(assign,nonatomic)DEVICE_TYPE deviceType;
+
+//游戏种类
+@property(assign,nonatomic)GAME_TYPE game_type;
+
+//程序在前台还是后台
+@property(assign,nonatomic)int isBackGround;
+
+//当局游戏时长
+@property(nonatomic,strong)NSDate * firstTime;
+
+//当局游戏动作数据
+@property(assign,nonatomic)int step;
+@property(assign,nonatomic)int jump;
+@property(assign,nonatomic)int crouch;
+@property(assign,nonatomic)int tick;
+@property(assign,nonatomic)int trample;
+@property(assign,nonatomic)int scissors;
+@property(assign,nonatomic)int rock;
+@property(assign,nonatomic)int paper;
+
+
+@end
+

+ 12 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/GameInfo.m

@@ -0,0 +1,12 @@
+//
+//  GameInfo.m
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/28.
+//
+
+#import "GameInfo.h"
+
+@implementation GameInfo
+
+@end

+ 12 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/LEONBLManager.h

@@ -78,6 +78,18 @@ typedef void(^RSSIBlock)(NSNumber *RSSI);
 @property(nonatomic,strong)CBCharacteristic * viceWrite;
 @property(nonatomic,strong)CBCharacteristic * viceRead;
 
+//防止同一条数据回调多次
+@property(assign,nonatomic)int main_read;
+@property(assign,nonatomic)int vice_read;
+
+/**测试参数start*/
+//临时的时间戳
+@property(assign,nonatomic)int totalPackages;
+@property(assign,nonatomic)int totalLoss;
+@property(assign,nonatomic)int tempTs;
+/**测试参数end*/
+
+
 /**
  声明单例类
  */

+ 46 - 14
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/LEONBLManager.m

@@ -5,6 +5,7 @@
 //  Created by Leon on 2021/4/23.
 
 #import "LEONBLManager.h"
+#import "AlgorithmTool.h"
 
 //CBCentralManagerDelegate 蓝牙外设回调代理
 //CBPeripheralDelegate 蓝牙链接后的数据回调代理
@@ -71,7 +72,7 @@ static LEONBLManager * instance;
  */
 - (void)scanForPeripheralsWithServices:(nullable NSArray<CBUUID *> *)serviceUUIDs options:(nullable NSDictionary<NSString *, id> *)options{
     [self.centralManager scanForPeripheralsWithServices:serviceUUIDs options:options];
-//    NSLog(@"开始扫描外设");
+    NSLog(@"开始扫描外设");
 }
 
 /**
@@ -89,6 +90,8 @@ static LEONBLManager * instance;
  */
 - (void)connectPeripheral:(CBPeripheral *)peripheral options:(nullable NSDictionary<NSString *, id> *)options{
     
+    [self stopScan];
+    
     if (peripheral==self.peripheral){
         [self.centralManager connectPeripheral:self.peripheral options:options];
         NSLog(@"主设备 主动连接蓝牙外设 = %@  %p  %p",self.peripheral.name,self.peripheral,peripheral);
@@ -250,10 +253,10 @@ static LEONBLManager * instance;
 - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(nullable NSError *)error{
     
 //    NSLog(@"发现所有服务+特征的值  %p  %p %p",self.peripheral,self.vicePeripheral,peripheral);
-
+    __weak __typeof(self)weakself = self;
     if (_discoverCharacteristicsBlock){
         
-        if (peripheral==self.peripheral){
+        if (peripheral == weakself.peripheral){
             
             _discoverCharacteristicsBlock(peripheral,service,service.characteristics,error);
             
@@ -271,7 +274,7 @@ static LEONBLManager * instance;
 
             }
 
-        }else if (peripheral == self.vicePeripheral){
+        }else if (peripheral == weakself.vicePeripheral){
             
             _discoverCharacteristicsBlock(peripheral,service,service.characteristics,error);
             NSLog(@"副设备 发现 %@ 服务+特征",peripheral.name);
@@ -285,18 +288,45 @@ static LEONBLManager * instance;
 //收到数据的回调
 - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error{
     
+    __weak __typeof(self)weakself = self;
     if (_readValueForCharacteristicBlock){
-        
+                
         NSData *data = characteristic.value;
 
-        if (peripheral==self.peripheral){
+        if (peripheral == weakself.peripheral){
             
-            _readValueForCharacteristicBlock(self.peripheral,characteristic,data,error,DEVICETYPE_MAIN);
-//            NSLog(@"收到主设备 %@ 推送的报文 %@",peripheral.name,data);
+            if (characteristic.value.length >60){
+                
+                weakself.main_read = 0;
 
-        }else if (peripheral == self.vicePeripheral){
+                int newTs = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
+                
+                self.totalPackages++;
+                int total_loss = self.tempTs - abs(newTs);
+                int abs_loss = abs(total_loss);
+//                NSLog(@"收到主设备 推送的报文 时间戳 ================ >>%d %d 【%d - %d = %d】",self.totalPackages,newTs,self.tempTs,abs(newTs),abs_loss);
+                
+                if (abs_loss>2){
+                self.totalLoss = self.totalLoss+(abs_loss/2-1);
+//                NSLog(@"系统api丢包 ===================================================================== >> %d %d/%d",abs_loss/2-1,self.totalLoss,self.totalPackages);
+                }
+                
+                self.tempTs = abs(newTs);
+                
+            }
+            
+            _readValueForCharacteristicBlock(weakself.peripheral,characteristic,data,error,DEVICETYPE_MAIN);
+//            NSLog(@"收到主设备 %@ 推送的报文 %@",peripheral.name,data);
+           
+        }else if (peripheral == weakself.vicePeripheral){
+            
+            if (characteristic.value.length >60){
+//                int ts = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
+//                NSLog(@"收到副设备 推送的报文 时间戳 ==============>> %d",ts);
+                weakself.vice_read = 0;
+            }
             
-            _readValueForCharacteristicBlock(self.vicePeripheral,characteristic,data,error,DEVICETYPE_VICE);
+            _readValueForCharacteristicBlock(weakself.vicePeripheral,characteristic,data,error,DEVICETYPE_VICE);
 //            NSLog(@"收到副设备 %@ 推送的报文 %@",peripheral.name,data);
 
         }
@@ -308,16 +338,18 @@ static LEONBLManager * instance;
 //写入数据的回调
 - (void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(nullable NSError *)error{
   
+    __weak __typeof(self)weakself = self;
+
     if (_writeToCharacteristicBlock){
         
-        if (peripheral==self.peripheral){
+        if (peripheral==weakself.peripheral){
             
-            _writeToCharacteristicBlock(self.peripheral,characteristic,error,DEVICETYPE_MAIN);
+            _writeToCharacteristicBlock(weakself.peripheral,characteristic,error,DEVICETYPE_MAIN);
 //            NSLog(@"收到主设备 %@ 的response",peripheral.name);
 
-        }else if (peripheral == self.vicePeripheral){
+        }else if (peripheral == weakself.vicePeripheral){
             
-            _writeToCharacteristicBlock(self.vicePeripheral,characteristic,error,DEVICETYPE_VICE);
+            _writeToCharacteristicBlock(weakself.vicePeripheral,characteristic,error,DEVICETYPE_VICE);
 //            NSLog(@"收到附设备 %@ 的response",peripheral.name);
 
         }

+ 0 - 51
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/MainShoesAnalysis.h

@@ -1,51 +0,0 @@
-////
-////  MainShoesAnalysis.h
-////  Unity-iPhone
-////
-////  Created by duowan123 on 2021/12/4.
-////
-//
-//#import <Foundation/Foundation.h>
-//#import "MYFactoryManager.h"
-//
-//NS_ASSUME_NONNULL_BEGIN
-//
-//@interface MainShoesAnalysis : NSObject
-//
-//
-//+(instancetype)sharedInstance;
-//
-////弹窗 unity主动选择链接 主0 副1 设备
-//@property(assign,nonatomic)DEVICE_TYPE deviceType;
-////游戏种类 1是跳舞 3是跑酷 2是赛达尔传说 4是demo->dance
-//@property(assign,nonatomic)GAME_TYPE game_type;
-//
-////主设备跳起 下蹲 步数 的总数
-//@property(assign,nonatomic)int initial_jump_count;
-//@property(assign,nonatomic)int initial_down_count;
-////步数回调缓存
-//@property(copy,nonatomic)void (^allMotionCountBLock)(int jump_count,int crouch_count,int step_count);//蓝牙设备数据源
-////脚步交互数据
-//@property(copy,nonatomic)void (^getInteractionBlock)(int interaction);//蓝牙设备数据源
-//
-//@property(assign,nonatomic)int isBackGround;//程序在前台还是后台
-//
-//@property(nonatomic,assign)BOOL gameModel;//是否开启游戏模式
-//
-///*****测试*******/
-//@property (nonatomic,strong)UILabel * testLabel;//调试框
-//@property (nonatomic,strong)UIButton * uploadButton;//上传
-//@property (nonatomic,strong)UIButton * clearnButton;//上传
-//
-////当前的时间戳+丢包
-//@property (nonatomic,assign)int  tempTs;
-//@property (nonatomic,assign)int  loss;
-//@property (nonatomic,assign)int  totalPackages;
-//@property (nonatomic,strong)NSString * tempStepString;//剑波要的字符串数据 缓存plist
-//@property(nonatomic,assign) NSNumber *RSSI;//威严要的测试数据
-//@property(nonatomic,assign) int currentTS;//颖嘉要的测试数据
-//
-//
-//@end
-//
-//NS_ASSUME_NONNULL_END

+ 0 - 551
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/MainShoesAnalysis.mm

@@ -1,551 +0,0 @@
-////
-////  MainShoesAnalysis.m
-////  Unity-iPhone
-////
-////  Created by duowan123 on 2021/12/4.
-////
-//
-//#import "MainShoesAnalysis.h"
-//
-//@interface MainShoesAnalysis()
-//{
-//@private
-//Game *game;
-//}
-//
-//@end
-//
-//@implementation MainShoesAnalysis
-//
-////单例静态
-//static MainShoesAnalysis* instance = nil;
-//+(instancetype)sharedInstance{
-////    NSLog(@"创建单例一次 1");
-//     return [[self alloc] init];
-//}
-//
-//+ (instancetype)allocWithZone:(struct _NSZone *)zone{
-////    NSLog(@"创建单例一次 2");
-//  static dispatch_once_t onceToken;
-//  dispatch_once(&onceToken, ^{
-//      instance = [super allocWithZone:zone];
-//  });
-//  return instance;
-//}
-//
-//- (instancetype)init{
-////    NSLog(@"创建单例一次 3");
-//    static dispatch_once_t onceToken;
-//    dispatch_once(&onceToken, ^{
-//        instance = [super init];
-//    });
-//    return instance;
-//}
-//
-//#pragma mark ===============================================>> 校验 & 报文数据解析
-//-(void)verifyData:(CBCharacteristic*)characteristic deviceType:(DEVICE_TYPE)deviceType{
-//    
-//     if (characteristic.value.length>3){
-//         
-//         //带cmd位的有效数据  计算校验位
-//         if ([AlgorithmTool verificationRusult:characteristic.value]==YES){
-//             
-//             [self analysisCharacteristic:characteristic.value deviceType:deviceType];
-//                              
-//         }
-//         
-//     }else{
-//         
-//         NSLog(@"无效报文");
-//         
-//     }
-//     
-//}
-//
-//-(void)analysisCharacteristic:(NSData*)characteristic deviceType:(DEVICE_TYPE)deviceType{
-//        
-////        NSLog(@"接收到的数据data = %@",characteristic);
-//    
-//    int frameHead = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(0, 1)]];//帧头数据aa
-//    int messageLength = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(1, 1)]];//报文长度
-//    int messageLengthNegation = ~messageLength;//报文长度取反
-//    int dataType = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
-//    
-//      if (dataType == 4){//获取主动推过来的数据
-//            //右脚坐标数据
-//           int right_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(4, 4)];
-//           int right_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(8, 4)];
-//           int right_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(12, 4)];
-//           int  right_pos[3] = {right_X,right_Y,right_Z};
-//          //左脚坐标数据
-//           int left_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(16, 4)];
-//           int left_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(20, 4)];
-//           int left_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(24, 4)];
-//           int  left_pos[3] = {left_X,left_Y,left_Z};
-//           //右脚姿势数据
-//           short righrPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(28, 2)];
-//           short righrPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(30, 2)];
-//           short righrPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(32, 2)];
-//           int  right_att[3] = {righrPosture_X,righrPosture_Y,righrPosture_Z};
-//           //左脚姿势数据
-//           short leftPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(34, 2)];
-//           short leftPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(36, 2)];
-//           short leftPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(38, 2)];
-//           int  left_att[3] = {leftPosture_X,leftPosture_Y,leftPosture_Z};
-//           //右脚三维数据
-//           short righrAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(40, 2)];
-//           short righrAcc_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(42, 2)];
-//           short righrAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(44, 2)];
-//           int  righrAcc[3] = {righrAcc_x,righrAcc_Y,righrAcc_z};
-//           //左脚三维数据
-//           short leftAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(46, 2)];
-//           short leftAcc_y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(48, 2)];
-//           short leftAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(50, 2)];
-//           int  left_acc[3] = {leftAcc_x,leftAcc_y,leftAcc_z};
-//           //左脚、右脚、蹲 、跳四个动作信息数据
-//           int actionInformation =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(52, 1)]];;//0c 16进制字符串
-//                       int girlShoes  = actionInformation & 16;
-//                       if (girlShoes!=0){
-//                           girlShoes=1;
-//                       }else{
-//                           girlShoes=0;
-//                       }
-//                       int rightZupt  = actionInformation & 8;
-//                       if (rightZupt!=0){
-//                           rightZupt=1;
-//                       }else{
-//                           rightZupt=0;
-//                       }
-//                       int leftZupt = actionInformation & 4;
-//                       if (leftZupt!=0){
-//                            leftZupt=1;
-//                        }else{
-//                            leftZupt=0;
-//                        }
-//                       int down  = actionInformation & 2;
-//                       if (down!=0){
-//                            down=1;
-//                        }else{
-//                            down=0;
-//                        }
-//                       int jump  = actionInformation & 1;
-//                       if (jump!=0){
-//                            jump=1;
-//                        }else{
-//                            jump=0;
-//                        }
-//          
-//            int rssi = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(53, 1)]];//rssi 信号强度
-//            int ts = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
-//            int right_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(55, 2)]];//3 29新增 右鞋压力
-//            int left_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(57, 2)]];//3 29新增 左鞋压力
-//            int frameCheck =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(59, 1)]];//校验位
-//        
-//               if (deviceType==DEVICETYPE_MAIN){//主设备
-//                   
-////                   NSLog(@"主设备 接收到 鞋子动作数据 data = %@",characteristic);
-//                   //调取鞋子SDK
-//                   [self shoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righrAcc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
-//                   
-//               }else if (deviceType==DEVICETYPE_VICE){//副设备动作数据
-//                   
-////                   NSLog(@"副设备 接收到 鞋子动作数据 data = %@",characteristic);
-//                   //调取鞋子SDK
-//  
-//                   
-//               }
-//              
-//        }else if (dataType == -95){//获取的是查询的数据 char-->int a1 = -95
-//
-//            if (characteristic.length == 74){//A1+0  >> 0: 设备基本信息 ==>> 预留参数 趣动app用 sdk暂未调用
-//                
-////                NSString *deviceModel = [[NSString alloc] initWithData:[characteristic subdataWithRange:NSMakeRange(5, 18)] encoding:NSUTF8StringEncoding];
-////                NSString *softwareVer = [AlgorithmTool hexadecimalString:[characteristic subdataWithRange:NSMakeRange(69, 2)]];//0102
-////                NSString *hardwareVer = [AlgorithmTool hexadecimalString:[characteristic subdataWithRange:NSMakeRange(71, 2)]];//0104
-//                
-//            }else if (characteristic.length == 26){//A1+1 >> 1: 设备数据(左鞋,右鞋)  aa 14 eb a1 01 64 00 1a 0000981d 64 00 17 00000000 f9
-//                
-//                int leftElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(5, 1)]];
-////                int leftTempreature = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(6, 1)]];
-////                int leftPressure = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(7, 4)]];
-////                int leftStepCount = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(11, 4)]];
-////                int rightElectricity = [self dataToInt:[characteristic subdataWithRange:NSMakeRange(12, 1)]];
-//                int rightElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(15, 1)]];//龙哥新协议
-////                int rightTempreature = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(16, 1)]];
-////                int rightPressure = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(17, 4)]];
-////                int rightStepCount = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(21, 4)]];
-//                
-//                if (deviceType==DEVICETYPE_MAIN && LEManager.peripheral!=nil){//主设备
-//                    
-////                    NSLog(@"主设备 接收到 鞋子硬件数据 data 26 = %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
-//
-//                    //主 设备定时器 60秒调一次   /******************ios call unity*****************/
-//                     [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_MAIN
-//                                                 name:LEManager.peripheral.name
-//                                              address:LEManager.peripheral.identifier.UUIDString
-//                                               status:CONNECT_ED
-//                                          electricity:20];
-//             
-//                }else if (deviceType==DEVICETYPE_VICE && LEManager.vicePeripheral!=nil){//副设备
-//                    
-//                    NSLog(@"副设备 接收到 鞋子硬件数据 26 = %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
-//
-//                    //副 设备定时器 60秒调一次   /******************ios call unity*****************/
-//                     [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_VICE
-//                                                 name:LEManager.vicePeripheral.name
-//                                              address:LEManager.vicePeripheral.identifier.UUIDString
-//                                               status:CONNECT_ED
-//                                          electricity:leftElectricity<=rightElectricity?leftElectricity:rightElectricity];
-//                    
-//                }
-//             
-//           }
-//            
-//      }
-//    
-//}
-//
-//#pragma mark ===============================================>> 主设备 报文数据解析后 -- 调用蓝牙鞋子SDK装换数据 -- ios call unity 更新游戏动作
-//-(void)shoseSDKRight_pos:(int[3])right_pos
-//               Right_att:(int[3])right_att
-//               Right_acc:(int[3])right_acc
-//                 LeftPos:(int[3])left_pos
-//                Left_att:(int[3])left_att
-//                Left_acc:(int[3])left_acc
-//                      ts:(int)ts
-//               rightZupt:(int)rightZupt
-//                leftZupt:(int)leftZupt
-//                    jump:(int)jump
-//                    down:(int)down
-//                    rssi:(int)rssi
-//               girlShoes:(int)girlShoes
-//             right_press:(int)right_press
-//              left_press:(int)left_press
-//          characteristic:(NSData*)characteristic{
-//    
-//    /********************初始化 运动轨迹算法 SDK *****************/
-//    //游戏数据
-//    NSData * validData= [characteristic subdataWithRange:NSMakeRange(4, characteristic.length-4)];
-//    Byte * buff = (Byte*)[validData bytes];
-//    game->GameProcessBuf(buff, (int)validData.length);
-//    
-//    int length = 4;
-//    int result[length];
-//    game->getGameResult(result);
-//    //   NSLog(@"result == %d %d %d %d \n",result[0],result[1],result[2],result[3]);
-//
-//    
-//    /******************步频数据处理 + 回调*****************/
-//    int leftStepStatus =  game->getStepStatus(LEFT_FOOT);
-//    int leftStepFreq =  game->getStepFreq(LEFT_FOOT);
-//    int leftStepCount =  game->getStepCount(LEFT_FOOT);
-//    int rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
-//    int rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
-//    int rightStepCount =  game->getStepCount(RIGHT_FOOT);
-//        
-//    /******************左右脚动作数据处理 + 回调*****************/
-//    int motionLeft = result[0];//左脚的动作
-//    int motionRight = result[1];//右脚的动作
-//    int motionJump = result[2];//jump
-//    int motionDown = result[3];//down
-////    if (motionLeft==-1 && motionRight == -1&& motionJump == -1&& motionDown == -1){//无效动作
-////        return;
-////    }else{
-//        //跳跃和蹲下的动作 双脚是同步的
-//        if (motionJump == MOTION_JUMP){
-//            motionLeft = motionJump;
-//            motionRight = motionJump;
-//            NSLog(@" 主设备 ================================== 跳起来 ");
-//        }
-//    
-//        if (motionDown == MOTION_DOWN){
-//            motionLeft = motionDown;
-//            motionRight = motionDown;
-//            NSLog(@" 主设备 =================================== 蹲下去 ");
-//        }
-////    }
-//    
-//    /****************** ios call unity*****************/
-//        if (self.gameModel==YES){//当前是游戏模式
-//
-//            //跑酷需要回调步频
-//            if (self.game_type == GAME_TYPE_RUN){
-//                [[IOSPlatformSDK sharedInstance] bridgingStepAction:DEVICETYPE_MAIN leftStatus:leftStepStatus rightStatus:rightStepStatus leftFrag:leftStepFreq rightFrag:rightStepFreq];
-//            }
-//            //左右脚动作
-//            [[IOSPlatformSDK sharedInstance] bridgingMotionAction:DEVICETYPE_MAIN left:motionLeft right:motionRight];
-//
-//        }else{//当前是交互模式
-//
-//            int interaction = game->getInteractionCMD();
-////            NSLog(@"主设备 当前的脚步交互动作 ===== >> %d",interaction);
-//            [[IOSPlatformSDK sharedInstance] bridgingInteraction:DEVICETYPE_MAIN code:interaction];
-//            if (self.getInteractionBlock){
-//                self.getInteractionBlock(interaction);
-//            }
-//        }
-//    
-//    /******************数据回调缓存*****************/
-//    //标记初始值
-//    if (self.initial_jump_count==0){
-//        self.initial_jump_count = game->getGameJumpCount();
-//    }
-//    if (self.initial_down_count==0) {
-//        self.initial_down_count = game->getGameDownCount();
-//    }
-//    //总数
-//    int total_jump_count = game->getGameJumpCount();
-//    int total_dump_count = game->getGameDownCount();
-//    //当局游戏次数
-//    int current_jump_count = total_jump_count - self.initial_jump_count;
-//    int current_dump_count = total_dump_count - self.initial_down_count;
-//    //数据回调缓存
-//    if (self.allMotionCountBLock){
-//        self.allMotionCountBLock(current_jump_count, current_dump_count, leftStepCount + rightStepCount);
-//    }
-//    
-//    /********************剑波 & 威严 要的图表数据 *****************/
-//    NSString * aString = [NSString stringWithUTF8String:game->getGameDataStr().c_str()];
-//    if (self.RSSI==nil){
-//        self.RSSI = 0;
-//    }
-//     aString = [NSString stringWithFormat:@"%@,%@",aString,self.RSSI];
-//    self.tempStepString = [NSString stringWithFormat:@"%@\n",aString];
-//    if (self.tempStepString!=nil && self.tempStepString.length>1){
-//        [self writeFileToplist];
-//    }
-//  
-//    /********************调试窗数据 *****************/
-//    NSArray *aArray = [self.tempStepString componentsSeparatedByString:@","];
-////    dispatch_async(dispatch_get_main_queue(), ^{
-//        if (self.testLabel!=nil){
-//            self.testLabel.text = [NSString stringWithFormat:@"right:[%d,%d,%d] [%d,%d,%d] [%d,%d,%d] \nleft:[%d,%d,%d] [%d,%d,%d] [%d,%d,%d] \nZupt:[%d,%d]  press:[%d,%d] \nj&d[%d %d]  rssi:[%d %@] ts:%d \n脚步: %@ %@\n步频: %d %d ",right_pos[0],right_pos[1],right_pos[2],right_att[0],right_att[1],right_att[2],right_acc[0],right_acc[1],right_acc[2],left_pos[0],left_pos[1],left_pos[2],left_att[0],left_att[1],left_att[2],left_acc[0],left_acc[1],left_acc[2],rightZupt,leftZupt,right_press,left_press,jump,down,rssi,self.RSSI,ts,aArray[aArray.count-2],aArray.lastObject,leftStepFreq,rightStepFreq];
-//        }
-////    });
-//    
-//    /********************颖嘉+的ts丢包数据 *****************/
-//    NSString * tsString =  aArray[aArray.count-4];
-//    int tsInt = [tsString  intValue];
-//    int total;
-//    //1....255
-//    if (tsInt > self.currentTS){
-//         total = tsInt - self.currentTS - 1;
-//    }
-//    //255...1
-//    if (tsInt < self.currentTS){
-//        if (tsInt ==0) {
-//            total = (255-self.currentTS) + tsInt + 1 - 1;
-//        }else{
-//            total = (255-self.currentTS) + tsInt - 1;
-//        }
-//    }
-////    NSLog(@"tsInt = %d  currentTS = %d total = %d",tsInt,self.currentTS,total);
-//    if (total > 20){
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
-//            [PopupView showCusHUDA:[NSString stringWithFormat:@"丢包数: %d",total]];
-//        });
-//    }
-//    self.currentTS = tsInt;
-//    
-//}
-//
-//
-//#pragma mark ===============================================>> DEBUG
-//-(void)inittestLabel{
-//
-//    if (self.testLabel!=nil){
-//        [self.testLabel removeFromSuperview];
-//    }
-//    
-//    if (self.uploadButton!=nil){
-//        [self.uploadButton removeFromSuperview];
-//    }
-//    
-//    if (self.clearnButton!=nil){
-//        [self.clearnButton removeFromSuperview];
-//    }
-//    
-//    self.uploadButton = [UIButton buttonWithType:UIButtonTypeCustom];
-//    self.uploadButton.frame = CGRectMake(30, SCREEN_HEIGHT-40-10, SCALEoefficient(75), SCALEoefficient(30));
-//    self.uploadButton.backgroundColor = [UIColor redColor];
-//    [self.uploadButton addTarget: self action: @selector (button1BackGroundHighlighted:) forControlEvents:UIControlEventTouchDown];
-//    [self.uploadButton addTarget: self action: @selector (button1BackGroundNormal:) forControlEvents:UIControlEventTouchUpInside];
-//    [self.uploadButton setFont: [UIFont boldSystemFontOfSize:SCALEoefficient(15)]];
-//    [self.uploadButton setTitle:@"上传" forState:UIControlStateNormal];
-//    [self.uploadButton addTarget:self action:@selector(uploadpPlistFile) forControlEvents:UIControlEventTouchUpInside];
-//    
-//    self.clearnButton = [UIButton buttonWithType:UIButtonTypeCustom];
-//    self.clearnButton.frame = CGRectMake(30+SCALEoefficient(75)+20, SCREEN_HEIGHT-40-10, SCALEoefficient(75), SCALEoefficient(30));
-//    self.clearnButton.backgroundColor = [UIColor redColor];
-////    [self.clearnButton addTarget:self action:@selector(button1BackGroundHighlighted:) forControlEvents:UIControlEventTouchDown];
-////    [self.clearnButton addTarget:self action:@selector(button1BackGroundNormal:) forControlEvents:UIControlEventTouchUpInside];
-//    [self.clearnButton setFont: [UIFont boldSystemFontOfSize:SCALEoefficient(15)]];
-//    [self.clearnButton setTitle:@"清理缓存" forState:UIControlStateNormal];
-//    [self.clearnButton addTarget:self action:@selector(clearCacheWithFilePath) forControlEvents:UIControlEventTouchUpInside];
-//    
-//    self.testLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCALEoefficient(20), 0, [UIScreen mainScreen].bounds.size.width-100, SCALEoefficient(160))];
-//    self.testLabel.textColor = [UIColor redColor];
-//    self.testLabel.font = [UIFont boldSystemFontOfSize:SCALEoefficient(14)];
-//    self.testLabel.backgroundColor = [UIColor clearColor];
-//    self.testLabel.textAlignment = NSTextAlignmentCenter;
-//    self.testLabel.numberOfLines = 0;
-//
-//    if ([UIApplication sharedApplication].keyWindow != nil){
-//        [[UIApplication sharedApplication].keyWindow addSubview:self.uploadButton];
-//        [[UIApplication sharedApplication].keyWindow addSubview:self.clearnButton];
-//        [[UIApplication sharedApplication].keyWindow addSubview:self.testLabel];
-//    }
-//
-//}
-//
-////  button普通状态下的背景色
-//- ( void )button1BackGroundNormal:(UIButton *)sender
-//{
-//     sender.backgroundColor = [UIColor redColor];
-//}
-// 
-////  button高亮状态下的背景色
-//- ( void )button1BackGroundHighlighted:(UIButton *)sender
-//{
-//     sender.backgroundColor = [UIColor orangeColor];
-//}
-//
-//#pragma mark ===============================================>> 存储和上传数据
-//- (void)clearCacheWithFilePath{
-//    
-//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//    //获取完整路径
-//    NSString *documentsDirectory = [paths objectAtIndex:0];
-//    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];//这里就是你将要存储的沙盒路径(.plist文件,名字自定义)
-//    NSError *error = nil;
-//    //删除子文件夹
-//    [[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
-//    if (error){
-//        NSLog(@"清理缓存失败");
-//        [PopupView showCusHUDA:@"清理失败"];
-//    }else{
-//        NSLog(@"清理缓存成功");
-//        [PopupView showCusHUDA:@"清理成功"];
-//    }
-//    
-//}
-//
-////数据写入沙河
-//-(void)writeFileToplist{
-//    
-//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//    //获取完整路径
-//    NSString *documentsDirectory = [paths objectAtIndex:0];
-//    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];//这里就是你将要存储的沙盒路径(.plist文件,名字自定义)
-//
-//    if(![[NSFileManager defaultManager] fileExistsAtPath:filePath]){//plistPath这个文件\文件夹是否存在
-//
-//        NSLog(@"-------文件不存在,写入文件----------");
-//
-//               NSError *error;
-//               if([self.tempStepString writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:&error]){
-//                   NSLog(@"------写入文件------success");
-//               }else{
-//                    NSLog(@"------写入文件------fail,error==%@",error);
-//               };
-//
-//    }else{
-//
-////     NSLog(@"-------文件存在,追加文件----------");
-//       NSFileHandle *fileHandle = [NSFileHandle fileHandleForUpdatingAtPath:filePath];
-//       [fileHandle seekToEndOfFile];  //将节点跳到文件的末尾
-//       NSData* stringData  = [self.tempStepString dataUsingEncoding:NSUTF8StringEncoding];
-//       [fileHandle writeData:stringData]; //追加写入数据
-//       [fileHandle closeFile];
-//
-//    }
-//
-//}
-//
-//-(void)uploadpPlistFile{
-//    
-//    //这个方法获取出的结果是一个数组.因为有可以搜索到多个路径.
-//    NSArray *array =  NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//    //在这里,我们指定搜索的是Cache目录,所以结果只有一个,取出Cache目录
-//    NSString *documentsDirectory = array[0];
-////    NSLog(@"%@",documentsDirectory);
-//    //拼接文件路径
-//    NSString *filePathName = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];
-//    //如果保存的是一个数组.那就通过数组从文件当中加载.
-//    NSString *string = [NSString stringWithContentsOfFile:filePathName encoding:NSUTF8StringEncoding error:nil];
-////    NSLog(@"%@",string);
-//    //4.设置请求体
-//    NSData *upData = [string dataUsingEncoding:NSUTF8StringEncoding];
-//    //
-//    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
-//    manager.requestSerializer.timeoutInterval=15;
-//    [manager.requestSerializer setValue:@"multipart/form-data" forHTTPHeaderField:@"Content-Type"];
-//    manager.requestSerializer = [AFJSONRequestSerializer serializer];
-//    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/html",@"application/json",@"text/javascript",@"image/jpeg",@"image/png",@"application/octet-stream",@"application/x-www-form-urlencoded", nil];
-//    //    NSLog(@"请求URL ===================>> %@",urlString);
-//    NSLog(@"******************* 请求头参数 = %@ ***************************",manager.requestSerializer.HTTPRequestHeaders);
-//    
-//    AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:nil];
-//    [sessionManager POST:@"http://172.16.14.127:8080/upload" parameters:nil headers:nil constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData){
-//
-//        [formData  appendPartWithFileData:upData name:@"file" fileName:[NSString stringWithFormat:@"ios_%@_%@.txt",Game_Type,[self getNowTimeTimestamp]] mimeType:@"text/plain"];
-//
-//        }progress:^(NSProgress * _Nonnull uploadProgress){
-//            NSLog(@"上传进度 = %@",uploadProgress);
-//
-//        }success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject){
-//            NSLog(@"上传成功");
-//
-//        }failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error){
-//
-//            for (NSString * key  in error.userInfo){
-//
-//                if ([key isEqualToString:@"com.alamofire.serialization.response.error.data"]){
-//
-//                    id errorObject = [NSJSONSerialization JSONObjectWithData:error.userInfo[key] options:1  error:nil];
-//
-//                    NSLog(@"上传失败 ===>> %@",errorObject);
-//                    if (errorObject !=nil && [errorObject isKindOfClass:[NSDictionary class]]){
-//                        NSString * result = errorObject[@"result"];
-//                        if ([result intValue] ==1){
-//                            [PopupView showCusHUDA:@"上传成功"];
-//                        }
-//                        
-//                    }
-//
-//                }
-//                
-//          }
-//            
-//    }];
-// 
-//}
-//
-////获取当前时间戳有两种方法(以秒为单位)
-//-(NSString *)getNowTimeTimestamp{
-//
-//    NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
-//
-//    [formatter setDateStyle:NSDateFormatterMediumStyle];
-//
-//    [formatter setTimeStyle:NSDateFormatterShortStyle];
-//
-//    [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
-//
-//    //设置时区,这个对于时间的处理有时很重要
-//
-//    NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
-//
-//    [formatter setTimeZone:timeZone];
-//
-//    NSDate *datenow = [NSDate date];//现在时间,你可以输出来看下是什么格式
-//
-//    NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[datenow timeIntervalSince1970]];
-//
-//    return timeSp;
-//
-//}
-//   
-//@end
-//

+ 30 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ShoesInfo.h

@@ -0,0 +1,30 @@
+//
+//  ShoesInfo.h
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/28.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ShoesInfo : NSObject
+
+//趣动跳转过来携带的mac 实际是蓝牙设备的identity
+@property(strong,nonatomic)NSString * macAddress;
+
+//鞋子是否开启游戏模式
+@property(nonatomic,assign)BOOL gameModel;
+
+//游戏鞋子状态
+@property(assign,nonatomic)int leftStepStatus;
+@property(assign,nonatomic)int leftStepFreq;
+@property(assign,nonatomic)int leftStepCount;
+@property(assign,nonatomic)int rightStepStatus;
+@property(assign,nonatomic)int rightStepFreq;
+@property(assign,nonatomic)int rightStepCount;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 12 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ShoesInfo.m

@@ -0,0 +1,12 @@
+//
+//  ShoesInfo.m
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/28.
+//
+
+#import "ShoesInfo.h"
+
+@implementation ShoesInfo
+
+@end

+ 0 - 16
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ViceShoesAnalysis.h

@@ -1,16 +0,0 @@
-//
-//  ViceShoesAnalysis.h
-//  Unity-iPhone
-//
-//  Created by duowan123 on 2021/12/4.
-//
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface ViceShoesAnalysis : NSObject
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 12
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/ViceShoesAnalysis.m

@@ -1,12 +0,0 @@
-//
-//  ViceShoesAnalysis.m
-//  Unity-iPhone
-//
-//  Created by duowan123 on 2021/12/4.
-//
-
-#import "ViceShoesAnalysis.h"
-
-@implementation ViceShoesAnalysis
-
-@end

+ 24 - 29
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/HTTPDataProcession.m

@@ -134,7 +134,7 @@
             result = [result stringByAppendingString:temp];
         }
     }
-    NSLog(@"result = %@",result);
+    NSLog(@"json = %@",result);
 
     return result;
     
@@ -418,44 +418,39 @@
            opponentId:(int)opponentId
      gameEndDataBlock:(GameEndDataBlock)gameEndDataBlock{
     
-    NSMutableDictionary * sportRecord = [NSMutableDictionary new];
+    NSMutableDictionary * gameRecord = [NSMutableDictionary new];
     //缓存的token、game_id
     NSString * game_id = [MYFactoryManager getGameId];
-    [sportRecord setObject:game_id forKey:@"game_id"];//游戏类型
+    [gameRecord setObject:game_id forKey:@"game_id"];//游戏类型
     //预留字段:默认
-    [sportRecord setObject:@0 forKey:@"consume"];//卡路里默认0
-    [sportRecord setObject:@0 forKey:@"screen"];//默认0
-    [sportRecord setObject:@0 forKey:@"distance"];//废弃
-    [sportRecord setObject:@0 forKey:@"is_cancel"];//是否正常停止游戏 正常0 不正常1
+    [gameRecord setObject:@0 forKey:@"distance"];//废弃
+    [gameRecord setObject:@0 forKey:@"is_cancel"];//是否正常停止游戏 正常0 不正常1
     //unity回调数据
-    [sportRecord setObject:[NSNumber numberWithInt:level] forKey:@"level"];
-    [sportRecord setObject:[NSNumber numberWithDouble:score] forKey:@"score"];
-    [sportRecord setObject:[NSNumber numberWithInt:record] forKey:@"record"];
-    [sportRecord setObject:[NSNumber numberWithInt:mode] forKey:@"mode"];
-    [sportRecord setObject:[NSNumber numberWithInt:opponentId] forKey:@"opponentId"];
+    [gameRecord setObject:[NSNumber numberWithDouble:score] forKey:@"score"];
+    [gameRecord setObject:[NSNumber numberWithInt:mode] forKey:@"mode"];
    
-   //新增加时间戳字段
+    //新增加时间戳字段
     if ( [IOS_NSUSERDEFAULT objectForKey:IOSSDK_TIMESTAMP]!=nil){
         NSString * timestamp =  [IOS_NSUSERDEFAULT objectForKey:IOSSDK_TIMESTAMP];
-        [sportRecord setObject:timestamp forKey:@"play_group"];
+        [gameRecord setObject:timestamp forKey:@"play_group"];
     }else{
-        [sportRecord setObject:[AlgorithmTool returnTimestamp] forKey:@"play_group"];
+        [gameRecord setObject:[AlgorithmTool returnTimestamp] forKey:@"play_group"];
     }
   
     //缓存的动作数据和持续时间
-    NSDictionary * acheDict = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_BLESDKDATA];
-    if (acheDict!=nil){
-        [sportRecord addEntriesFromDictionary:acheDict];
-    }else{
-        [sportRecord setObject:@0 forKey:@"jump"];
-        [sportRecord setObject:@0 forKey:@"crouch"];
-        [sportRecord setObject:@0 forKey:@"step"];
-        [sportRecord setObject:@0 forKey:@"duration"];
+    NSDictionary * movements = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_MOTIONCOUNT];
+    if (movements!=nil){
+//        [sportRecord addEntriesFromDictionary:movements];
+        NSDictionary * sub = movements[@"movements"];
+       NSData * jsonData = [NSJSONSerialization dataWithJSONObject:sub options:NSJSONWritingPrettyPrinted error:nil];
+       NSString * jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
+        [gameRecord setObject:jsonString forKey:@"movements"];
+        [gameRecord setObject:movements[@"duration"] forKey:@"duration"];
     }
     
-    NSLog(@"%@",sportRecord);
+    NSLog(@"gameRecord = %@",gameRecord);
 
-    [HTTPDataProcession postHTTPDataProcession:GAME_RECORD withParams:sportRecord  token:[MYFactoryManager getToken] success:^(id data){
+    [HTTPDataProcession postHTTPDataProcession:GAME_RECORD withParams:gameRecord  token:[MYFactoryManager getToken] success:^(id data){
         NSError * error;
         NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
 
@@ -465,18 +460,18 @@
 
             if (code==0){
                 
-                NSLog(@"GameEnd 上传成功 %@",dictionary);
+                NSLog(@"gameRecord 上传成功 %@",dictionary);
                 gameEndDataBlock(@"上传成功");
                 
-        }else{
-                NSLog(@"请求错误 =========== >>> %@",dictionary[@"msg"]);
+            }else{
+                NSLog(@"gameRecord 请求错误 =========== >>> %@",dictionary[@"msg"]);
              }
             
         }
         
     }fail:^(id errorDes){
         
-        NSLog(@"请求失败 =========== >>> %@",errorDes);
+        NSLog(@"gameRecord 请求失败 =========== >>> %@",errorDes);
 
     }];
     

+ 7 - 23
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/IOSPlatformSDK.mm

@@ -7,8 +7,7 @@
 
 
 #import "IOSPlatformSDK.h"
-//#import "AvoidCrash.h"
-//#import <Bugly/Bugly.h>
+#import "BugTool.h"
 
 #pragma mark ============================>> ios call unity (定义名字参数和C#类一样的方法)
 //大概流程就是先将C#的函数指针存入OC内存,在OC需要回调unity的时候就可以使用不同的指针来回调不同的unity方法
@@ -101,33 +100,18 @@ static IOSPlatformSDK * instance;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
         instance = [super init];
+        //初始蓝牙链接
         [BTDataProcess sharedInstance];
-//        [Bugly startWithAppId:@"36a0c05291"];
-        //防奔溃
-//        [AvoidCrash makeAllEffective];
-//        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dealwithCrashMessage:) name:AvoidCrashNotification object:nil];
+        //开始bug监控
+        [BugTool startAvoidBug];
     });
     return instance;
 }
 
-//- (void)dealwithCrashMessage:(NSNotification *)note{
-//
-// NSDictionary *info = note.userInfo;
-//  NSString *errorReason = [NSString stringWithFormat:@"【ErrorReason】%@========【ErrorPlace】%@========【DefaultToDo】%@========【ErrorName】%@", info[@"errorReason"], info[@"errorPlace"], info[@"defaultToDo"], info[@"errorName"]];
-//  NSLog(@"errorReason = %@",errorReason);
-//  NSArray *callStack = info[@"callStackSymbols"];
-//  [self reportErrorName:@"Bugly_ErrorName_AvoidCrash" errorReason:errorReason callStack:callStack extraInfo:nil];
-//
-//}
-//
-///** 上报错误信息 */
-//- (void)reportErrorName:(NSString *)errorName errorReason:(NSString *)errorReason callStack:(NSArray *)aStackArray extraInfo:(NSDictionary *)info{
-//    [Bugly reportExceptionWithCategory:3 name:errorName reason:errorReason callStack:aStackArray extraInfo:info terminateApp:NO];
-//}
-
 #pragma mark ============================>> public method app 跳转直链
 -(void)startWithUrl:(NSURL*)url{
     [BTDataInstance startWithUrl:url];
+    
 }
 
 //
@@ -249,7 +233,6 @@ extern "C" {void PointerActionHandler(ActionHandler  handler){
    }
 }
 
-
 /**
  * unity call ios 主动接收 函数指针
  * UserFriendsHandler 用于ios回调 "当前用户好友列表",在👇🏻GetUserFriends中实现
@@ -315,6 +298,7 @@ void GameEnd(int level, double score, int record, int mode, int opponentId){
     [HTTPDataProcession postGameRecord:level score:score record:record mode:mode opponentId:opponentId gameEndDataBlock:^(NSString *jsonString){
         NSLog(@"IOS_SKD 回调结束游戏请求 GameEnd ===> %@",jsonString);
     }];
+    
 }
 
 /**
@@ -422,8 +406,8 @@ void InviteFriend(int friendid,char * info){
         dispatch_async(dispatch_get_main_queue(), ^{
         [PopupView showCusHUDA:jsonString];
         });
-        
     }];
+    
 }
 
 /**

+ 116 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrash.h

@@ -0,0 +1,116 @@
+//
+//  AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+//===================================================
+//   使用方法和注意事项:
+//   https://www.jianshu.com/p/2b90aa96c0a0
+//===================================================
+
+#import <Foundation/Foundation.h>
+#import <objc/runtime.h>
+
+//category
+#import "NSObject+AvoidCrash.h"
+
+#import "NSArray+AvoidCrash.h"
+#import "NSMutableArray+AvoidCrash.h"
+
+#import "NSDictionary+AvoidCrash.h"
+#import "NSMutableDictionary+AvoidCrash.h"
+
+#import "NSString+AvoidCrash.h"
+#import "NSMutableString+AvoidCrash.h"
+
+#import "NSAttributedString+AvoidCrash.h"
+#import "NSMutableAttributedString+AvoidCrash.h"
+
+//define
+#import "AvoidCrashStubProxy.h"
+
+
+
+
+
+@interface AvoidCrash : NSObject
+
+//===================================================
+//   使用方法和注意事项:
+//   https://www.jianshu.com/p/2b90aa96c0a0
+//===================================================
+
+
+
+/**
+ *  
+ *  开始生效.你可以在AppDelegate的didFinishLaunchingWithOptions方法中调用becomeEffective方法
+ *  【默认不开启  对”unrecognized selector sent to instance”防止崩溃的处理】
+ *
+ *  这是全局生效,若你只需要部分生效,你可以单个进行处理,比如:
+ *  [NSArray avoidCrashExchangeMethod];
+ *  [NSMutableArray avoidCrashExchangeMethod];
+ *  .................
+ *  .................
+ *
+ */
++ (void)becomeEffective;
+
+
+/** 
+ *  相比于becomeEffective,增加
+ *  对”unrecognized selector sent to instance”防止崩溃的处理
+ *
+ *  但是必须配合:
+ *            setupClassStringsArr:和
+ *            setupNoneSelClassStringPrefixsArr
+ *            这两个方法可以同时使用
+ */
++ (void)makeAllEffective;
+
+
+
+/** 
+ *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名数组
+ *  ⚠️不可将@"NSObject"加入classStrings数组中
+ *  ⚠️不可将UI前缀的字符串加入classStrings数组中
+ */
++ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings;
+
+
+/**
+ *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名前缀的数组
+ *  ⚠️不可将UI前缀的字符串(包括@"UI")加入classStringPrefixs数组中
+ *  ⚠️不可将NS前缀的字符串(包括@"NS")加入classStringPrefixs数组中
+ */
++ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//您可以忽略以下方法
+
++ (void)exchangeClassMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel;
+
++ (void)exchangeInstanceMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel;
+
++ (void)noteErrorWithException:(NSException *)exception defaultToDo:(NSString *)defaultToDo;
+
+
+@end

+ 220 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrash.m

@@ -0,0 +1,220 @@
+//
+//  AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "AvoidCrash.h"
+
+
+
+
+#define key_errorName        @"errorName"
+#define key_errorReason      @"errorReason"
+#define key_errorPlace       @"errorPlace"
+#define key_defaultToDo      @"defaultToDo"
+#define key_callStackSymbols @"callStackSymbols"
+#define key_exception        @"exception"
+
+
+@implementation AvoidCrash
+
+
++ (void)becomeEffective {
+    [self effectiveIfDealWithNoneSel:NO];
+    
+}
+
++ (void)makeAllEffective {
+    [self effectiveIfDealWithNoneSel:YES];
+}
+
++ (void)effectiveIfDealWithNoneSel:(BOOL)dealWithNoneSel {
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        [NSObject avoidCrashExchangeMethodIfDealWithNoneSel:dealWithNoneSel];
+        
+        [NSArray avoidCrashExchangeMethod];
+        [NSMutableArray avoidCrashExchangeMethod];
+        
+        [NSDictionary avoidCrashExchangeMethod];
+        [NSMutableDictionary avoidCrashExchangeMethod];
+        
+        [NSString avoidCrashExchangeMethod];
+        [NSMutableString avoidCrashExchangeMethod];
+        
+        [NSAttributedString avoidCrashExchangeMethod];
+        [NSMutableAttributedString avoidCrashExchangeMethod];
+        
+    });
+}
+
++ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings {
+    [NSObject setupNoneSelClassStringsArr:classStrings];
+}
+
+/**
+ *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名前缀的数组
+ */
++ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs {
+    [NSObject setupNoneSelClassStringPrefixsArr:classStringPrefixs];
+}
+
+
+/**
+ *  类方法的交换
+ *
+ *  @param anClass    哪个类
+ *  @param method1Sel 方法1
+ *  @param method2Sel 方法2
+ */
++ (void)exchangeClassMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel {
+    Method method1 = class_getClassMethod(anClass, method1Sel);
+    Method method2 = class_getClassMethod(anClass, method2Sel);
+    method_exchangeImplementations(method1, method2);
+}
+
+
+/**
+ *  对象方法的交换
+ *
+ *  @param anClass    哪个类
+ *  @param method1Sel 方法1(原本的方法)
+ *  @param method2Sel 方法2(要替换成的方法)
+ */
++ (void)exchangeInstanceMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel {
+    
+    
+    Method originalMethod = class_getInstanceMethod(anClass, method1Sel);
+    Method swizzledMethod = class_getInstanceMethod(anClass, method2Sel);
+    
+    BOOL didAddMethod =
+    class_addMethod(anClass,
+                    method1Sel,
+                    method_getImplementation(swizzledMethod),
+                    method_getTypeEncoding(swizzledMethod));
+    
+    if (didAddMethod) {
+        class_replaceMethod(anClass,
+                            method2Sel,
+                            method_getImplementation(originalMethod),
+                            method_getTypeEncoding(originalMethod));
+    }
+    
+    else {
+        method_exchangeImplementations(originalMethod, swizzledMethod);
+    }
+    
+}
+
+
+
+/**
+ *  获取堆栈主要崩溃精简化的信息<根据正则表达式匹配出来>
+ *
+ *  @param callStackSymbols 堆栈主要崩溃信息
+ *
+ *  @return 堆栈主要崩溃精简化的信息
+ */
+
++ (NSString *)getMainCallStackSymbolMessageWithCallStackSymbols:(NSArray<NSString *> *)callStackSymbols {
+    
+    //mainCallStackSymbolMsg的格式为   +[类名 方法名]  或者 -[类名 方法名]
+    __block NSString *mainCallStackSymbolMsg = nil;
+    
+    //匹配出来的格式为 +[类名 方法名]  或者 -[类名 方法名]
+    NSString *regularExpStr = @"[-\\+]\\[.+\\]";
+    
+    
+    NSRegularExpression *regularExp = [[NSRegularExpression alloc] initWithPattern:regularExpStr options:NSRegularExpressionCaseInsensitive error:nil];
+    
+    
+    for (int index = 2; index < callStackSymbols.count; index++) {
+        NSString *callStackSymbol = callStackSymbols[index];
+        
+        [regularExp enumerateMatchesInString:callStackSymbol options:NSMatchingReportProgress range:NSMakeRange(0, callStackSymbol.length) usingBlock:^(NSTextCheckingResult * _Nullable result, NSMatchingFlags flags, BOOL * _Nonnull stop) {
+            if (result) {
+                NSString* tempCallStackSymbolMsg = [callStackSymbol substringWithRange:result.range];
+                
+                //get className
+                NSString *className = [tempCallStackSymbolMsg componentsSeparatedByString:@" "].firstObject;
+                className = [className componentsSeparatedByString:@"["].lastObject;
+                
+                NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(className)];
+                
+                //filter category and system class
+                if (![className hasSuffix:@")"] && bundle == [NSBundle mainBundle]) {
+                    mainCallStackSymbolMsg = tempCallStackSymbolMsg;
+                    
+                }
+                *stop = YES;
+            }
+        }];
+        
+        if (mainCallStackSymbolMsg.length) {
+            break;
+        }
+    }
+    
+    return mainCallStackSymbolMsg;
+}
+
+
+/**
+ *  提示崩溃的信息(控制台输出、通知)
+ *
+ *  @param exception   捕获到的异常
+ *  @param defaultToDo 这个框架里默认的做法
+ */
++ (void)noteErrorWithException:(NSException *)exception defaultToDo:(NSString *)defaultToDo {
+
+    //堆栈数据
+    NSArray *callStackSymbolsArr = [NSThread callStackSymbols];
+    
+    //获取在哪个类的哪个方法中实例化的数组  字符串格式 -[类名 方法名]  或者 +[类名 方法名]
+    NSString *mainCallStackSymbolMsg = [AvoidCrash getMainCallStackSymbolMessageWithCallStackSymbols:callStackSymbolsArr];
+    
+    if (mainCallStackSymbolMsg == nil) {
+        
+        mainCallStackSymbolMsg = @"崩溃方法定位失败,请您查看函数调用栈来排查错误原因";
+        
+    }
+    
+    NSString *errorName = exception.name;
+    NSString *errorReason = exception.reason;
+    //errorReason 可能为 -[__NSCFConstantString avoidCrashCharacterAtIndex:]: Range or index out of bounds
+    //将avoidCrash去掉
+    errorReason = [errorReason stringByReplacingOccurrencesOfString:@"avoidCrash" withString:@""];
+    
+    NSString *errorPlace = [NSString stringWithFormat:@"Error Place:%@",mainCallStackSymbolMsg];
+    
+    NSString *logErrorMessage = [NSString stringWithFormat:@"\n\n%@\n\n%@\n%@\n%@\n%@",AvoidCrashSeparatorWithFlag, errorName, errorReason, errorPlace, defaultToDo];
+    
+    logErrorMessage = [NSString stringWithFormat:@"%@\n\n%@\n\n",logErrorMessage,AvoidCrashSeparator];
+    AvoidCrashLog(@"%@",logErrorMessage);
+    
+    
+    //请忽略下面的赋值,目的只是为了能顺利上传到cocoapods
+    logErrorMessage = logErrorMessage;
+    
+    NSDictionary *errorInfoDic = @{
+                                   key_errorName        : errorName,
+                                   key_errorReason      : errorReason,
+                                   key_errorPlace       : errorPlace,
+                                   key_defaultToDo      : defaultToDo,
+                                   key_exception        : exception,
+                                   key_callStackSymbols : callStackSymbolsArr
+                                   };
+    
+    //将错误信息放在字典里,用通知的形式发送出去
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [[NSNotificationCenter defaultCenter] postNotificationName:AvoidCrashNotification object:nil userInfo:errorInfoDic];
+    });
+}
+
+
+
+@end

+ 17 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashProtocol.h

@@ -0,0 +1,17 @@
+//
+//  AvoidCrashProtocol.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by chenfanfang on 2017/7/22.
+//  Copyright © 2017年 chenfanfang. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+
+@protocol AvoidCrashProtocol <NSObject>
+
+@required
++ (void)avoidCrashExchangeMethod;
+
+@end

+ 37 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.h

@@ -0,0 +1,37 @@
+//
+//  AvoidCrashStubProxy.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by chenfanfang on 2017/7/25.
+//  Copyright © 2017年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+#define AvoidCrashNotification @"AvoidCrashNotification"
+#define AvoidCrashIsiOS(version) ([[UIDevice currentDevice].systemVersion floatValue] >= version)
+
+
+//user can ignore below define
+#define AvoidCrashDefaultReturnNil  @"AvoidCrash default is to return nil to avoid crash."
+#define AvoidCrashDefaultIgnore     @"AvoidCrash default is to ignore this operation to avoid crash."
+
+#define AvoidCrashSeparator         @"================================================================"
+#define AvoidCrashSeparatorWithFlag @"========================AvoidCrash Log=========================="
+
+
+#ifdef DEBUG
+
+#define  AvoidCrashLog(...) NSLog(@"%@",[NSString stringWithFormat:__VA_ARGS__])
+
+#else
+
+#define AvoidCrashLog(...)
+#endif
+
+@interface AvoidCrashStubProxy : NSObject
+
+- (void)proxyMethod;
+
+@end

+ 18 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.m

@@ -0,0 +1,18 @@
+//
+//  AvoidCrashStubProxy.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by chenfanfang on 2017/7/25.
+//  Copyright © 2017年 chenfanfang. All rights reserved.
+//
+
+#import "AvoidCrashStubProxy.h"
+
+
+@implementation AvoidCrashStubProxy
+
+- (void)proxyMethod {
+    
+}
+
+@end

+ 25 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.h

@@ -0,0 +1,25 @@
+//
+//  NSArray+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSArray (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1. NSArray的快速创建方式 NSArray *array = @[@"chenfanfang", @"AvoidCrash"];  //这种创建方式其实调用的是2中的方法
+ *  2. +(instancetype)arrayWithObjects:(const id  _Nonnull __unsafe_unretained *)objects count:(NSUInteger)cnt
+ *  3. - (id)objectAtIndex:(NSUInteger)index
+ *  4. - (void)getObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range
+ */    

+ 258 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.m

@@ -0,0 +1,258 @@
+//
+//  NSArray+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSArray+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSArray (AvoidCrash)
+
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        //=================
+        //   class method
+        //=================
+        
+        //instance array method exchange
+        [AvoidCrash exchangeClassMethod:[self class] method1Sel:@selector(arrayWithObjects:count:) method2Sel:@selector(AvoidCrashArrayWithObjects:count:)];
+        
+        
+        
+        //====================
+        //   instance method
+        //====================
+        
+        Class __NSArray = NSClassFromString(@"NSArray");
+        Class __NSArrayI = NSClassFromString(@"__NSArrayI");
+        Class __NSSingleObjectArrayI = NSClassFromString(@"__NSSingleObjectArrayI");
+        Class __NSArray0 = NSClassFromString(@"__NSArray0");
+        
+        
+        //objectsAtIndexes:
+        [AvoidCrash exchangeInstanceMethod:__NSArray method1Sel:@selector(objectsAtIndexes:) method2Sel:@selector(avoidCrashObjectsAtIndexes:)];
+        
+        
+        //objectAtIndex:
+        
+        [AvoidCrash exchangeInstanceMethod:__NSArrayI method1Sel:@selector(objectAtIndex:) method2Sel:@selector(__NSArrayIAvoidCrashObjectAtIndex:)];
+        
+        [AvoidCrash exchangeInstanceMethod:__NSSingleObjectArrayI method1Sel:@selector(objectAtIndex:) method2Sel:@selector(__NSSingleObjectArrayIAvoidCrashObjectAtIndex:)];
+        
+        [AvoidCrash exchangeInstanceMethod:__NSArray0 method1Sel:@selector(objectAtIndex:) method2Sel:@selector(__NSArray0AvoidCrashObjectAtIndex:)];
+        
+        //objectAtIndexedSubscript:
+        if (AvoidCrashIsiOS(11.0)) {
+            [AvoidCrash exchangeInstanceMethod:__NSArrayI method1Sel:@selector(objectAtIndexedSubscript:) method2Sel:@selector(__NSArrayIAvoidCrashObjectAtIndexedSubscript:)];
+        }
+        
+        
+        //getObjects:range:
+        [AvoidCrash exchangeInstanceMethod:__NSArray method1Sel:@selector(getObjects:range:) method2Sel:@selector(NSArrayAvoidCrashGetObjects:range:)];
+        
+        [AvoidCrash exchangeInstanceMethod:__NSSingleObjectArrayI method1Sel:@selector(getObjects:range:) method2Sel:@selector(__NSSingleObjectArrayIAvoidCrashGetObjects:range:)];
+        
+        [AvoidCrash exchangeInstanceMethod:__NSArrayI method1Sel:@selector(getObjects:range:) method2Sel:@selector(__NSArrayIAvoidCrashGetObjects:range:)];
+    });
+    
+    
+}
+
+
+//=================================================================
+//                        instance array
+//=================================================================
+#pragma mark - instance array
+
+
++ (instancetype)AvoidCrashArrayWithObjects:(const id  _Nonnull __unsafe_unretained *)objects count:(NSUInteger)cnt {
+    
+    id instance = nil;
+    
+    @try {
+        instance = [self AvoidCrashArrayWithObjects:objects count:cnt];
+    }
+    @catch (NSException *exception) {
+        
+        NSString *defaultToDo = @"AvoidCrash default is to remove nil object and instance a array.";
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+        //以下是对错误数据的处理,把为nil的数据去掉,然后初始化数组
+        NSInteger newObjsIndex = 0;
+        id  _Nonnull __unsafe_unretained newObjects[cnt];
+        
+        for (int i = 0; i < cnt; i++) {
+            if (objects[i] != nil) {
+                newObjects[newObjsIndex] = objects[i];
+                newObjsIndex++;
+            }
+        }
+        instance = [self AvoidCrashArrayWithObjects:newObjects count:newObjsIndex];
+    }
+    @finally {
+        return instance;
+    }
+}
+
+
+
+//=================================================================
+//                     objectAtIndexedSubscript:
+//=================================================================
+#pragma mark - objectAtIndexedSubscript:
+- (id)__NSArrayIAvoidCrashObjectAtIndexedSubscript:(NSUInteger)idx {
+    id object = nil;
+    
+    @try {
+        object = [self __NSArrayIAvoidCrashObjectAtIndexedSubscript:idx];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+
+}
+
+
+//=================================================================
+//                       objectsAtIndexes:
+//=================================================================
+#pragma mark - objectsAtIndexes:
+
+- (NSArray *)avoidCrashObjectsAtIndexes:(NSIndexSet *)indexes {
+    
+    NSArray *returnArray = nil;
+    @try {
+        returnArray = [self avoidCrashObjectsAtIndexes:indexes];
+    } @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        return returnArray;
+    }
+}
+
+
+//=================================================================
+//                         objectAtIndex:
+//=================================================================
+#pragma mark - objectAtIndex:
+
+//__NSArrayI  objectAtIndex:
+- (id)__NSArrayIAvoidCrashObjectAtIndex:(NSUInteger)index {
+    id object = nil;
+    
+    @try {
+        object = [self __NSArrayIAvoidCrashObjectAtIndex:index];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+
+//__NSSingleObjectArrayI objectAtIndex:
+- (id)__NSSingleObjectArrayIAvoidCrashObjectAtIndex:(NSUInteger)index {
+    id object = nil;
+    
+    @try {
+        object = [self __NSSingleObjectArrayIAvoidCrashObjectAtIndex:index];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+//__NSArray0 objectAtIndex:
+- (id)__NSArray0AvoidCrashObjectAtIndex:(NSUInteger)index {
+    id object = nil;
+    
+    @try {
+        object = [self __NSArray0AvoidCrashObjectAtIndex:index];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+//=================================================================
+//                           getObjects:range:
+//=================================================================
+#pragma mark - getObjects:range:
+
+//NSArray getObjects:range:
+- (void)NSArrayAvoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
+    
+    @try {
+        [self NSArrayAvoidCrashGetObjects:objects range:range];
+    } @catch (NSException *exception) {
+        
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        
+    }
+}
+
+
+//__NSSingleObjectArrayI  getObjects:range:
+- (void)__NSSingleObjectArrayIAvoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
+    
+    @try {
+        [self __NSSingleObjectArrayIAvoidCrashGetObjects:objects range:range];
+    } @catch (NSException *exception) {
+        
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        
+    }
+}
+
+
+//__NSArrayI  getObjects:range:
+- (void)__NSArrayIAvoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
+    
+    @try {
+        [self __NSArrayIAvoidCrashGetObjects:objects range:range];
+    } @catch (NSException *exception) {
+        
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        
+    }
+}
+
+
+
+
+@end

+ 25 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.h

@@ -0,0 +1,25 @@
+//
+//  NSAttributedString+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/15.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSAttributedString (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+/**
+ *  Can avoid crash method
+ *
+ *  1.- (instancetype)initWithString:(NSString *)str
+ *  2.- (instancetype)initWithAttributedString:(NSAttributedString *)attrStr
+ *  3.- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs
+ *
+ *
+ */

+ 96 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.m

@@ -0,0 +1,96 @@
+//
+//  NSAttributedString+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/15.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSAttributedString+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSAttributedString (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        Class NSConcreteAttributedString = NSClassFromString(@"NSConcreteAttributedString");
+        
+        //initWithString:
+        [AvoidCrash exchangeInstanceMethod:NSConcreteAttributedString method1Sel:@selector(initWithString:) method2Sel:@selector(avoidCrashInitWithString:)];
+        
+        //initWithAttributedString
+        [AvoidCrash exchangeInstanceMethod:NSConcreteAttributedString method1Sel:@selector(initWithAttributedString:) method2Sel:@selector(avoidCrashInitWithAttributedString:)];
+        
+        //initWithString:attributes:
+        [AvoidCrash exchangeInstanceMethod:NSConcreteAttributedString method1Sel:@selector(initWithString:attributes:) method2Sel:@selector(avoidCrashInitWithString:attributes:)];
+    });
+
+}
+
+//=================================================================
+//                           initWithString:
+//=================================================================
+#pragma mark - initWithString:
+
+- (instancetype)avoidCrashInitWithString:(NSString *)str {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashInitWithString:str];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+//=================================================================
+//                          initWithAttributedString
+//=================================================================
+#pragma mark - initWithAttributedString
+
+- (instancetype)avoidCrashInitWithAttributedString:(NSAttributedString *)attrStr {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashInitWithAttributedString:attrStr];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+//=================================================================
+//                      initWithString:attributes:
+//=================================================================
+#pragma mark - initWithString:attributes:
+
+- (instancetype)avoidCrashInitWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashInitWithString:str attributes:attrs];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+@end

+ 24 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.h

@@ -0,0 +1,24 @@
+//
+//  NSDictionary+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSDictionary (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1. NSDictionary的快速创建方式 NSDictionary *dict = @{@"frameWork" : @"AvoidCrash"}; //这种创建方式其实调用的是2中的方法
+ *  2. +(instancetype)dictionaryWithObjects:(const id  _Nonnull __unsafe_unretained *)objects forKeys:(const id<NSCopying>  _Nonnull __unsafe_unretained *)keys count:(NSUInteger)cnt
+ *
+ */

+ 56 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.m

@@ -0,0 +1,56 @@
+//
+//  NSDictionary+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSDictionary+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSDictionary (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        [AvoidCrash exchangeClassMethod:self method1Sel:@selector(dictionaryWithObjects:forKeys:count:) method2Sel:@selector(avoidCrashDictionaryWithObjects:forKeys:count:)];
+    });
+}
+
+
++ (instancetype)avoidCrashDictionaryWithObjects:(const id  _Nonnull __unsafe_unretained *)objects forKeys:(const id<NSCopying>  _Nonnull __unsafe_unretained *)keys count:(NSUInteger)cnt {
+    
+    id instance = nil;
+    
+    @try {
+        instance = [self avoidCrashDictionaryWithObjects:objects forKeys:keys count:cnt];
+    }
+    @catch (NSException *exception) {
+        
+        NSString *defaultToDo = @"AvoidCrash default is to remove nil key-values and instance a dictionary.";
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+        //处理错误的数据,然后重新初始化一个字典
+        NSUInteger index = 0;
+        id  _Nonnull __unsafe_unretained newObjects[cnt];
+        id  _Nonnull __unsafe_unretained newkeys[cnt];
+        
+        for (int i = 0; i < cnt; i++) {
+            if (objects[i] && keys[i]) {
+                newObjects[index] = objects[i];
+                newkeys[index] = keys[i];
+                index++;
+            }
+        }
+        instance = [self avoidCrashDictionaryWithObjects:newObjects forKeys:newkeys count:index];
+    }
+    @finally {
+        return instance;
+    }
+}
+
+@end

+ 26 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.h

@@ -0,0 +1,26 @@
+//
+//  NSMutableArray+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSMutableArray (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1. - (id)objectAtIndex:(NSUInteger)index
+ *  2. - (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx
+ *  3. - (void)removeObjectAtIndex:(NSUInteger)index
+ *  4. - (void)insertObject:(id)anObject atIndex:(NSUInteger)index
+ *  5. - (void)getObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range
+ */

+ 169 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.m

@@ -0,0 +1,169 @@
+//
+//  NSMutableArray+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSMutableArray+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSMutableArray (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        Class arrayMClass = NSClassFromString(@"__NSArrayM");
+        
+        
+        //objectAtIndex:
+        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(objectAtIndex:) method2Sel:@selector(avoidCrashObjectAtIndex:)];
+        
+        //objectAtIndexedSubscript
+        if (AvoidCrashIsiOS(11.0)) {
+            [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(objectAtIndexedSubscript:) method2Sel:@selector(avoidCrashObjectAtIndexedSubscript:)];
+        }
+        
+        
+        //setObject:atIndexedSubscript:
+        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(setObject:atIndexedSubscript:) method2Sel:@selector(avoidCrashSetObject:atIndexedSubscript:)];
+        
+        
+        //removeObjectAtIndex:
+        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(removeObjectAtIndex:) method2Sel:@selector(avoidCrashRemoveObjectAtIndex:)];
+        
+        //insertObject:atIndex:
+        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(insertObject:atIndex:) method2Sel:@selector(avoidCrashInsertObject:atIndex:)];
+        
+        //getObjects:range:
+        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(getObjects:range:) method2Sel:@selector(avoidCrashGetObjects:range:)];
+    });
+    
+    
+    
+}
+
+
+//=================================================================
+//                    array set object at index
+//=================================================================
+#pragma mark - get object from array
+
+
+- (void)avoidCrashSetObject:(id)obj atIndexedSubscript:(NSUInteger)idx {
+    
+    @try {
+        [self avoidCrashSetObject:obj atIndexedSubscript:idx];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                    removeObjectAtIndex:
+//=================================================================
+#pragma mark - removeObjectAtIndex:
+
+- (void)avoidCrashRemoveObjectAtIndex:(NSUInteger)index {
+    @try {
+        [self avoidCrashRemoveObjectAtIndex:index];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                    insertObject:atIndex:
+//=================================================================
+#pragma mark - set方法
+- (void)avoidCrashInsertObject:(id)anObject atIndex:(NSUInteger)index {
+    @try {
+        [self avoidCrashInsertObject:anObject atIndex:index];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                           objectAtIndex:
+//=================================================================
+#pragma mark - objectAtIndex:
+
+- (id)avoidCrashObjectAtIndex:(NSUInteger)index {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashObjectAtIndex:index];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+//=================================================================
+//                     objectAtIndexedSubscript:
+//=================================================================
+#pragma mark - objectAtIndexedSubscript:
+- (id)avoidCrashObjectAtIndexedSubscript:(NSUInteger)idx {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashObjectAtIndexedSubscript:idx];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+    
+}
+
+
+//=================================================================
+//                         getObjects:range:
+//=================================================================
+#pragma mark - getObjects:range:
+
+- (void)avoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
+    
+    @try {
+        [self avoidCrashGetObjects:objects range:range];
+    } @catch (NSException *exception) {
+        
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        
+    }
+}
+
+
+
+
+@end

+ 23 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.h

@@ -0,0 +1,23 @@
+//
+//  NSMutableAttributedString+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/15.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSMutableAttributedString (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1.- (instancetype)initWithString:(NSString *)str
+ *  2.- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs
+ */

+ 74 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.m

@@ -0,0 +1,74 @@
+//
+//  NSMutableAttributedString+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/15.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSMutableAttributedString+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSMutableAttributedString (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        Class NSConcreteMutableAttributedString = NSClassFromString(@"NSConcreteMutableAttributedString");
+        
+        //initWithString:
+        [AvoidCrash exchangeInstanceMethod:NSConcreteMutableAttributedString method1Sel:@selector(initWithString:) method2Sel:@selector(avoidCrashInitWithString:)];
+        
+        //initWithString:attributes:
+        [AvoidCrash exchangeInstanceMethod:NSConcreteMutableAttributedString method1Sel:@selector(initWithString:attributes:) method2Sel:@selector(avoidCrashInitWithString:attributes:)];
+    });
+}
+
+//=================================================================
+//                          initWithString:
+//=================================================================
+#pragma mark - initWithString:
+
+
+- (instancetype)avoidCrashInitWithString:(NSString *)str {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashInitWithString:str];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+//=================================================================
+//                     initWithString:attributes:
+//=================================================================
+#pragma mark - initWithString:attributes:
+
+
+- (instancetype)avoidCrashInitWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashInitWithString:str attributes:attrs];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+@end

+ 24 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.h

@@ -0,0 +1,24 @@
+//
+//  NSMutableDictionary+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/22.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSMutableDictionary (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1. - (void)setObject:(id)anObject forKey:(id<NSCopying>)aKey
+ *  2. - (void)removeObjectForKey:(id)aKey
+ *
+ */

+ 95 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.m

@@ -0,0 +1,95 @@
+//
+//  NSMutableDictionary+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/22.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSMutableDictionary+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSMutableDictionary (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        Class dictionaryM = NSClassFromString(@"__NSDictionaryM");
+        
+        //setObject:forKey:
+        [AvoidCrash exchangeInstanceMethod:dictionaryM method1Sel:@selector(setObject:forKey:) method2Sel:@selector(avoidCrashSetObject:forKey:)];
+        
+        //setObject:forKeyedSubscript:
+        if (AvoidCrashIsiOS(11.0)) {
+            [AvoidCrash exchangeInstanceMethod:dictionaryM method1Sel:@selector(setObject:forKeyedSubscript:) method2Sel:@selector(avoidCrashSetObject:forKeyedSubscript:)];
+        }
+        
+        
+        
+        //removeObjectForKey:
+        Method removeObjectForKey = class_getInstanceMethod(dictionaryM, @selector(removeObjectForKey:));
+        Method avoidCrashRemoveObjectForKey = class_getInstanceMethod(dictionaryM, @selector(avoidCrashRemoveObjectForKey:));
+        method_exchangeImplementations(removeObjectForKey, avoidCrashRemoveObjectForKey);
+    });
+}
+
+
+//=================================================================
+//                       setObject:forKey:
+//=================================================================
+#pragma mark - setObject:forKey:
+
+- (void)avoidCrashSetObject:(id)anObject forKey:(id<NSCopying>)aKey {
+    
+    @try {
+        [self avoidCrashSetObject:anObject forKey:aKey];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+//=================================================================
+//                  setObject:forKeyedSubscript:
+//=================================================================
+#pragma mark - setObject:forKeyedSubscript:
+- (void)avoidCrashSetObject:(id)obj forKeyedSubscript:(id<NSCopying>)key {
+    @try {
+        [self avoidCrashSetObject:obj forKeyedSubscript:key];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                       removeObjectForKey:
+//=================================================================
+#pragma mark - removeObjectForKey:
+
+- (void)avoidCrashRemoveObjectForKey:(id)aKey {
+    
+    @try {
+        [self avoidCrashRemoveObjectForKey:aKey];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+
+
+
+@end

+ 29 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.h

@@ -0,0 +1,29 @@
+//
+//  NSMutableString+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/6.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSMutableString (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1. 由于NSMutableString是继承于NSString,所以这里和NSString有些同样的方法就不重复写了
+ *  2. - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)aString
+ *  3. - (void)insertString:(NSString *)aString atIndex:(NSUInteger)loc
+ *  4. - (void)deleteCharactersInRange:(NSRange)range
+ *
+ */
+
+
+

+ 97 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.m

@@ -0,0 +1,97 @@
+//
+//  NSMutableString+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/6.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSMutableString+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSMutableString (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        Class stringClass = NSClassFromString(@"__NSCFString");
+        
+        //replaceCharactersInRange
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(replaceCharactersInRange:withString:) method2Sel:@selector(avoidCrashReplaceCharactersInRange:withString:)];
+        
+        //insertString:atIndex:
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(insertString:atIndex:) method2Sel:@selector(avoidCrashInsertString:atIndex:)];
+        
+        //deleteCharactersInRange
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(deleteCharactersInRange:) method2Sel:@selector(avoidCrashDeleteCharactersInRange:)];
+    });
+}
+
+//=================================================================
+//                     replaceCharactersInRange
+//=================================================================
+#pragma mark - replaceCharactersInRange
+
+- (void)avoidCrashReplaceCharactersInRange:(NSRange)range withString:(NSString *)aString {
+    
+    @try {
+        [self avoidCrashReplaceCharactersInRange:range withString:aString];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+//=================================================================
+//                     insertString:atIndex:
+//=================================================================
+#pragma mark - insertString:atIndex:
+
+- (void)avoidCrashInsertString:(NSString *)aString atIndex:(NSUInteger)loc {
+    
+    @try {
+        [self avoidCrashInsertString:aString atIndex:loc];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+//=================================================================
+//                   deleteCharactersInRange
+//=================================================================
+#pragma mark - deleteCharactersInRange
+
+- (void)avoidCrashDeleteCharactersInRange:(NSRange)range {
+    
+    @try {
+        [self avoidCrashDeleteCharactersInRange:range];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+
+
+
+
+
+
+
+@end

+ 34 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.h

@@ -0,0 +1,34 @@
+//
+//  NSObject+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/11.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+@interface NSObject (AvoidCrash)
+
+/** 
+ *  ifDealWithNoneSel : 是否开启"unrecognized selector sent to instance"异常的捕获
+ */
++ (void)avoidCrashExchangeMethodIfDealWithNoneSel:(BOOL)ifDealWithNoneSel;
+
+
++ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings;
+
++ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs;
+
+@end
+
+/**
+ *  Can avoid crash method
+ *
+ *  1.- (void)setValue:(id)value forKey:(NSString *)key
+ *  2.- (void)setValue:(id)value forKeyPath:(NSString *)keyPath
+ *  3.- (void)setValue:(id)value forUndefinedKey:(NSString *)key //这个方法一般用来重写,不会主动调用
+ *  4.- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues
+ *  5. unrecognized selector sent to instance
+ */

+ 220 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.m

@@ -0,0 +1,220 @@
+//
+//  NSObject+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/11.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSObject+AvoidCrash.h"
+#import "AvoidCrash.h"
+#import "AvoidCrashStubProxy.h"
+
+@implementation NSObject (AvoidCrash)
+
+
++ (void)avoidCrashExchangeMethodIfDealWithNoneSel:(BOOL)ifDealWithNoneSel {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        //setValue:forKey:
+        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValue:forKey:) method2Sel:@selector(avoidCrashSetValue:forKey:)];
+        
+        //setValue:forKeyPath:
+        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValue:forKeyPath:) method2Sel:@selector(avoidCrashSetValue:forKeyPath:)];
+        
+        //setValue:forUndefinedKey:
+        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValue:forUndefinedKey:) method2Sel:@selector(avoidCrashSetValue:forUndefinedKey:)];
+        
+        //setValuesForKeysWithDictionary:
+        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValuesForKeysWithDictionary:) method2Sel:@selector(avoidCrashSetValuesForKeysWithDictionary:)];
+        
+        
+        //unrecognized selector sent to instance
+        if (ifDealWithNoneSel) {
+            [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(methodSignatureForSelector:) method2Sel:@selector(avoidCrashMethodSignatureForSelector:)];
+            [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(forwardInvocation:) method2Sel:@selector(avoidCrashForwardInvocation:)];
+        }
+    });
+}
+
+
+//=================================================================
+//              unrecognized selector sent to instance
+//=================================================================
+#pragma mark - unrecognized selector sent to instance
+
+
+static NSMutableArray *noneSelClassStrings;
+static NSMutableArray *noneSelClassStringPrefixs;
+
++ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings {
+    
+    if (noneSelClassStrings){
+        NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringsArr:];\n调用一此即可,多次调用会自动忽略后面的调用\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
+        AvoidCrashLog(@"%@",warningMsg);
+    }
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        noneSelClassStrings = [NSMutableArray array];
+        for (NSString *className in classStrings) {
+            if ([className hasPrefix:@"UI"] == NO &&
+                [className isEqualToString:NSStringFromClass([NSObject class])] == NO) {
+                [noneSelClassStrings addObject:className];
+            } else {
+                NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringsArr:];\n会忽略UI开头的类和NSObject类(请使用NSObject的子类)\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
+                AvoidCrashLog(@"%@",warningMsg);
+            }
+        }
+    });
+    
+}
+
+/**
+ *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名前缀的数组
+ */
++ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs {
+    if (noneSelClassStringPrefixs) {
+        
+        NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringPrefixsArr:];\n调用一此即可,多次调用会自动忽略后面的调用\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
+        AvoidCrashLog(@"%@",warningMsg);
+    }
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        noneSelClassStringPrefixs = [NSMutableArray array];
+        for (NSString *classNamePrefix in classStringPrefixs) {
+            if ([classNamePrefix hasPrefix:@"UI"] == NO &&
+                [classNamePrefix hasPrefix:@"NS"] == NO) {
+                [noneSelClassStringPrefixs addObject:classNamePrefix];
+                
+            } else {
+                NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringsArr:];\n会忽略UI开头的类和NS开头的类\n若需要对NS开头的类防止”unrecognized selector sent to instance”(比如NSArray),请使用setupNoneSelClassStringsArr:\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
+                AvoidCrashLog(@"%@",warningMsg);
+            }
+        }
+    });
+}
+
+- (NSMethodSignature *)avoidCrashMethodSignatureForSelector:(SEL)aSelector {
+    
+    NSMethodSignature *ms = [self avoidCrashMethodSignatureForSelector:aSelector];
+    
+    BOOL flag = NO;
+    if (ms == nil) {
+        for (NSString *classStr in noneSelClassStrings) {
+            if ([self isKindOfClass:NSClassFromString(classStr)]) {
+                ms = [AvoidCrashStubProxy instanceMethodSignatureForSelector:@selector(proxyMethod)];
+                flag = YES;
+                break;
+            }
+        }
+    }
+    if (flag == NO) {
+        NSString *selfClass = NSStringFromClass([self class]);
+        for (NSString *classStrPrefix in noneSelClassStringPrefixs) {
+            if ([selfClass hasPrefix:classStrPrefix]) {
+                ms = [AvoidCrashStubProxy instanceMethodSignatureForSelector:@selector(proxyMethod)];
+            }
+        }
+    }
+    return ms;
+}
+
+- (void)avoidCrashForwardInvocation:(NSInvocation *)anInvocation {
+    
+    @try {
+        [self avoidCrashForwardInvocation:anInvocation];
+        
+    } @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        
+    }
+    
+}
+
+
+//=================================================================
+//                         setValue:forKey:
+//=================================================================
+#pragma mark - setValue:forKey:
+
+- (void)avoidCrashSetValue:(id)value forKey:(NSString *)key {
+    @try {
+        [self avoidCrashSetValue:value forKey:key];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                     setValue:forKeyPath:
+//=================================================================
+#pragma mark - setValue:forKeyPath:
+
+- (void)avoidCrashSetValue:(id)value forKeyPath:(NSString *)keyPath {
+    @try {
+        [self avoidCrashSetValue:value forKeyPath:keyPath];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+
+
+//=================================================================
+//                     setValue:forUndefinedKey:
+//=================================================================
+#pragma mark - setValue:forUndefinedKey:
+
+- (void)avoidCrashSetValue:(id)value forUndefinedKey:(NSString *)key {
+    @try {
+        [self avoidCrashSetValue:value forUndefinedKey:key];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                  setValuesForKeysWithDictionary:
+//=================================================================
+#pragma mark - setValuesForKeysWithDictionary:
+
+- (void)avoidCrashSetValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues {
+    @try {
+        [self avoidCrashSetValuesForKeysWithDictionary:keyedValues];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+
+
+@end

+ 29 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSString+AvoidCrash.h

@@ -0,0 +1,29 @@
+//
+//  NSString+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/5.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSString (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1. - (unichar)characterAtIndex:(NSUInteger)index
+ *  2. - (NSString *)substringFromIndex:(NSUInteger)from
+ *  3. - (NSString *)substringToIndex:(NSUInteger)to {
+ *  4. - (NSString *)substringWithRange:(NSRange)range {
+ *  5. - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement
+ *  6. - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)options range:(NSRange)searchRange
+ *  7. - (NSString *)stringByReplacingCharactersInRange:(NSRange)range withString:(NSString *)replacement
+ *
+ */

+ 204 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash/NSString+AvoidCrash.m

@@ -0,0 +1,204 @@
+//
+//  NSString+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/5.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSString+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSString (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        Class stringClass = NSClassFromString(@"__NSCFConstantString");
+        
+        //characterAtIndex
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(characterAtIndex:) method2Sel:@selector(avoidCrashCharacterAtIndex:)];
+        
+        //substringFromIndex
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(substringFromIndex:) method2Sel:@selector(avoidCrashSubstringFromIndex:)];
+        
+        //substringToIndex
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(substringToIndex:) method2Sel:@selector(avoidCrashSubstringToIndex:)];
+        
+        //substringWithRange:
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(substringWithRange:) method2Sel:@selector(avoidCrashSubstringWithRange:)];
+        
+        //stringByReplacingOccurrencesOfString:
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(stringByReplacingOccurrencesOfString:withString:) method2Sel:@selector(avoidCrashStringByReplacingOccurrencesOfString:withString:)];
+        
+        //stringByReplacingOccurrencesOfString:withString:options:range:
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(stringByReplacingOccurrencesOfString:withString:options:range:) method2Sel:@selector(avoidCrashStringByReplacingOccurrencesOfString:withString:options:range:)];
+        
+        //stringByReplacingCharactersInRange:withString:
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(stringByReplacingCharactersInRange:withString:) method2Sel:@selector(avoidCrashStringByReplacingCharactersInRange:withString:)];
+    });
+    
+}
+
+
+//=================================================================
+//                           characterAtIndex:
+//=================================================================
+#pragma mark - characterAtIndex:
+
+- (unichar)avoidCrashCharacterAtIndex:(NSUInteger)index {
+    
+    unichar characteristic;
+    @try {
+        characteristic = [self avoidCrashCharacterAtIndex:index];
+    }
+    @catch (NSException *exception) {
+        
+        NSString *defaultToDo = @"AvoidCrash default is to return a without assign unichar.";
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return characteristic;
+    }
+}
+
+//=================================================================
+//                           substringFromIndex:
+//=================================================================
+#pragma mark - substringFromIndex:
+
+- (NSString *)avoidCrashSubstringFromIndex:(NSUInteger)from {
+    
+    NSString *subString = nil;
+    
+    @try {
+        subString = [self avoidCrashSubstringFromIndex:from];
+    }
+    @catch (NSException *exception) {
+        
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        subString = nil;
+    }
+    @finally {
+        return subString;
+    }
+}
+
+//=================================================================
+//                           substringToIndex
+//=================================================================
+#pragma mark - substringToIndex
+
+- (NSString *)avoidCrashSubstringToIndex:(NSUInteger)to {
+    
+    NSString *subString = nil;
+    
+    @try {
+        subString = [self avoidCrashSubstringToIndex:to];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        subString = nil;
+    }
+    @finally {
+        return subString;
+    }
+}
+
+
+//=================================================================
+//                           substringWithRange:
+//=================================================================
+#pragma mark - substringWithRange:
+
+- (NSString *)avoidCrashSubstringWithRange:(NSRange)range {
+    
+    NSString *subString = nil;
+    
+    @try {
+        subString = [self avoidCrashSubstringWithRange:range];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        subString = nil;
+    }
+    @finally {
+        return subString;
+    }
+}
+
+//=================================================================
+//                stringByReplacingOccurrencesOfString:
+//=================================================================
+#pragma mark - stringByReplacingOccurrencesOfString:
+
+- (NSString *)avoidCrashStringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement {
+    
+    NSString *newStr = nil;
+    
+    @try {
+        newStr = [self avoidCrashStringByReplacingOccurrencesOfString:target withString:replacement];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        newStr = nil;
+    }
+    @finally {
+        return newStr;
+    }
+}
+
+//=================================================================
+//  stringByReplacingOccurrencesOfString:withString:options:range:
+//=================================================================
+#pragma mark - stringByReplacingOccurrencesOfString:withString:options:range:
+
+- (NSString *)avoidCrashStringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)options range:(NSRange)searchRange {
+    
+    NSString *newStr = nil;
+    
+    @try {
+        newStr = [self avoidCrashStringByReplacingOccurrencesOfString:target withString:replacement options:options range:searchRange];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        newStr = nil;
+    }
+    @finally {
+        return newStr;
+    }
+}
+
+
+//=================================================================
+//       stringByReplacingCharactersInRange:withString:
+//=================================================================
+#pragma mark - stringByReplacingCharactersInRange:withString:
+
+- (NSString *)avoidCrashStringByReplacingCharactersInRange:(NSRange)range withString:(NSString *)replacement {
+
+    
+    NSString *newStr = nil;
+    
+    @try {
+        newStr = [self avoidCrashStringByReplacingCharactersInRange:range withString:replacement];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        newStr = nil;
+    }
+    @finally {
+        return newStr;
+    }
+}
+
+
+@end

+ 16 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/BugTool.h

@@ -0,0 +1,16 @@
+//
+//  BugTool.h
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/6.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface BugTool : NSObject
+
++(void)startAvoidBug;
+
+@end
+
+

+ 42 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/BugTool.m

@@ -0,0 +1,42 @@
+//
+//  BugTool.m
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/6.
+//
+
+#import "BugTool.h"
+#import "AvoidCrash.h"
+#import <Bugly/Bugly.h>
+
+@implementation BugTool
+
++(void)startAvoidBug{
+    //bugly抓取
+    NSString * bundleIdentifier = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
+    if ([bundleIdentifier isEqualToString:@"com.Oujia.Run"]){
+        [Bugly startWithAppId:@"36a0c05291"];
+    }else if ([bundleIdentifier isEqualToString:@"com.Oujia.Dance"]){
+        [Bugly startWithAppId:@"403d275730"];
+    }
+    //防奔溃
+    [AvoidCrash makeAllEffective];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dealwithCrashMessage:) name:AvoidCrashNotification object:nil];
+}
+
+- (void)dealwithCrashMessage:(NSNotification *)note{
+
+ NSDictionary *info = note.userInfo;
+  NSString *errorReason = [NSString stringWithFormat:@"【ErrorReason】%@========【ErrorPlace】%@========【DefaultToDo】%@========【ErrorName】%@", info[@"errorReason"], info[@"errorPlace"], info[@"defaultToDo"], info[@"errorName"]];
+  NSLog(@"errorReason = %@",errorReason);
+  NSArray *callStack = info[@"callStackSymbols"];
+  [self reportErrorName:@"Bugly_ErrorName_AvoidCrash" errorReason:errorReason callStack:callStack extraInfo:nil];
+
+}
+
+/** 上报错误信息 */
+- (void)reportErrorName:(NSString *)errorName errorReason:(NSString *)errorReason callStack:(NSArray *)aStackArray extraInfo:(NSDictionary *)info{
+    [Bugly reportExceptionWithCategory:3 name:errorName reason:errorReason callStack:aStackArray extraInfo:info terminateApp:NO];
+}
+
+@end

+ 1 - 1
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/MYFactoryManager.h

@@ -63,7 +63,7 @@
 //app跳转 用户信息
 #define IOSSDK_USERINFO @"iosSdk_userInfo"
 //缓存的步频数据
-#define IOSSDK_BLESDKDATA @"iosSdk_bleSdk_frequency"
+#define IOSSDK_MOTIONCOUNT @"iosSdk_motionCount"
 //游戏组数时间戳 参数是play_gorup
 #define IOSSDK_TIMESTAMP @"iosSdk_timestamp"
 //custom System UserDefaults

+ 2 - 2
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/DebugView.h → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/DebugView.h

@@ -27,8 +27,8 @@
 #pragma mark ===============================================>> DEBUG
 -(void)inittestLabel;
 
-//清理缓存
-- (void)clearCacheWithFilePath;
+////清理缓存
+//- (void)clearCacheWithFilePath;
 
 //数据写入沙河
 -(void)writeFileToplist;

+ 3 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/DebugView.m → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/DebugView.m

@@ -80,6 +80,9 @@ static DebugView* instance = nil;
         [[UIApplication sharedApplication].keyWindow addSubview:self.clearnButton];
         [[UIApplication sharedApplication].keyWindow addSubview:self.testLabel];
     }
+    
+    //jb
+    [self clearCacheWithFilePath];
 
 }
 

+ 1 - 0
DanceGame/Classes/Unity/WWWConnection.mm

@@ -81,6 +81,7 @@ static NSOperationQueue *webOperationQueue;
         self.url    = url.user != nil ? [self extractUserPassFromUrl: url] : url;
         self.udata  = udata;
 
+        NSLog(@"self.url = %@",self.url);
         if ([url.scheme caseInsensitiveCompare: @"http"] == NSOrderedSame)
             NSLog(@"You are using download over http. Currently Unity adds NSAllowsArbitraryLoads to Info.plist to simplify transition, but it will be removed soon. Please consider updating to https.");
     }

+ 0 - 2
DanceGame/Info.plist

@@ -175,8 +175,6 @@
 	<array>
 		<string>bluetooth-central</string>
 		<string>bluetooth-peripheral</string>
-		<string>fetch</string>
-		<string>processing</string>
 	</array>
 	<key>UILaunchImages</key>
 	<array>

+ 121 - 27
DanceGame/Unity-iPhone.xcodeproj/project.pbxproj

@@ -188,10 +188,26 @@
 		8CBD47E49638FD0CF890B3BC /* Il2CppMetadataUsage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0C7A4AEC80BD848836F713B2 /* Il2CppMetadataUsage.cpp */; };
 		91E346D88C9D5D9F7D2FA874 /* Il2CppInteropDataTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5DC4F7E951D1ECD94986099 /* Il2CppInteropDataTable.cpp */; };
 		92E64B4E99F11D7332C25194 /* Il2CppCompilerCalculateTypeValues_10Table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2A1348B696429D055C356554 /* Il2CppCompilerCalculateTypeValues_10Table.cpp */; };
+		930AE42E2800465E00CB6FA2 /* MotionCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930AE42D2800465E00CB6FA2 /* MotionCount.cpp */; };
+		9326E1A3281A3DBD006ADC6F /* ShoesInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 9326E1A2281A3DBD006ADC6F /* ShoesInfo.m */; };
+		9326E1A6281A3DD3006ADC6F /* GameInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 9326E1A5281A3DD3006ADC6F /* GameInfo.m */; };
 		9354476027F57F520055C921 /* StepVel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9354475F27F57F520055C921 /* StepVel.cpp */; };
 		9354476327F57FA50055C921 /* Kongfu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9354476227F57FA50055C921 /* Kongfu.cpp */; };
+		9364CF602823A39000E63D51 /* MotionCountObj.m in Sources */ = {isa = PBXBuildFile; fileRef = 9364CF5F2823A39000E63D51 /* MotionCountObj.m */; };
 		937CC93327B4B9AD00B9000A /* DefaultLandscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 937CC93227B4B9AD00B9000A /* DefaultLandscape.png */; };
 		937CC93527B4BA9500B9000A /* 2208x1142.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 937CC93427B4BA9500B9000A /* 2208x1142.jpg */; };
+		937F5BAD27FD2B210071BC44 /* NSArray+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5B9627FD2B200071BC44 /* NSArray+AvoidCrash.m */; };
+		937F5BAE27FD2B210071BC44 /* NSString+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5B9827FD2B200071BC44 /* NSString+AvoidCrash.m */; };
+		937F5BAF27FD2B210071BC44 /* NSDictionary+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5B9927FD2B200071BC44 /* NSDictionary+AvoidCrash.m */; };
+		937F5BB027FD2B210071BC44 /* NSMutableDictionary+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5B9C27FD2B200071BC44 /* NSMutableDictionary+AvoidCrash.m */; };
+		937F5BB127FD2B210071BC44 /* NSMutableString+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5B9E27FD2B200071BC44 /* NSMutableString+AvoidCrash.m */; };
+		937F5BB227FD2B210071BC44 /* NSObject+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5B9F27FD2B200071BC44 /* NSObject+AvoidCrash.m */; };
+		937F5BB327FD2B210071BC44 /* NSMutableArray+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5BA027FD2B200071BC44 /* NSMutableArray+AvoidCrash.m */; };
+		937F5BB427FD2B210071BC44 /* NSMutableAttributedString+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5BA127FD2B200071BC44 /* NSMutableAttributedString+AvoidCrash.m */; };
+		937F5BB527FD2B210071BC44 /* NSAttributedString+AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5BA227FD2B200071BC44 /* NSAttributedString+AvoidCrash.m */; };
+		937F5BB627FD2B210071BC44 /* AvoidCrash.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5BA527FD2B200071BC44 /* AvoidCrash.m */; };
+		937F5BB727FD2B210071BC44 /* AvoidCrashStubProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5BA827FD2B200071BC44 /* AvoidCrashStubProxy.m */; };
+		937F5BBA27FD2D4F0071BC44 /* BugTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5BB927FD2D4F0071BC44 /* BugTool.m */; };
 		9392303927DEEA650061812D /* FingerGuessing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392302E27DEEA650061812D /* FingerGuessing.cpp */; };
 		9392303A27DEEA650061812D /* FootStep.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392302F27DEEA650061812D /* FootStep.cpp */; };
 		9392303B27DEEA650061812D /* TestGame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392303027DEEA650061812D /* TestGame.cpp */; };
@@ -217,10 +233,8 @@
 		93B6ECD927DB2B180033A027 /* AnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 93B6EC3A27DB2B170033A027 /* AnimationView.m */; };
 		93B6ECE527DB2B180033A027 /* CBPeripheral+ADName.m in Sources */ = {isa = PBXBuildFile; fileRef = 93B6EC5827DB2B170033A027 /* CBPeripheral+ADName.m */; };
 		93B6ECE627DB2B180033A027 /* BTDataSend.m in Sources */ = {isa = PBXBuildFile; fileRef = 93B6EC5A27DB2B170033A027 /* BTDataSend.m */; };
-		93B6ECE727DB2B180033A027 /* ViceShoesAnalysis.m in Sources */ = {isa = PBXBuildFile; fileRef = 93B6EC5C27DB2B170033A027 /* ViceShoesAnalysis.m */; };
 		93B6ECE827DB2B180033A027 /* DebugView.m in Sources */ = {isa = PBXBuildFile; fileRef = 93B6EC5D27DB2B170033A027 /* DebugView.m */; };
 		93B6ECE927DB2B180033A027 /* BTDataProcess.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93B6EC5E27DB2B170033A027 /* BTDataProcess.mm */; };
-		93B6ECEA27DB2B180033A027 /* MainShoesAnalysis.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93B6EC5F27DB2B170033A027 /* MainShoesAnalysis.mm */; };
 		93B6ECEB27DB2B180033A027 /* LEONBLManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 93B6EC6127DB2B170033A027 /* LEONBLManager.m */; };
 		93B6ECEC27DB2B180033A027 /* BTDataAnalysis.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93B6EC6527DB2B170033A027 /* BTDataAnalysis.mm */; };
 		93B6ECED27DB2B180033A027 /* UserFriendsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 93B6EC6927DB2B170033A027 /* UserFriendsModel.m */; };
@@ -442,7 +456,7 @@
 		1B7B432E859C681F902A8C2E /* Il2CppCompilerCalculateTypeValues_27Table.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Il2CppCompilerCalculateTypeValues_27Table.cpp; path = Classes/Native/Il2CppCompilerCalculateTypeValues_27Table.cpp; sourceTree = SOURCE_ROOT; };
 		1D124C3F97C619AD2CAAC913 /* Il2CppCompilerCalculateTypeValues_17Table.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Il2CppCompilerCalculateTypeValues_17Table.cpp; path = Classes/Native/Il2CppCompilerCalculateTypeValues_17Table.cpp; sourceTree = SOURCE_ROOT; };
 		1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
-		1D6058910D05DD3D006BFB54 /* cn.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = cn.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		1D6058910D05DD3D006BFB54 /* dance.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = dance.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		1D68472A9268CB3A7EB20FE6 /* Bulk_mscorlib_3.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Bulk_mscorlib_3.cpp; path = Classes/Native/Bulk_mscorlib_3.cpp; sourceTree = SOURCE_ROOT; };
 		1D70413A9F53C9CE4D6298B6 /* UnityClassRegistration.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnityClassRegistration.cpp; path = Classes/Native/UnityClassRegistration.cpp; sourceTree = SOURCE_ROOT; };
 		202D40D7915390648813F237 /* IUnityGraphicsMetal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = IUnityGraphicsMetal.h; path = Classes/Unity/IUnityGraphicsMetal.h; sourceTree = SOURCE_ROOT; };
@@ -638,13 +652,46 @@
 		8D7740188BA9A89E03EE88A4 /* Il2CppCompilerCalculateTypeValues_32Table.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Il2CppCompilerCalculateTypeValues_32Table.cpp; path = Classes/Native/Il2CppCompilerCalculateTypeValues_32Table.cpp; sourceTree = SOURCE_ROOT; };
 		8DD1467686B0602CA38E0CC9 /* Bulk_UnityEngine.GridModule_0.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Bulk_UnityEngine.GridModule_0.cpp; path = Classes/Native/Bulk_UnityEngine.GridModule_0.cpp; sourceTree = SOURCE_ROOT; };
 		913F48D5B9075C1037EDE48D /* GenericMethods0.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = GenericMethods0.cpp; path = Classes/Native/GenericMethods0.cpp; sourceTree = SOURCE_ROOT; };
+		930AE42C2800465300CB6FA2 /* MotionCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MotionCount.h; sourceTree = "<group>"; };
+		930AE42D2800465E00CB6FA2 /* MotionCount.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MotionCount.cpp; sourceTree = "<group>"; };
+		9326E1A1281A3DBD006ADC6F /* ShoesInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShoesInfo.h; sourceTree = "<group>"; };
+		9326E1A2281A3DBD006ADC6F /* ShoesInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ShoesInfo.m; sourceTree = "<group>"; };
+		9326E1A4281A3DD3006ADC6F /* GameInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GameInfo.h; sourceTree = "<group>"; };
+		9326E1A5281A3DD3006ADC6F /* GameInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GameInfo.m; sourceTree = "<group>"; };
 		9354475E27F57F490055C921 /* StepVel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StepVel.h; sourceTree = "<group>"; };
 		9354475F27F57F520055C921 /* StepVel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StepVel.cpp; sourceTree = "<group>"; };
 		9354476127F57F9D0055C921 /* Kongfu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Kongfu.h; sourceTree = "<group>"; };
 		9354476227F57FA50055C921 /* Kongfu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Kongfu.cpp; sourceTree = "<group>"; };
 		935642749A1C0E55C636858E /* Bulk_Assembly-CSharp_1.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "Bulk_Assembly-CSharp_1.cpp"; path = "Classes/Native/Bulk_Assembly-CSharp_1.cpp"; sourceTree = SOURCE_ROOT; };
+		9364CF5E2823A39000E63D51 /* MotionCountObj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MotionCountObj.h; path = ../../../../../../../RunGame/SDK/BLE/MotionCountObj.h; sourceTree = "<group>"; };
+		9364CF5F2823A39000E63D51 /* MotionCountObj.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MotionCountObj.m; path = ../../../../../../../RunGame/SDK/BLE/MotionCountObj.m; sourceTree = "<group>"; };
 		937CC93227B4B9AD00B9000A /* DefaultLandscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DefaultLandscape.png; sourceTree = "<group>"; };
 		937CC93427B4BA9500B9000A /* 2208x1142.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 2208x1142.jpg; sourceTree = "<group>"; };
+		937F5B9627FD2B200071BC44 /* NSArray+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+AvoidCrash.m"; sourceTree = "<group>"; };
+		937F5B9727FD2B200071BC44 /* AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AvoidCrash.h; sourceTree = "<group>"; };
+		937F5B9827FD2B200071BC44 /* NSString+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+AvoidCrash.m"; sourceTree = "<group>"; };
+		937F5B9927FD2B200071BC44 /* NSDictionary+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+AvoidCrash.m"; sourceTree = "<group>"; };
+		937F5B9A27FD2B200071BC44 /* NSAttributedString+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSAttributedString+AvoidCrash.h"; sourceTree = "<group>"; };
+		937F5B9B27FD2B200071BC44 /* AvoidCrashStubProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AvoidCrashStubProxy.h; sourceTree = "<group>"; };
+		937F5B9C27FD2B200071BC44 /* NSMutableDictionary+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+AvoidCrash.m"; sourceTree = "<group>"; };
+		937F5B9D27FD2B200071BC44 /* AvoidCrashProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AvoidCrashProtocol.h; sourceTree = "<group>"; };
+		937F5B9E27FD2B200071BC44 /* NSMutableString+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableString+AvoidCrash.m"; sourceTree = "<group>"; };
+		937F5B9F27FD2B200071BC44 /* NSObject+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+AvoidCrash.m"; sourceTree = "<group>"; };
+		937F5BA027FD2B200071BC44 /* NSMutableArray+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+AvoidCrash.m"; sourceTree = "<group>"; };
+		937F5BA127FD2B200071BC44 /* NSMutableAttributedString+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableAttributedString+AvoidCrash.m"; sourceTree = "<group>"; };
+		937F5BA227FD2B200071BC44 /* NSAttributedString+AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSAttributedString+AvoidCrash.m"; sourceTree = "<group>"; };
+		937F5BA327FD2B200071BC44 /* NSDictionary+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+AvoidCrash.h"; sourceTree = "<group>"; };
+		937F5BA427FD2B200071BC44 /* NSString+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+AvoidCrash.h"; sourceTree = "<group>"; };
+		937F5BA527FD2B200071BC44 /* AvoidCrash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AvoidCrash.m; sourceTree = "<group>"; };
+		937F5BA627FD2B200071BC44 /* NSArray+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+AvoidCrash.h"; sourceTree = "<group>"; };
+		937F5BA727FD2B200071BC44 /* NSMutableDictionary+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+AvoidCrash.h"; sourceTree = "<group>"; };
+		937F5BA827FD2B200071BC44 /* AvoidCrashStubProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AvoidCrashStubProxy.m; sourceTree = "<group>"; };
+		937F5BA927FD2B200071BC44 /* NSObject+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+AvoidCrash.h"; sourceTree = "<group>"; };
+		937F5BAA27FD2B200071BC44 /* NSMutableString+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableString+AvoidCrash.h"; sourceTree = "<group>"; };
+		937F5BAB27FD2B200071BC44 /* NSMutableAttributedString+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableAttributedString+AvoidCrash.h"; sourceTree = "<group>"; };
+		937F5BAC27FD2B200071BC44 /* NSMutableArray+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+AvoidCrash.h"; sourceTree = "<group>"; };
+		937F5BB827FD2D4F0071BC44 /* BugTool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BugTool.h; sourceTree = "<group>"; };
+		937F5BB927FD2D4F0071BC44 /* BugTool.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BugTool.m; sourceTree = "<group>"; };
 		9392302127DEEA650061812D /* RunGame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunGame.h; sourceTree = "<group>"; };
 		9392302227DEEA650061812D /* Tricycle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tricycle.h; sourceTree = "<group>"; };
 		9392302327DEEA650061812D /* H5_Game.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = H5_Game.h; sourceTree = "<group>"; };
@@ -694,17 +741,13 @@
 		93B6EC5927DB2B170033A027 /* LEONBLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LEONBLManager.h; sourceTree = "<group>"; };
 		93B6EC5A27DB2B170033A027 /* BTDataSend.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BTDataSend.m; sourceTree = "<group>"; };
 		93B6EC5B27DB2B170033A027 /* BTDataProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BTDataProcess.h; sourceTree = "<group>"; };
-		93B6EC5C27DB2B170033A027 /* ViceShoesAnalysis.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViceShoesAnalysis.m; sourceTree = "<group>"; };
 		93B6EC5D27DB2B170033A027 /* DebugView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugView.m; sourceTree = "<group>"; };
 		93B6EC5E27DB2B170033A027 /* BTDataProcess.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BTDataProcess.mm; sourceTree = "<group>"; };
-		93B6EC5F27DB2B170033A027 /* MainShoesAnalysis.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MainShoesAnalysis.mm; sourceTree = "<group>"; };
 		93B6EC6027DB2B170033A027 /* BTDataSend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BTDataSend.h; sourceTree = "<group>"; };
 		93B6EC6127DB2B170033A027 /* LEONBLManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LEONBLManager.m; sourceTree = "<group>"; };
 		93B6EC6227DB2B170033A027 /* CBPeripheral+ADName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CBPeripheral+ADName.h"; sourceTree = "<group>"; };
 		93B6EC6327DB2B170033A027 /* BTDataAnalysis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BTDataAnalysis.h; sourceTree = "<group>"; };
-		93B6EC6427DB2B170033A027 /* ViceShoesAnalysis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViceShoesAnalysis.h; sourceTree = "<group>"; };
 		93B6EC6527DB2B170033A027 /* BTDataAnalysis.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BTDataAnalysis.mm; sourceTree = "<group>"; };
-		93B6EC6627DB2B170033A027 /* MainShoesAnalysis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainShoesAnalysis.h; sourceTree = "<group>"; };
 		93B6EC6727DB2B170033A027 /* DebugView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugView.h; sourceTree = "<group>"; };
 		93B6EC6927DB2B170033A027 /* UserFriendsModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserFriendsModel.m; sourceTree = "<group>"; };
 		93B6EC6A27DB2B170033A027 /* UserFriendsModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserFriendsModel.h; sourceTree = "<group>"; };
@@ -950,7 +993,7 @@
 		19C28FACFE9D520D11CA2CBB /* Products */ = {
 			isa = PBXGroup;
 			children = (
-				1D6058910D05DD3D006BFB54 /* cn.app */,
+				1D6058910D05DD3D006BFB54 /* dance.app */,
 				5623C57317FDCB0800090B9E /* Unity-iPhone Tests.xctest */,
 			);
 			name = Products;
@@ -1165,6 +1208,36 @@
 			path = Unity;
 			sourceTree = "<group>";
 		};
+		937F5B9527FD2B200071BC44 /* AvoidCrash */ = {
+			isa = PBXGroup;
+			children = (
+				937F5B9627FD2B200071BC44 /* NSArray+AvoidCrash.m */,
+				937F5B9727FD2B200071BC44 /* AvoidCrash.h */,
+				937F5B9827FD2B200071BC44 /* NSString+AvoidCrash.m */,
+				937F5B9927FD2B200071BC44 /* NSDictionary+AvoidCrash.m */,
+				937F5B9A27FD2B200071BC44 /* NSAttributedString+AvoidCrash.h */,
+				937F5B9B27FD2B200071BC44 /* AvoidCrashStubProxy.h */,
+				937F5B9C27FD2B200071BC44 /* NSMutableDictionary+AvoidCrash.m */,
+				937F5B9D27FD2B200071BC44 /* AvoidCrashProtocol.h */,
+				937F5B9E27FD2B200071BC44 /* NSMutableString+AvoidCrash.m */,
+				937F5B9F27FD2B200071BC44 /* NSObject+AvoidCrash.m */,
+				937F5BA027FD2B200071BC44 /* NSMutableArray+AvoidCrash.m */,
+				937F5BA127FD2B200071BC44 /* NSMutableAttributedString+AvoidCrash.m */,
+				937F5BA227FD2B200071BC44 /* NSAttributedString+AvoidCrash.m */,
+				937F5BA327FD2B200071BC44 /* NSDictionary+AvoidCrash.h */,
+				937F5BA427FD2B200071BC44 /* NSString+AvoidCrash.h */,
+				937F5BA527FD2B200071BC44 /* AvoidCrash.m */,
+				937F5BA627FD2B200071BC44 /* NSArray+AvoidCrash.h */,
+				937F5BA727FD2B200071BC44 /* NSMutableDictionary+AvoidCrash.h */,
+				937F5BA827FD2B200071BC44 /* AvoidCrashStubProxy.m */,
+				937F5BA927FD2B200071BC44 /* NSObject+AvoidCrash.h */,
+				937F5BAA27FD2B200071BC44 /* NSMutableString+AvoidCrash.h */,
+				937F5BAB27FD2B200071BC44 /* NSMutableAttributedString+AvoidCrash.h */,
+				937F5BAC27FD2B200071BC44 /* NSMutableArray+AvoidCrash.h */,
+			);
+			path = AvoidCrash;
+			sourceTree = "<group>";
+		};
 		9392301F27DEEA650061812D /* shoes_sdk_2.0 */ = {
 			isa = PBXGroup;
 			children = (
@@ -1179,6 +1252,7 @@
 			isa = PBXGroup;
 			children = (
 				9354476127F57F9D0055C921 /* Kongfu.h */,
+				930AE42C2800465300CB6FA2 /* MotionCount.h */,
 				9354475E27F57F490055C921 /* StepVel.h */,
 				9392302127DEEA650061812D /* RunGame.h */,
 				9392302227DEEA650061812D /* Tricycle.h */,
@@ -1199,6 +1273,7 @@
 		9392302D27DEEA650061812D /* src */ = {
 			isa = PBXGroup;
 			children = (
+				930AE42D2800465E00CB6FA2 /* MotionCount.cpp */,
 				9354476227F57FA50055C921 /* Kongfu.cpp */,
 				9354475F27F57F520055C921 /* StepVel.cpp */,
 				9392302E27DEEA650061812D /* FingerGuessing.cpp */,
@@ -1242,6 +1317,8 @@
 				93B6EC3127DB2B170033A027 /* PopupView */,
 				93B6EC3B27DB2B170033A027 /* SearchDeviceViewController.h */,
 				93B6EC3427DB2B170033A027 /* SearchDeviceViewController.m */,
+				93B6EC6727DB2B170033A027 /* DebugView.h */,
+				93B6EC5D27DB2B170033A027 /* DebugView.m */,
 			);
 			path = UI;
 			sourceTree = "<group>";
@@ -1305,22 +1382,22 @@
 		93B6EC5727DB2B170033A027 /* BLE */ = {
 			isa = PBXGroup;
 			children = (
-				93B6EC6327DB2B170033A027 /* BTDataAnalysis.h */,
-				93B6EC6527DB2B170033A027 /* BTDataAnalysis.mm */,
 				93B6EC5B27DB2B170033A027 /* BTDataProcess.h */,
 				93B6EC5E27DB2B170033A027 /* BTDataProcess.mm */,
+				9326E1A1281A3DBD006ADC6F /* ShoesInfo.h */,
+				9326E1A2281A3DBD006ADC6F /* ShoesInfo.m */,
+				9326E1A4281A3DD3006ADC6F /* GameInfo.h */,
+				9326E1A5281A3DD3006ADC6F /* GameInfo.m */,
+				9364CF5E2823A39000E63D51 /* MotionCountObj.h */,
+				9364CF5F2823A39000E63D51 /* MotionCountObj.m */,
+				93B6EC6327DB2B170033A027 /* BTDataAnalysis.h */,
+				93B6EC6527DB2B170033A027 /* BTDataAnalysis.mm */,
 				93B6EC6027DB2B170033A027 /* BTDataSend.h */,
 				93B6EC5A27DB2B170033A027 /* BTDataSend.m */,
 				93B6EC6227DB2B170033A027 /* CBPeripheral+ADName.h */,
 				93B6EC5827DB2B170033A027 /* CBPeripheral+ADName.m */,
-				93B6EC6727DB2B170033A027 /* DebugView.h */,
-				93B6EC5D27DB2B170033A027 /* DebugView.m */,
 				93B6EC5927DB2B170033A027 /* LEONBLManager.h */,
 				93B6EC6127DB2B170033A027 /* LEONBLManager.m */,
-				93B6EC6627DB2B170033A027 /* MainShoesAnalysis.h */,
-				93B6EC5F27DB2B170033A027 /* MainShoesAnalysis.mm */,
-				93B6EC6427DB2B170033A027 /* ViceShoesAnalysis.h */,
-				93B6EC5C27DB2B170033A027 /* ViceShoesAnalysis.m */,
 			);
 			path = BLE;
 			sourceTree = "<group>";
@@ -1337,6 +1414,7 @@
 		93B6EC6B27DB2B170033A027 /* ThirdClass */ = {
 			isa = PBXGroup;
 			children = (
+				937F5B9527FD2B200071BC44 /* AvoidCrash */,
 				93B6EC7427DB2B170033A027 /* MBProgressHUD */,
 				93B6EC7727DB2B170033A027 /* Bugly-2.5.9 */,
 			);
@@ -1478,6 +1556,8 @@
 				93B6ECCB27DB2B180033A027 /* GameObjc.mm */,
 				93B6ECCC27DB2B180033A027 /* MYFactoryManager.m */,
 				93B6ECCD27DB2B180033A027 /* UIView+ST.m */,
+				937F5BB827FD2D4F0071BC44 /* BugTool.h */,
+				937F5BB927FD2D4F0071BC44 /* BugTool.m */,
 			);
 			path = Tool;
 			sourceTree = "<group>";
@@ -1751,7 +1831,7 @@
 			);
 			name = "Unity-iPhone";
 			productName = "iPhone-target";
-			productReference = 1D6058910D05DD3D006BFB54 /* cn.app */;
+			productReference = 1D6058910D05DD3D006BFB54 /* dance.app */;
 			productType = "com.apple.product-type.application";
 		};
 		5623C57217FDCB0800090B9E /* Unity-iPhone Tests */ = {
@@ -1924,15 +2004,19 @@
 				8AC71EC419E7FBA90027502F /* OrientationSupport.mm in Sources */,
 				8A7939FD1ED2F53200B44EF1 /* UnityViewControllerBase.mm in Sources */,
 				93B6ECF327DB2B180033A027 /* AFHTTPSessionManager.m in Sources */,
+				930AE42E2800465E00CB6FA2 /* MotionCount.cpp in Sources */,
+				937F5BAD27FD2B210071BC44 /* NSArray+AvoidCrash.m in Sources */,
 				8A9FCB131617295F00C05364 /* ActivityIndicator.mm in Sources */,
 				8A8D90DA1A274A7800456C4E /* UnityAppController+UnityInterface.mm in Sources */,
 				8AA5D80217ABE9AF007B9910 /* UnityAppController+Rendering.mm in Sources */,
 				9392303D27DEEA650061812D /* H5_Game.cpp in Sources */,
 				8A142DC61636943E00DD87CA /* Keyboard.mm in Sources */,
 				93B6ECF627DB2B180033A027 /* AFNetworkReachabilityManager.m in Sources */,
+				937F5BAE27FD2B210071BC44 /* NSString+AvoidCrash.m in Sources */,
 				8A0FED491649699200E9727D /* EAGLContextHelper.mm in Sources */,
 				AAFE69D219F187C200638316 /* UnityViewControllerListener.mm in Sources */,
 				93B6ECD527DB2B180033A027 /* TXCarouselView.m in Sources */,
+				937F5BB627FD2B210071BC44 /* AvoidCrash.m in Sources */,
 				8A1FFFAD16512A9000DD0934 /* GlesHelper.mm in Sources */,
 				93B6ECCF27DB2B180033A027 /* TXCarouselCellModel.m in Sources */,
 				93B6ECE527DB2B180033A027 /* CBPeripheral+ADName.m in Sources */,
@@ -1957,7 +2041,6 @@
 				8A793A061ED43EE100B44EF1 /* UnityView+iOS.mm in Sources */,
 				8ADCE38B19C87177006F04F6 /* CameraCapture.mm in Sources */,
 				8A4815C117A28E7F003FBFD5 /* UnityAppController+ViewHandling.mm in Sources */,
-				93B6ECEA27DB2B180033A027 /* MainShoesAnalysis.mm in Sources */,
 				8A25E6D218D767E20006A227 /* Filesystem.mm in Sources */,
 				999475201A7BC3AE00178130 /* UnityAdsUnityWrapper.mm in Sources */,
 				8AF7755D1799329100341121 /* LifeCycleListener.mm in Sources */,
@@ -1985,6 +2068,7 @@
 				583D4276AB51CDBBF4E488E6 /* Bulk_Assembly-CSharp_2.cpp in Sources */,
 				1B484123ACC0F9FE24ABB7F5 /* Bulk_Assembly-CSharp_20.cpp in Sources */,
 				93B6ECD427DB2B180033A027 /* TXCarouselCollectionViewCell.m in Sources */,
+				9326E1A3281A3DBD006ADC6F /* ShoesInfo.m in Sources */,
 				400E43C18BDCFB5DE7B5724E /* Bulk_Assembly-CSharp_21.cpp in Sources */,
 				E1E1425B97D830E5B9448F29 /* Bulk_Assembly-CSharp_22.cpp in Sources */,
 				B91F4EFD96B23D35E42EADCD /* Bulk_Assembly-CSharp_23.cpp in Sources */,
@@ -2042,6 +2126,7 @@
 				E3EF4D2B9B00DD652E93835A /* Bulk_System.Xml_0.cpp in Sources */,
 				9392303F27DEEA650061812D /* Aerobics.cpp in Sources */,
 				E9D9473697BC1686F2B90939 /* Bulk_System.Xml_1.cpp in Sources */,
+				937F5BB127FD2B210071BC44 /* NSMutableString+AvoidCrash.m in Sources */,
 				93B6ECE827DB2B180033A027 /* DebugView.m in Sources */,
 				6EED446484F9D65060508AFD /* Bulk_System.Xml_2.cpp in Sources */,
 				2B4347589D611F4E1C536704 /* Bulk_System.Xml_3.cpp in Sources */,
@@ -2053,6 +2138,7 @@
 				BA1D43F3930E8B6B3CCE9E89 /* Bulk_System_1.cpp in Sources */,
 				ABA24DC1A2AAA9C9595AE02A /* Bulk_System_2.cpp in Sources */,
 				692F41D9AE0AA74A87B43325 /* Bulk_System_3.cpp in Sources */,
+				937F5BB327FD2B210071BC44 /* NSMutableArray+AvoidCrash.m in Sources */,
 				0D7A41128505A699CCACC46A /* Bulk_System_4.cpp in Sources */,
 				275F49A7BF401242E993C0D3 /* Bulk_UnityEngine.AIModule_0.cpp in Sources */,
 				6AA04FE8891F889658820795 /* Bulk_UnityEngine.AnimationModule_0.cpp in Sources */,
@@ -2063,6 +2149,7 @@
 				044644B68C5D373550131AB8 /* Bulk_UnityEngine.DirectorModule_0.cpp in Sources */,
 				D82940C49EC5173E6CF8082B /* Bulk_UnityEngine.GameCenterModule_0.cpp in Sources */,
 				04E2410F8EA9029A6097BD51 /* Bulk_UnityEngine.GridModule_0.cpp in Sources */,
+				9364CF602823A39000E63D51 /* MotionCountObj.m in Sources */,
 				B6424F0D95236DBE30A6FD40 /* Bulk_UnityEngine.IMGUIModule_0.cpp in Sources */,
 				B69B411C9BC4C73FF946EBC9 /* Bulk_UnityEngine.ImageConversionModule_0.cpp in Sources */,
 				404D46399EFF7943904206BC /* Bulk_UnityEngine.InputModule_0.cpp in Sources */,
@@ -2075,6 +2162,7 @@
 				827E4A5492F67BC5EFAA0F81 /* Bulk_UnityEngine.SharedInternalsModule_0.cpp in Sources */,
 				30294FE0B90F66FB77A550D8 /* Bulk_UnityEngine.TerrainModule_0.cpp in Sources */,
 				E26F4903AF7E80A14835352C /* Bulk_UnityEngine.TextRenderingModule_0.cpp in Sources */,
+				937F5BB027FD2B210071BC44 /* NSMutableDictionary+AvoidCrash.m in Sources */,
 				93B6ECF427DB2B180033A027 /* AFURLSessionManager.m in Sources */,
 				E0984461AEE955AD1EC4A06A /* Bulk_UnityEngine.TilemapModule_0.cpp in Sources */,
 				5CFA4092AB4C29A7F58ADC65 /* Bulk_UnityEngine.UIModule_0.cpp in Sources */,
@@ -2094,6 +2182,7 @@
 				E3B9484CADE985963342F411 /* Bulk_mscorlib_1.cpp in Sources */,
 				C341462FB987297699821DE5 /* Bulk_mscorlib_10.cpp in Sources */,
 				AEBE4ED3B37329283715252C /* Bulk_mscorlib_11.cpp in Sources */,
+				937F5BB427FD2B210071BC44 /* NSMutableAttributedString+AvoidCrash.m in Sources */,
 				3724408CAF1DFFED8AE6D2AC /* Bulk_mscorlib_12.cpp in Sources */,
 				6CA14F0783BC9B9A938CD8E7 /* Bulk_mscorlib_2.cpp in Sources */,
 				B99045998C728022F3DC6224 /* Bulk_mscorlib_3.cpp in Sources */,
@@ -2104,6 +2193,7 @@
 				93B6ECD227DB2B180033A027 /* ShoesCarouselView.m in Sources */,
 				A41F4792B0DCF15A985E1D7D /* Bulk_mscorlib_7.cpp in Sources */,
 				11824BF290A3C07A47C935D0 /* Bulk_mscorlib_8.cpp in Sources */,
+				937F5BBA27FD2D4F0071BC44 /* BugTool.m in Sources */,
 				769F4648B1838D4083F4F8F3 /* Bulk_mscorlib_9.cpp in Sources */,
 				138B4D25AECD91543A86C013 /* GenericMethods0.cpp in Sources */,
 				545449EC93130AD51C57AEAF /* GenericMethods1.cpp in Sources */,
@@ -2116,6 +2206,7 @@
 				93B6ECE627DB2B180033A027 /* BTDataSend.m in Sources */,
 				93B6ECF027DB2B180033A027 /* IOSPlatformSDK.mm in Sources */,
 				45834AAE8CD3F9B083B9B991 /* Il2CppCompilerCalculateTypeValuesTable.cpp in Sources */,
+				9326E1A6281A3DD3006ADC6F /* GameInfo.m in Sources */,
 				01324F32861BCE829032E3DE /* Il2CppCompilerCalculateTypeValues_0Table.cpp in Sources */,
 				92E64B4E99F11D7332C25194 /* Il2CppCompilerCalculateTypeValues_10Table.cpp in Sources */,
 				843143928B15F71D5750F9A1 /* Il2CppCompilerCalculateTypeValues_11Table.cpp in Sources */,
@@ -2124,8 +2215,8 @@
 				275C4051BEF6CE0362A310B7 /* Il2CppCompilerCalculateTypeValues_14Table.cpp in Sources */,
 				AD9D46C9B285A5ABC3708AC3 /* Il2CppCompilerCalculateTypeValues_15Table.cpp in Sources */,
 				FA8D41FCBBB52B8D5540BDB7 /* Il2CppCompilerCalculateTypeValues_16Table.cpp in Sources */,
+				937F5BB227FD2B210071BC44 /* NSObject+AvoidCrash.m in Sources */,
 				93B6ECF527DB2B180033A027 /* AFURLRequestSerialization.m in Sources */,
-				93B6ECE727DB2B180033A027 /* ViceShoesAnalysis.m in Sources */,
 				1BA2482D908726733F0A3042 /* Il2CppCompilerCalculateTypeValues_17Table.cpp in Sources */,
 				EEB649C2BA2E040004604ABA /* Il2CppCompilerCalculateTypeValues_18Table.cpp in Sources */,
 				E9F2496795478643FA78487E /* Il2CppCompilerCalculateTypeValues_19Table.cpp in Sources */,
@@ -2134,6 +2225,7 @@
 				0B024BA38B424C79B2CF8728 /* Il2CppCompilerCalculateTypeValues_21Table.cpp in Sources */,
 				B8EC4C57909185238EE8C6A1 /* Il2CppCompilerCalculateTypeValues_22Table.cpp in Sources */,
 				0D6A4CDEA4CDDAD7E91CC81B /* Il2CppCompilerCalculateTypeValues_23Table.cpp in Sources */,
+				937F5BAF27FD2B210071BC44 /* NSDictionary+AvoidCrash.m in Sources */,
 				820E4F7DBE6EF69520082D77 /* Il2CppCompilerCalculateTypeValues_24Table.cpp in Sources */,
 				FF7044D9AA05C853574AAB39 /* Il2CppCompilerCalculateTypeValues_25Table.cpp in Sources */,
 				18C0498D880B6CD1C5BFC44D /* Il2CppCompilerCalculateTypeValues_26Table.cpp in Sources */,
@@ -2175,6 +2267,7 @@
 				2496495FAF5197E63F5615A2 /* Il2CppCompilerCalculateTypeValues_5Table.cpp in Sources */,
 				895C4C05968C93C4E417E197 /* Il2CppCompilerCalculateTypeValues_6Table.cpp in Sources */,
 				BB0543AAB7F743460A340525 /* Il2CppCompilerCalculateTypeValues_7Table.cpp in Sources */,
+				937F5BB727FD2B210071BC44 /* AvoidCrashStubProxy.m in Sources */,
 				3B6A42728BBA820CA7662220 /* Il2CppCompilerCalculateTypeValues_8Table.cpp in Sources */,
 				1181422791D23E5B1A13298A /* Il2CppCompilerCalculateTypeValues_9Table.cpp in Sources */,
 				6A394CCBA3BD2AAE54EE16A5 /* Il2CppGenericClassTable.cpp in Sources */,
@@ -2188,6 +2281,7 @@
 				91E346D88C9D5D9F7D2FA874 /* Il2CppInteropDataTable.cpp in Sources */,
 				328E4A67952AF8A6ECB25005 /* Il2CppInvokerTable.cpp in Sources */,
 				5FDB8076276C79F8005E4C89 /* FitfunHead_C.mm in Sources */,
+				937F5BB527FD2B210071BC44 /* NSAttributedString+AvoidCrash.m in Sources */,
 				EB244CC8A5A14504533B8B8D /* Il2CppMetadataRegistration.cpp in Sources */,
 				8CBD47E49638FD0CF890B3BC /* Il2CppMetadataUsage.cpp in Sources */,
 				EA3A4B1F90828D7E1D058556 /* Il2CppMethodPointerTable.cpp in Sources */,
@@ -2247,7 +2341,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 10001;
+				CURRENT_PROJECT_VERSION = 10104;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -2298,7 +2392,7 @@
 					"-weak-lSystem",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.Oujia.Dance;
-				PRODUCT_NAME = cn;
+				PRODUCT_NAME = dance;
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SDKROOT = iphoneos;
@@ -2327,7 +2421,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 10001;
+				CURRENT_PROJECT_VERSION = 10104;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -2375,7 +2469,7 @@
 					"-weak-lSystem",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.Oujia.Dance;
-				PRODUCT_NAME = cn;
+				PRODUCT_NAME = dance;
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SDKROOT = iphoneos;
@@ -2530,7 +2624,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 10001;
+				CURRENT_PROJECT_VERSION = 10104;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				ENABLE_BITCODE = NO;
@@ -2579,7 +2673,7 @@
 					"-weak-lSystem",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.Oujia.Dance;
-				PRODUCT_NAME = cn;
+				PRODUCT_NAME = dance;
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SDKROOT = iphoneos;
@@ -2678,7 +2772,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 10001;
+				CURRENT_PROJECT_VERSION = 10104;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -2726,7 +2820,7 @@
 					"-weak-lSystem",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.Oujia.Dance;
-				PRODUCT_NAME = cn;
+				PRODUCT_NAME = dance;
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SDKROOT = iphoneos;

+ 7 - 0
DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:">
+   </FileRef>
+</Workspace>

BIN
DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcuserdata/duowan123.xcuserdatad/UserInterfaceState.xcuserstate


+ 4 - 4
DanceGame/Unity-iPhone.xcodeproj/xcshareddata/xcschemes/Unity-iPhone.xcscheme

@@ -15,7 +15,7 @@
             <BuildableReference
                BuildableIdentifier = "primary"
                BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
-               BuildableName = "cn.app"
+               BuildableName = "dance.app"
                BlueprintName = "Unity-iPhone"
                ReferencedContainer = "container:Unity-iPhone.xcodeproj">
             </BuildableReference>
@@ -31,7 +31,7 @@
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
-            BuildableName = "cn.app"
+            BuildableName = "dance.app"
             BlueprintName = "Unity-iPhone"
             ReferencedContainer = "container:Unity-iPhone.xcodeproj">
          </BuildableReference>
@@ -73,7 +73,7 @@
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
-            BuildableName = "cn.app"
+            BuildableName = "dance.app"
             BlueprintName = "Unity-iPhone"
             ReferencedContainer = "container:Unity-iPhone.xcodeproj">
          </BuildableReference>
@@ -90,7 +90,7 @@
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
-            BuildableName = "cn.app"
+            BuildableName = "dance.app"
             BlueprintName = "Unity-iPhone"
             ReferencedContainer = "container:Unity-iPhone.xcodeproj">
          </BuildableReference>

BIN
RunGame/.DS_Store


+ 5 - 4
RunGame/Classes/UnityAppController.mm

@@ -334,8 +334,8 @@ extern "C" void UnityCleanupTrampoline()
      //我们需要在此处处理通过 scheme 打开App并截获参数。
       NSURL *url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
          NSLog(@"打开方式 通过URL打开的  ===== >> %@",url);
-//         IOSPlatformSDK * sdk = [IOSPlatformSDK sharedInstance];
-//         [sdk startWithUrl:url];
+         IOSPlatformSDK * sdk = [IOSPlatformSDK sharedInstance];
+         [sdk startWithUrl:url];
      }else if (!launchOptions){
          NSLog(@"打开方式 手动点击打开");
          [IOSPlatformSDK sharedInstance];
@@ -356,6 +356,8 @@ extern "C" void UnityCleanupTrampoline()
 - (void)applicationDidEnterBackground:(UIApplication*)application
 {
     ::printf("-> applicationDidEnterBackground()\n");
+    [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^(){}];
+
 }
 
 - (void)applicationWillEnterForeground:(UIApplication*)application
@@ -397,7 +399,6 @@ extern "C" void UnityCleanupTrampoline()
         _startUnityScheduled = true;
         [self performSelector: @selector(startUnity:) withObject: application afterDelay: 0];
     }
-
     _didResignActive = false;
 }
 
@@ -416,7 +417,6 @@ extern "C" void UnityCleanupTrampoline()
         {
             [_snapshotView removeFromSuperview];
             _snapshotView = nil;
-
             // Make sure that the keyboard input field regains focus after the application becomes active.
             [[KeyboardDelegate Instance] becomeFirstResponder];
         }
@@ -468,6 +468,7 @@ extern "C" void UnityCleanupTrampoline()
     _didResignActive = true;
 }
 
+
 - (void)applicationDidReceiveMemoryWarning:(UIApplication*)application
 {
     ::printf("WARNING -> applicationDidReceiveMemoryWarning()\n");

BIN
RunGame/SDK/.DS_Store


+ 90 - 90
RunGame/SDK/BLE/BTDataAnalysis.mm

@@ -12,99 +12,99 @@
 #pragma mark ===============================================>> 校验 & 报文数据解析
 -(void)analysisCharacteristic:(NSData*)characteristic deviceType:(DEVICE_TYPE)deviceType{
         
-//    NSLog(@"接收到的数据data = %@",characteristic);
-    int frameHead = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(0, 1)]];//帧头数据aa
-    int messageLength = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(1, 1)]];//报文长度
-    int messageLengthNegation = ~messageLength;//报文长度取反
-    int dataType = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
-    
-      if (dataType == 4){//获取主动推过来的数据
-            //右脚坐标数据
-           int right_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(4, 4)];
-           int right_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(8, 4)];
-           int right_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(12, 4)];
-           int  right_pos[3] = {right_X,right_Y,right_Z};
-          //左脚坐标数据
-           int left_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(16, 4)];
-           int left_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(20, 4)];
-           int left_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(24, 4)];
-           int  left_pos[3] = {left_X,left_Y,left_Z};
-           //右脚姿势数据
-           short righrPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(28, 2)];
-           short righrPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(30, 2)];
-           short righrPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(32, 2)];
-           int  right_att[3] = {righrPosture_X,righrPosture_Y,righrPosture_Z};
-           //左脚姿势数据
-           short leftPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(34, 2)];
-           short leftPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(36, 2)];
-           short leftPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(38, 2)];
-           int  left_att[3] = {leftPosture_X,leftPosture_Y,leftPosture_Z};
-           //右脚三维数据
-           short righrAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(40, 2)];
-           short righrAcc_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(42, 2)];
-           short righrAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(44, 2)];
-           int  righr_acc[3] = {righrAcc_x,righrAcc_Y,righrAcc_z};
-           //左脚三维数据
-           short leftAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(46, 2)];
-           short leftAcc_y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(48, 2)];
-           short leftAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(50, 2)];
-           int  left_acc[3] = {leftAcc_x,leftAcc_y,leftAcc_z};
-           //左脚、右脚、蹲 、跳四个动作信息数据
-           int actionInformation =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(52, 1)]];;//0c 16进制字符串
-                       int girlShoes  = actionInformation & 16;
-                       if (girlShoes!=0){
-                           girlShoes=1;
-                       }else{
-                           girlShoes=0;
-                       }
-                       int rightZupt  = actionInformation & 8;
-                       if (rightZupt!=0){
-                           rightZupt=1;
-                       }else{
-                           rightZupt=0;
-                       }
-                       int leftZupt = actionInformation & 4;
-                       if (leftZupt!=0){
-                            leftZupt=1;
-                        }else{
-                            leftZupt=0;
-                        }
-                       int down  = actionInformation & 2;
-                       if (down!=0){
-                            down=1;
-                        }else{
-                            down=0;
-                        }
-                       int jump  = actionInformation & 1;
-                       if (jump!=0){
-                            jump=1;
-                        }else{
-                            jump=0;
-                        }
-          
-            int rssi = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(53, 1)]];//rssi 信号强度
-            int ts = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
-            int right_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(55, 2)]];//3 29新增 右鞋压力
-            int left_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(57, 2)]];//3 29新增 左鞋压力
-            int frameCheck =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(59, 1)]];//校验位
-        
-              if (deviceType==DEVICETYPE_MAIN){//主设备
-    //                   NSLog(@"主设备 接收到 鞋子动作数据 data = %@",characteristic);
-                  //调取鞋子SDK
-    //                   [self shoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righr_acc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
-                  
-              }else if (deviceType==DEVICETYPE_VICE){//副设备动作数据
-                  //调取鞋子SDK
-    //                   [self viceShoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righr_acc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
-              }
-                  
-        }else if (dataType == -95 && characteristic.length == 26){//获取的是查询的数据 char-->int a1 = -95
+////    NSLog(@"接收到的数据data = %@",characteristic);
+//    int frameHead = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(0, 1)]];//帧头数据aa
+//    int messageLength = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(1, 1)]];//报文长度
+//    int messageLengthNegation = ~messageLength;//报文长度取反
+//    int dataType = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
+//
+//      if (dataType == 4){//获取主动推过来的数据
+//            //右脚坐标数据
+//           int right_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(4, 4)];
+//           int right_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(8, 4)];
+//           int right_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(12, 4)];
+//           int  right_pos[3] = {right_X,right_Y,right_Z};
+//          //左脚坐标数据
+//           int left_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(16, 4)];
+//           int left_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(20, 4)];
+//           int left_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(24, 4)];
+//           int  left_pos[3] = {left_X,left_Y,left_Z};
+//           //右脚姿势数据
+//           short righrPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(28, 2)];
+//           short righrPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(30, 2)];
+//           short righrPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(32, 2)];
+//           int  right_att[3] = {righrPosture_X,righrPosture_Y,righrPosture_Z};
+//           //左脚姿势数据
+//           short leftPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(34, 2)];
+//           short leftPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(36, 2)];
+//           short leftPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(38, 2)];
+//           int  left_att[3] = {leftPosture_X,leftPosture_Y,leftPosture_Z};
+//           //右脚三维数据
+//           short righrAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(40, 2)];
+//           short righrAcc_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(42, 2)];
+//           short righrAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(44, 2)];
+//           int  righr_acc[3] = {righrAcc_x,righrAcc_Y,righrAcc_z};
+//           //左脚三维数据
+//           short leftAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(46, 2)];
+//           short leftAcc_y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(48, 2)];
+//           short leftAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(50, 2)];
+//           int  left_acc[3] = {leftAcc_x,leftAcc_y,leftAcc_z};
+//           //左脚、右脚、蹲 、跳四个动作信息数据
+//           int actionInformation =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(52, 1)]];;//0c 16进制字符串
+//                       int girlShoes  = actionInformation & 16;
+//                       if (girlShoes!=0){
+//                           girlShoes=1;
+//                       }else{
+//                           girlShoes=0;
+//                       }
+//                       int rightZupt  = actionInformation & 8;
+//                       if (rightZupt!=0){
+//                           rightZupt=1;
+//                       }else{
+//                           rightZupt=0;
+//                       }
+//                       int leftZupt = actionInformation & 4;
+//                       if (leftZupt!=0){
+//                            leftZupt=1;
+//                        }else{
+//                            leftZupt=0;
+//                        }
+//                       int down  = actionInformation & 2;
+//                       if (down!=0){
+//                            down=1;
+//                        }else{
+//                            down=0;
+//                        }
+//                       int jump  = actionInformation & 1;
+//                       if (jump!=0){
+//                            jump=1;
+//                        }else{
+//                            jump=0;
+//                        }
+//
+//            int rssi = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(53, 1)]];//rssi 信号强度
+//            int ts = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
+//            int right_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(55, 2)]];//3 29新增 右鞋压力
+//            int left_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(57, 2)]];//3 29新增 左鞋压力
+//            int frameCheck =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(59, 1)]];//校验位
+//
+//              if (deviceType==DEVICETYPE_MAIN){//主设备
+//    //                   NSLog(@"主设备 接收到 鞋子动作数据 data = %@",characteristic);
+//                  //调取鞋子SDK
+//    //                   [self shoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righr_acc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
+//
+//              }else if (deviceType==DEVICETYPE_VICE){//副设备动作数据
+//                  //调取鞋子SDK
+//    //                   [self viceShoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righr_acc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
+//              }
+//
+//        }else if (dataType == -95 && characteristic.length == 26){//获取的是查询的数据 char-->int a1 = -95
            //A1+1 >> 1: 设备数据(左鞋,右鞋)  aa 14 eb a1 01 64 00 1a 0000981d 64 00 17 00000000 f9
                 int leftElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(5, 1)]];
                 int rightElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(15, 1)]];//龙哥新协议
                 
                 if (deviceType==DEVICETYPE_MAIN && LEManager.peripheral!=nil){//主设备
-//                    NSLog(@"主设备 接收到 鞋子硬件数据 data 26 = %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
+                    NSLog(@"主设备 接收到 鞋子硬件数据 data 26 = %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
                     //主 设备定时器 60秒调一次   /******************ios call unity*****************/
                      [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_MAIN
                                                  name:LEManager.peripheral.name
@@ -113,7 +113,7 @@
                                           electricity:leftElectricity<=rightElectricity?leftElectricity:rightElectricity];
              
                 }else if (deviceType==DEVICETYPE_VICE && LEManager.vicePeripheral!=nil){//副设备
-//                    NSLog(@"副设备 接收到 鞋子硬件数据 26 = %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
+                    NSLog(@"副设备 接收到 鞋子硬件数据 26 = %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
                     //副 设备定时器 60秒调一次   /******************ios call unity*****************/
                      [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_VICE
                                                  name:LEManager.vicePeripheral.name
@@ -122,7 +122,7 @@
                                           electricity:leftElectricity<=rightElectricity?leftElectricity:rightElectricity];
                     
                 }
-        }
+//        }
 }
 
 

+ 162 - 132
RunGame/SDK/BLE/BTDataProcess.mm

@@ -6,7 +6,7 @@
 #import "BTDataProcess.h"
 #import "IOSPlatformSDK.h"
 #include "Game.h"
-#import <JavaScriptCore/JSBase.h>
+#import "MotionCountObj.h"
 
 //#define NSLog(format, ...) printf("TIME:%s FILE:%s(%d行) FUNCTION:%s %s\n",__TIME__, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String])
 @interface BTDataProcess ()
@@ -42,6 +42,10 @@ Game *viceDeviceGame;
 //当局游戏跳起、下蹲次数
 @property(assign,nonatomic)int initial_jump_count;
 @property(assign,nonatomic)int initial_down_count;
+@property(nonatomic,strong)MotionCountObj * motionCountObj;
+
+//统计参数
+@property(assign,nonatomic)int tempCount;
 
 @end
 
@@ -142,9 +146,19 @@ static BTDataProcess* instance = nil;
     
     //当局游戏时间
     self.firstTime = [NSDate date];
-    //当局动作数据
-    self.initial_down_count = 0;
-    self.initial_jump_count = 0;
+
+    self.motionCountObj = [MotionCountObj new];
+    if (game){
+        self.motionCountObj.step = game->getMotionCount(STEP_COUNT);
+        self.motionCountObj.jump = game->getMotionCount(JUMP_COUNT);
+        self.motionCountObj.crouch = game->getMotionCount(DOWN_COUNT);
+        self.motionCountObj.tick = game->getMotionCount(KICK_COUNT);
+        self.motionCountObj.paper = game->getMotionCount(PAPER_COUNT);
+        self.motionCountObj.scissors = game->getMotionCount(SCISSORS_COUNT);
+        self.motionCountObj.rock = game->getMotionCount(ROCK_COUNT);
+        NSLog(@"self.motionCountObj = %d %d %d %d %d %d %d",self.motionCountObj.step,self.motionCountObj.jump,self.motionCountObj.crouch,self.motionCountObj.tick,self.motionCountObj.paper,self.motionCountObj.scissors,self.motionCountObj.rock);
+    }
+    
     //游戏模式 ==>> 回调剑波sdk数据
     self.gameModel = YES;
     //读写到特征后 添加测试弹窗
@@ -155,11 +169,13 @@ static BTDataProcess* instance = nil;
     //jb
     [DebugViewInstance clearCacheWithFilePath];
     
+//    game->start
+    
 }
 
 //每结束一局游戏
 -(void)gameEndInitData{
-    self.gameModel = NO;
+//    self.gameModel = NO;
     //jb
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(),^{
         [DebugViewInstance uploadpPlistFile];
@@ -205,7 +221,15 @@ static BTDataProcess* instance = nil;
     [CUS_NOTIFICATIONCENTER addObserver:self selector:@selector(enterBackground) name:UIApplicationDidEnterBackgroundNotification object:nil];
     //监听程序 返回 前台
     [CUS_NOTIFICATIONCENTER addObserver:self selector:@selector(willEnterForeground) name:UIApplicationWillEnterForegroundNotification object:nil];
+    //监听程序 被kill
+    [CUS_NOTIFICATIONCENTER addObserver:self selector:@selector(applicationWillTerminate) name:UIApplicationWillTerminateNotification object:nil];
+    
+  }
 
+/** 程序被杀死 */
+-(void)applicationWillTerminate{
+  //  - 监听到 app 被杀死时候的回调....
+    NSLog(@"监听到 app 被杀死时候的回调");
 }
 
 -(void)enterBackground{
@@ -383,7 +407,6 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     if(instance!=NULL && peripheral!=NULL){
        
         self.sdk = [IOSPlatformSDK sharedInstance];//蓝牙数据经过sdk数据转换后 ios call unity
-        self.game_type = GAME_TYPE_RUN;
         DebugViewInstance.currentTS = 1000;
         NSLog(@"BTDataProcess connectPeripheral self.deviceType ==>> %ld  self.game_type ==>> %d   mac ==>>  %@",(long)self.deviceType,self.game_type,self.macAddress);
         
@@ -457,22 +480,36 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     LEManager.readValueForCharacteristicBlock = ^(CBPeripheral * _Nonnull peripheral, CBCharacteristic * _Nonnull characteristic, NSData * _Nonnull value, NSError * _Nonnull error, DEVICE_TYPE type){
         if ([characteristic.UUID.UUIDString isEqualToString:@"6E400003-B5A3-F393-E0A9-E50E24DCCA9E"]){//判断是不是我们设备的特征值
 //            NSLog(@"characteristic.UUID.UUIDString = %@",characteristic.UUID.UUIDString);
-            
+
             //每收到数据包读取一次蓝牙RSSI 无论1秒内请求多少次rssi值,原生api每秒都最多返回一次RSSI
             [peripheral readRSSI];
             
             //带cmd位的有效数据  计算校验位
             if ([AlgorithmTool verificationRusult:characteristic.value]==YES){
                 
-                if (characteristic.value.length > 26){
-                    //数据丢给算法计算轨迹
-                    [self shoseSDKcharacteristic:characteristic.value];
-                }else{
-                    //嵌入式原始数据解析 --->> 回调蓝牙状态/电量给unity
-                    BTDataAnalysis * anly = [BTDataAnalysis new];
-                    [anly analysisCharacteristic:characteristic.value deviceType:type];
-                }
+                int dataType = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
+//                NSLog(@"读取特征的报文 游戏数据 %ld dataType = %d %@",(long)type,dataType,characteristic.value);
+                  if (dataType == 4){//获取主动推过来的数据
+                      
+                          //数据丢给算法计算轨迹
+                          if (type == DEVICETYPE_MAIN&&LEManager.main_read == 0){
+//                              NSLog(@"LEManager.main_read = %d",LEManager.main_read);
+                              LEManager.main_read = 1;
+                              [self shoseSDK:characteristic.value];
+                          }else if (type == DEVICETYPE_VICE&&LEManager.vice_read == 0){
+                              NSLog(@"LEManager.vice_read = %d",LEManager.main_read);
+                              LEManager.vice_read = 1;
+                              [self viceShoseSDK:characteristic.value];
+                          }
+                      
+                  }else if(dataType == -95){//读取基本信息
+                          //嵌入式原始数据解析 --->> 回调蓝牙状态/电量给unity
+                          BTDataAnalysis * anly = [BTDataAnalysis new];
+                          [anly analysisCharacteristic:characteristic.value deviceType:type];
+                  }
+                      
             }
+            
          }
         
     };
@@ -489,6 +526,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
     //蓝牙连接成功
     LEManager.successfulBlock = ^(CBPeripheral * _Nonnull peripheral){
+        NSLog(@"蓝牙链接成功");
             [[AnimationView shanreAnimationView] stopAnimation];
     };
 
@@ -517,6 +555,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
                                      address:LEManager.vicePeripheral.identifier.UUIDString
                                       status:CONNECT_LOST
                                  electricity:0];
+            
         }
         
         NSLog(@"蓝牙链接丢失");
@@ -557,67 +596,71 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 }
 
 #pragma mark ===============================================>> 主设备 报文数据解析后 -- 调用蓝牙鞋子SDK装换数据 -- ios call unity 更新游戏动作
--(void)shoseSDKcharacteristic:(NSData*)characteristic{
-    
-    /********************初始化 运动轨迹算法 SDK *****************/
-    //游戏数据
-//    NSLog(@"characteristic = %@",characteristic);
-    NSData * validData= [characteristic subdataWithRange:NSMakeRange(4, characteristic.length-4)];
-//    NSLog(@"validData = %@",validData);
-    Byte * buff = (Byte*)[validData bytes];
-    game->GameProcessBuf(buff, (int)validData.length);
-    
-    int length = 4;
-    int result[length];
-    game->getGameResult(result);
-//   NSLog(@"result == %d %d %d %d \n",result[0],result[1],result[2],result[3]);
+-(void)shoseSDK:(NSData*)characteristic{
         
-    /******************左右脚动作数据处理 + 回调*****************/
-    int motionLeft = result[0];//左脚的动作
-    int motionRight = result[1];//右脚的动作
-    int motionJump = result[2];//jump
-    int motionDown = result[3];//down
-//    if (motionLeft==-1 && motionRight == -1&& motionJump == -1&& motionDown == -1){//无效动作
-//        return;
-//    }else{
-        //跳跃和蹲下的动作 双脚是同步的
-        if (motionJump == MOTION_JUMP){
-            motionLeft = motionJump;
-            motionRight = motionJump;
-            NSLog(@" 主设备 ================================== 跳起来 ");
-        }
-    
-        if (motionDown == MOTION_DOWN){
-            motionLeft = motionDown;
-            motionRight = motionDown;
-            NSLog(@" 主设备 =================================== 蹲下去 ");
-        }
-//    }
-    
-    /******************步频数据处理 + 回调*****************/
-    int leftStepStatus =  game->getStepStatus(LEFT_FOOT);
-    int leftStepFreq =  game->getStepFreq(LEFT_FOOT);
-    int leftStepCount =  game->getStepCount(LEFT_FOOT);
-    int rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
-    int rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
-    int rightStepCount =  game->getStepCount(RIGHT_FOOT);
-    
-    /******************玩家当前朝向 用户赛车*****************/
-    int attLength = 3;
-    int left[attLength];
-    int right[attLength];
-     game->getFootAtt(left, right);
-    self.nativeAttX = left[0];
-//    NSLog(@"self.nativeAttX = %d",self.nativeAttX);
-    
-    /****************** ios call unity*****************/
         if (self.gameModel==YES){//当前是游戏模式
+            
+            /********************初始化 运动轨迹算法 SDK *****************/
+        //    NSLog(@"characteristic = %@",characteristic);
+            NSData * validData= [characteristic subdataWithRange:NSMakeRange(4, characteristic.length-4)];
+            Byte * buff = (Byte*)[validData bytes];
+            game->GameProcessBuf(buff, (int)validData.length);
+            
+            int length = 4;
+            int result[length];
+            game->getGameResult(result);
+        //   NSLog(@"result == %d %d %d %d \n",result[0],result[1],result[2],result[3]);
+                
+            /******************左右脚动作数据处理 + 回调*****************/
+            int motionLeft = result[0];//左脚的动作
+            int motionRight = result[1];//右脚的动作
+            int motionJump = result[2];//jump
+            int motionDown = result[3];//down
+        //    if (motionLeft==-1 && motionRight == -1&& motionJump == -1&& motionDown == -1){//无效动作
+        //        return;
+        //    }else{
+                //跳跃和蹲下的动作 双脚是同步的
+                if (motionJump == MOTION_JUMP){
+                    motionLeft = motionJump;
+                    motionRight = motionJump;
+                    NSLog(@" 主设备 ================================== 跳起来 ");
+                }
+            
+                if (motionDown == MOTION_DOWN){
+                    motionLeft = motionDown;
+                    motionRight = motionDown;
+                    NSLog(@" 主设备 =================================== 蹲下去 ");
+                }
+        //    }
+            
+            /******************步频数据处理 + 回调*****************/
+            int leftStepStatus =  game->getStepStatus(LEFT_FOOT);
+            int leftStepFreq =  game->getStepFreq(LEFT_FOOT);
+            int leftStepCount =  game->getStepCount(LEFT_FOOT);
+            int rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
+            int rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
+            int rightStepCount =  game->getStepCount(RIGHT_FOOT);
+            
+            /******************玩家当前朝向 用户赛车*****************/
+        //    int attLength = 3;
+        //    int left[attLength];
+        //    int right[attLength];
+        //     game->getFootAtt(left, right);
+        //    self.nativeAttX = left[0];
+        //    NSLog(@"self.nativeAttX = %d",self.nativeAttX);
+            
             //跑酷需要回调步频
             if (self.game_type == GAME_TYPE_RUN){
                 [self.sdk bridgingStepAction:DEVICETYPE_MAIN leftStatus:leftStepStatus rightStatus:rightStepStatus leftFrag:leftStepFreq rightFrag:rightStepFreq];
             }
             //左右脚动作
             [self.sdk bridgingMotionAction:DEVICETYPE_MAIN left:motionLeft right:motionRight];
+            
+            //当局运动数据缓存
+            [self cacheAllMotionCount:leftStepCount+rightStepCount];
+            
+            //测试数据
+            [self tempTest:rightStepFreq leftStepFreq:leftStepFreq];
 
         }else{//当前是交互模式
 
@@ -634,30 +677,18 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 //            }
         }
     
-    /******************数据回调缓存*****************/
-    //标记初始值
-    if (self.initial_jump_count==0){
-        self.initial_jump_count = game->getGameJumpCount();
-    }
-    if (self.initial_down_count==0) {
-        self.initial_down_count = game->getGameDownCount();
-    }
-    //总数
-    int total_jump_count = game->getGameJumpCount();
-    int total_dump_count = game->getGameDownCount();
-    //当局游戏次数
-    int current_jump_count = total_jump_count - self.initial_jump_count;
-    int current_dump_count = total_dump_count - self.initial_down_count;
-    //数据回调缓存
-    [self cacheAllMotionCount:current_jump_count crouchCount:current_dump_count stepCount:leftStepCount + rightStepCount];
+}
+
+//算法需要的测试数据
+-(void)tempTest:(int)rightStepFreq leftStepFreq:(int)leftStepFreq{
     
     /********************剑波 & 威严 要的图表数据 *****************/
     NSString * aString = [NSString stringWithUTF8String:game->getGameDataStr().c_str()];
+//    NSLog(@"aString == %@",aString);
     if (aString.length <1){
         return;
     }
-//    NSLog(@"aString == %@",aString);
-
+   
     //上传即使动作数据
     [[SocketRocketUtility sharedInstance] sendData:nil withRequestURI:aString];
     if (DebugViewInstance.RSSI==nil){
@@ -675,16 +706,15 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
         return;
     }
 //    NSLog(@"aArray == %@",aArray);
-//    dispatch_async(dispatch_get_main_queue(), ^{
+    dispatch_async(dispatch_get_main_queue(), ^{
         if (DebugViewInstance.testLabel!=nil){
             DebugViewInstance.testLabel.text = [NSString stringWithFormat:@"right:[%@,%@,%@] [%@,%@,%@] [%@,%@,%@] [%@,%@,%@] \nleft:[%@,%@,%@] [%@,%@,%@] [%@,%@,%@] [%@,%@,%@]  \nrssi:[%@ %@] ts:%@ \n脚步:[%@ %@] \n步频:[%d %d] ",aArray[0],aArray[1],aArray[2],aArray[3],aArray[4],aArray[5],aArray[6],aArray[7],aArray[8],aArray[9],aArray[10],aArray[11],aArray[12],aArray[13],aArray[14],aArray[15],aArray[16],aArray[17],aArray[18],aArray[19],aArray[20],aArray[21],aArray[22],aArray[23],DebugViewInstance.RSSI,aArray[26],aArray[27],aArray[28],aArray[29],rightStepFreq,leftStepFreq];
         }
-//    });
+    });
     
     /********************颖嘉+的ts丢包数据 *****************/
     NSString * tsString =  aArray[27];
-//    NSLog(@"tsString == %@",tsString);
-
+//    NSLog(@"剑波 getGameDataStr 时间戳 ==============>> %@\n",tsString);
     int tsInt = [tsString  intValue];
     int total;
     if (DebugViewInstance.currentTS != 1000){//颖嘉初始值未知 ios初始值==1000
@@ -701,6 +731,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
             }
         }
         if (total > 20){
+            NSLog(@"getGameDataStr 丢包 ================================>> %d",total);
             dispatch_async(dispatch_get_main_queue(), ^{
                 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
                 [PopupView showCusHUDA:[NSString stringWithFormat:@"丢包数: %d",total]];
@@ -709,45 +740,29 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     }
 //    NSLog(@"tsInt = %d  currentTS = %d total = %d",tsInt,self.currentTS,total);
     DebugViewInstance.currentTS = tsInt;
-    
 }
 
 #pragma mark ===============================================>>副设备 报文数据解析后 -- 调用蓝牙鞋子SDK装换数据 -- ios call unity 更新游戏动作
--(void)viceShoseSDKRight_pos:(int[3])right_pos
-                   Right_att:(int[3])right_att
-                   Right_acc:(int[3])right_acc
-                     LeftPos:(int[3])left_pos
-                    Left_att:(int[3])left_att
-                    Left_acc:(int[3])left_acc
-                          ts:(int)ts
-                   rightZupt:(int)rightZupt
-                    leftZupt:(int)leftZupt
-                        jump:(int)jump
-                        down:(int)down
-                        rssi:(int)rssi
-                   girlShoes:(int)girlShoes
-                 right_press:(int)right_press
-                  left_press:(int)left_press
-              characteristic:(NSData*)characteristic{
-
+-(void)viceShoseSDK:(NSData*)characteristic{
+    
     /********************初始化 运动轨迹算法 SDK *****************/
     //游戏数据
     NSData * validData= [characteristic subdataWithRange:NSMakeRange(4, characteristic.length-4)];
     Byte * buff = (Byte*)[validData bytes];
     viceDeviceGame->GameProcessBuf(buff, (int)validData.length);
-    
+
     int length = 4;
     int result[length];
     viceDeviceGame->getGameResult(result);
     //   NSLog(@"result == %d %d %d %d \n",result[0],result[1],result[2],result[3]);
 
     /********************蓝牙sdk返回的鞋子 状态 步频 步数*****************/
-    int leftStepStatus =  game->getStepStatus(LEFT_FOOT);
-    int leftStepFreq =  game->getStepFreq(LEFT_FOOT);
-    int leftStepCount =  game->getStepCount(LEFT_FOOT);
-    int rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
-    int rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
-    int rightStepCount =  game->getStepCount(RIGHT_FOOT);
+    int leftStepStatus =  viceDeviceGame->getStepStatus(LEFT_FOOT);
+    int leftStepFreq =  viceDeviceGame->getStepFreq(LEFT_FOOT);
+    int leftStepCount =  viceDeviceGame->getStepCount(LEFT_FOOT);
+    int rightStepStatus =  viceDeviceGame->getStepStatus(RIGHT_FOOT);
+    int rightStepFreq =  viceDeviceGame->getStepFreq(RIGHT_FOOT);
+    int rightStepCount =  viceDeviceGame->getStepCount(RIGHT_FOOT);
     
     /********************蓝牙sdk返回的鞋子 动作*****************/
     int motionLeft = result[0];//左脚的动作
@@ -776,7 +791,9 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
         }
         //ios call unity
         [self.sdk bridgingMotionAction:DEVICETYPE_VICE left:motionLeft right:motionRight];//副设备左右脚动作
-
+    
+    //}
+    
 }
 
 #pragma mark ===============================================>> 懒加载 -- 蓝牙设备数据源
@@ -787,27 +804,40 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     return _deviceArray;;
 }
 
-//数据存入plist
-//玩游戏过程中缓存 动作数据 和时间戳
--(void)cacheAllMotionCount:(int)jump_count crouchCount:(int)crouch_count stepCount:(int)step_count{
+#pragma mark ===============================================>>玩游戏过程中缓存 动作数据 和时间戳 数据存入plist
+-(void)cacheAllMotionCount:(int)totalStep{
     
-    //游戏持续时间
-    NSTimeInterval durationTime = [[NSDate date] timeIntervalSinceDate:self.firstTime];//游戏总共经历的时长 秒数
+    //总数
+    int total_step_count = game->getMotionCount(STEP_COUNT) - self.motionCountObj.step;
+    int total_jump_count = game->getMotionCount(JUMP_COUNT) - self.motionCountObj.jump;
+    int total_crouch_count = game->getMotionCount(DOWN_COUNT) - self.motionCountObj.crouch;
+    int total_tick_count = game->getMotionCount(KICK_COUNT) - self.motionCountObj.tick;
+    int total_paper_count = game->getMotionCount(PAPER_COUNT) - self.motionCountObj.paper;
+    int total_scissors_count = game->getMotionCount(SCISSORS_COUNT) - self.motionCountObj.scissors;
+    int total_rock_count = game->getMotionCount(ROCK_COUNT) - self.motionCountObj.rock;
+
     //缓存pilst文件
-    NSMutableDictionary * bleDict = [NSMutableDictionary new];
-    [bleDict setObject:[NSNumber numberWithInt:durationTime] forKey:@"duration"];
-    [bleDict setObject:[NSNumber numberWithInt:jump_count] forKey:@"jump"];
-    [bleDict setObject:[NSNumber numberWithInt:crouch_count] forKey:@"crouch"];
-    [bleDict setObject:[NSNumber numberWithInt:step_count] forKey:@"step"];
-    NSDictionary * dict = [NSDictionary dictionaryWithDictionary:bleDict];
+    NSMutableDictionary * motionCountObj = [NSMutableDictionary new];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_step_count] forKey:@"step"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_jump_count] forKey:@"jump"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_crouch_count] forKey:@"crouch"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_tick_count] forKey:@"tick"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_paper_count] forKey:@"paper"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_scissors_count] forKey:@"scissors"];
+    [motionCountObj setObject:[NSNumber numberWithInt:total_rock_count] forKey:@"rock"];
+    [motionCountObj setObject:[NSNumber numberWithInt:0] forKey:@"trample"];
+
+    NSMutableDictionary * movements = [NSMutableDictionary new];
+    [movements setObject:motionCountObj forKey:@"movements"];
+    NSTimeInterval durationTime = [[NSDate date] timeIntervalSinceDate:self.firstTime];//游戏总共经历的时长 秒数
+    [movements setObject:[NSNumber numberWithInt:durationTime] forKey:@"duration"];
+
+    NSDictionary * dict = [NSDictionary dictionaryWithDictionary:movements];
+        
     //归档缓存
-    [IOS_NSUSERDEFAULT setObject:dict forKey:IOSSDK_BLESDKDATA];
+    [IOS_NSUSERDEFAULT setObject:dict forKey:IOSSDK_MOTIONCOUNT];
     [IOS_NSUSERDEFAULT synchronize];
     
-   
-    
 }
 
 @end
-
-

+ 1 - 1
RunGame/SDK/BLE/BTDataSend.m

@@ -105,7 +105,7 @@ static BTDataSend* instance = nil;
      Byte lengthNegation = ~length;
      Byte cmd = 0xA4;
      //振动时间 2字节
-     short ms = 100;//400毫秒
+     short ms = 200;//400毫秒
      Byte mslow = (Byte) (0x00FF & ms);//定义第一个byte
      Byte mshigh = (Byte) (0x00FF & (ms>>8));//定义第二个byte
     //计算校验位

+ 11 - 0
RunGame/SDK/BLE/LEONBLManager.h

@@ -78,6 +78,17 @@ typedef void(^RSSIBlock)(NSNumber *RSSI);
 @property(nonatomic,strong)CBCharacteristic * viceWrite;
 @property(nonatomic,strong)CBCharacteristic * viceRead;
 
+//防止同一条数据回调多次
+@property(assign,nonatomic)int main_read;
+@property(assign,nonatomic)int vice_read;
+
+/**测试参数start*/
+//临时的时间戳
+@property(assign,nonatomic)int totalPackages;
+@property(assign,nonatomic)int totalLoss;
+@property(assign,nonatomic)int tempTs;
+/**测试参数end*/
+
 /**
  声明单例类
  */

+ 45 - 13
RunGame/SDK/BLE/LEONBLManager.m

@@ -5,6 +5,7 @@
 //  Created by Leon on 2021/4/23.
 
 #import "LEONBLManager.h"
+#import "AlgorithmTool.h"
 
 //CBCentralManagerDelegate 蓝牙外设回调代理
 //CBPeripheralDelegate 蓝牙链接后的数据回调代理
@@ -89,6 +90,8 @@ static LEONBLManager * instance;
  */
 - (void)connectPeripheral:(CBPeripheral *)peripheral options:(nullable NSDictionary<NSString *, id> *)options{
     
+    [self stopScan];
+    
     if (peripheral==self.peripheral){
         [self.centralManager connectPeripheral:self.peripheral options:options];
         NSLog(@"主设备 主动连接蓝牙外设 = %@  %p  %p",self.peripheral.name,self.peripheral,peripheral);
@@ -250,10 +253,10 @@ static LEONBLManager * instance;
 - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(nullable NSError *)error{
     
 //    NSLog(@"发现所有服务+特征的值  %p  %p %p",self.peripheral,self.vicePeripheral,peripheral);
-
+    __weak __typeof(self)weakself = self;
     if (_discoverCharacteristicsBlock){
         
-        if (peripheral==self.peripheral){
+        if (peripheral == weakself.peripheral){
             
             _discoverCharacteristicsBlock(peripheral,service,service.characteristics,error);
             
@@ -271,7 +274,7 @@ static LEONBLManager * instance;
 
             }
 
-        }else if (peripheral == self.vicePeripheral){
+        }else if (peripheral == weakself.vicePeripheral){
             
             _discoverCharacteristicsBlock(peripheral,service,service.characteristics,error);
             NSLog(@"副设备 发现 %@ 服务+特征",peripheral.name);
@@ -285,18 +288,45 @@ static LEONBLManager * instance;
 //收到数据的回调
 - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error{
     
+    __weak __typeof(self)weakself = self;
     if (_readValueForCharacteristicBlock){
-        
+                
         NSData *data = characteristic.value;
 
-        if (peripheral==self.peripheral){
+        if (peripheral == weakself.peripheral){
             
-            _readValueForCharacteristicBlock(self.peripheral,characteristic,data,error,DEVICETYPE_MAIN);
-//            NSLog(@"收到主设备 %@ 推送的报文 %@",peripheral.name,data);
+            if (characteristic.value.length >60){
+                
+                weakself.main_read = 0;
 
-        }else if (peripheral == self.vicePeripheral){
+                int newTs = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
+                
+                self.totalPackages++;
+                int total_loss = self.tempTs - abs(newTs);
+                int abs_loss = abs(total_loss);
+//                NSLog(@"收到主设备 推送的报文 时间戳 ================ >>%d %d 【%d - %d = %d】",self.totalPackages,newTs,self.tempTs,abs(newTs),abs_loss);
+                
+                if (abs_loss>2){
+                self.totalLoss = self.totalLoss+(abs_loss/2-1);
+//                NSLog(@"系统api丢包 ===================================================================== >> %d %d/%d",abs_loss/2-1,self.totalLoss,self.totalPackages);
+                }
+                
+                self.tempTs = abs(newTs);
+                
+            }
+            
+            _readValueForCharacteristicBlock(weakself.peripheral,characteristic,data,error,DEVICETYPE_MAIN);
+//            NSLog(@"收到主设备 %@ 推送的报文 %@",peripheral.name,data);
+           
+        }else if (peripheral == weakself.vicePeripheral){
+            
+            if (characteristic.value.length >60){
+//                int ts = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
+//                NSLog(@"收到副设备 推送的报文 时间戳 ==============>> %d",ts);
+                weakself.vice_read = 0;
+            }
             
-            _readValueForCharacteristicBlock(self.vicePeripheral,characteristic,data,error,DEVICETYPE_VICE);
+            _readValueForCharacteristicBlock(weakself.vicePeripheral,characteristic,data,error,DEVICETYPE_VICE);
 //            NSLog(@"收到副设备 %@ 推送的报文 %@",peripheral.name,data);
 
         }
@@ -308,16 +338,18 @@ static LEONBLManager * instance;
 //写入数据的回调
 - (void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(nullable NSError *)error{
   
+    __weak __typeof(self)weakself = self;
+
     if (_writeToCharacteristicBlock){
         
-        if (peripheral==self.peripheral){
+        if (peripheral==weakself.peripheral){
             
-            _writeToCharacteristicBlock(self.peripheral,characteristic,error,DEVICETYPE_MAIN);
+            _writeToCharacteristicBlock(weakself.peripheral,characteristic,error,DEVICETYPE_MAIN);
 //            NSLog(@"收到主设备 %@ 的response",peripheral.name);
 
-        }else if (peripheral == self.vicePeripheral){
+        }else if (peripheral == weakself.vicePeripheral){
             
-            _writeToCharacteristicBlock(self.vicePeripheral,characteristic,error,DEVICETYPE_VICE);
+            _writeToCharacteristicBlock(weakself.vicePeripheral,characteristic,error,DEVICETYPE_VICE);
 //            NSLog(@"收到附设备 %@ 的response",peripheral.name);
 
         }

+ 0 - 51
RunGame/SDK/BLE/MainShoesAnalysis.h

@@ -1,51 +0,0 @@
-////
-////  MainShoesAnalysis.h
-////  Unity-iPhone
-////
-////  Created by duowan123 on 2021/12/4.
-////
-//
-//#import <Foundation/Foundation.h>
-//#import "MYFactoryManager.h"
-//
-//NS_ASSUME_NONNULL_BEGIN
-//
-//@interface MainShoesAnalysis : NSObject
-//
-//
-//+(instancetype)sharedInstance;
-//
-////弹窗 unity主动选择链接 主0 副1 设备
-//@property(assign,nonatomic)DEVICE_TYPE deviceType;
-////游戏种类 1是跳舞 3是跑酷 2是赛达尔传说 4是demo->dance
-//@property(assign,nonatomic)GAME_TYPE game_type;
-//
-////主设备跳起 下蹲 步数 的总数
-//@property(assign,nonatomic)int initial_jump_count;
-//@property(assign,nonatomic)int initial_down_count;
-////步数回调缓存
-//@property(copy,nonatomic)void (^allMotionCountBLock)(int jump_count,int crouch_count,int step_count);//蓝牙设备数据源
-////脚步交互数据
-//@property(copy,nonatomic)void (^getInteractionBlock)(int interaction);//蓝牙设备数据源
-//
-//@property(assign,nonatomic)int isBackGround;//程序在前台还是后台
-//
-//@property(nonatomic,assign)BOOL gameModel;//是否开启游戏模式
-//
-///*****测试*******/
-//@property (nonatomic,strong)UILabel * testLabel;//调试框
-//@property (nonatomic,strong)UIButton * uploadButton;//上传
-//@property (nonatomic,strong)UIButton * clearnButton;//上传
-//
-////当前的时间戳+丢包
-//@property (nonatomic,assign)int  tempTs;
-//@property (nonatomic,assign)int  loss;
-//@property (nonatomic,assign)int  totalPackages;
-//@property (nonatomic,strong)NSString * tempStepString;//剑波要的字符串数据 缓存plist
-//@property(nonatomic,assign) NSNumber *RSSI;//威严要的测试数据
-//@property(nonatomic,assign) int currentTS;//颖嘉要的测试数据
-//
-//
-//@end
-//
-//NS_ASSUME_NONNULL_END

+ 0 - 551
RunGame/SDK/BLE/MainShoesAnalysis.mm

@@ -1,551 +0,0 @@
-////
-////  MainShoesAnalysis.m
-////  Unity-iPhone
-////
-////  Created by duowan123 on 2021/12/4.
-////
-//
-//#import "MainShoesAnalysis.h"
-//
-//@interface MainShoesAnalysis()
-//{
-//@private
-//Game *game;
-//}
-//
-//@end
-//
-//@implementation MainShoesAnalysis
-//
-////单例静态
-//static MainShoesAnalysis* instance = nil;
-//+(instancetype)sharedInstance{
-////    NSLog(@"创建单例一次 1");
-//     return [[self alloc] init];
-//}
-//
-//+ (instancetype)allocWithZone:(struct _NSZone *)zone{
-////    NSLog(@"创建单例一次 2");
-//  static dispatch_once_t onceToken;
-//  dispatch_once(&onceToken, ^{
-//      instance = [super allocWithZone:zone];
-//  });
-//  return instance;
-//}
-//
-//- (instancetype)init{
-////    NSLog(@"创建单例一次 3");
-//    static dispatch_once_t onceToken;
-//    dispatch_once(&onceToken, ^{
-//        instance = [super init];
-//    });
-//    return instance;
-//}
-//
-//#pragma mark ===============================================>> 校验 & 报文数据解析
-//-(void)verifyData:(CBCharacteristic*)characteristic deviceType:(DEVICE_TYPE)deviceType{
-//    
-//     if (characteristic.value.length>3){
-//         
-//         //带cmd位的有效数据  计算校验位
-//         if ([AlgorithmTool verificationRusult:characteristic.value]==YES){
-//             
-//             [self analysisCharacteristic:characteristic.value deviceType:deviceType];
-//                              
-//         }
-//         
-//     }else{
-//         
-//         NSLog(@"无效报文");
-//         
-//     }
-//     
-//}
-//
-//-(void)analysisCharacteristic:(NSData*)characteristic deviceType:(DEVICE_TYPE)deviceType{
-//        
-////        NSLog(@"接收到的数据data = %@",characteristic);
-//    
-//    int frameHead = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(0, 1)]];//帧头数据aa
-//    int messageLength = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(1, 1)]];//报文长度
-//    int messageLengthNegation = ~messageLength;//报文长度取反
-//    int dataType = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
-//    
-//      if (dataType == 4){//获取主动推过来的数据
-//            //右脚坐标数据
-//           int right_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(4, 4)];
-//           int right_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(8, 4)];
-//           int right_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(12, 4)];
-//           int  right_pos[3] = {right_X,right_Y,right_Z};
-//          //左脚坐标数据
-//           int left_X = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(16, 4)];
-//           int left_Y = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(20, 4)];
-//           int left_Z = [AlgorithmTool dataToSwapBigIntToHost:characteristic andRange:NSMakeRange(24, 4)];
-//           int  left_pos[3] = {left_X,left_Y,left_Z};
-//           //右脚姿势数据
-//           short righrPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(28, 2)];
-//           short righrPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(30, 2)];
-//           short righrPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(32, 2)];
-//           int  right_att[3] = {righrPosture_X,righrPosture_Y,righrPosture_Z};
-//           //左脚姿势数据
-//           short leftPosture_X = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(34, 2)];
-//           short leftPosture_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(36, 2)];
-//           short leftPosture_Z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(38, 2)];
-//           int  left_att[3] = {leftPosture_X,leftPosture_Y,leftPosture_Z};
-//           //右脚三维数据
-//           short righrAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(40, 2)];
-//           short righrAcc_Y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(42, 2)];
-//           short righrAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(44, 2)];
-//           int  righrAcc[3] = {righrAcc_x,righrAcc_Y,righrAcc_z};
-//           //左脚三维数据
-//           short leftAcc_x = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(46, 2)];
-//           short leftAcc_y = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(48, 2)];
-//           short leftAcc_z = [AlgorithmTool dataToSwapBigShortToHost:characteristic andRange:NSMakeRange(50, 2)];
-//           int  left_acc[3] = {leftAcc_x,leftAcc_y,leftAcc_z};
-//           //左脚、右脚、蹲 、跳四个动作信息数据
-//           int actionInformation =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(52, 1)]];;//0c 16进制字符串
-//                       int girlShoes  = actionInformation & 16;
-//                       if (girlShoes!=0){
-//                           girlShoes=1;
-//                       }else{
-//                           girlShoes=0;
-//                       }
-//                       int rightZupt  = actionInformation & 8;
-//                       if (rightZupt!=0){
-//                           rightZupt=1;
-//                       }else{
-//                           rightZupt=0;
-//                       }
-//                       int leftZupt = actionInformation & 4;
-//                       if (leftZupt!=0){
-//                            leftZupt=1;
-//                        }else{
-//                            leftZupt=0;
-//                        }
-//                       int down  = actionInformation & 2;
-//                       if (down!=0){
-//                            down=1;
-//                        }else{
-//                            down=0;
-//                        }
-//                       int jump  = actionInformation & 1;
-//                       if (jump!=0){
-//                            jump=1;
-//                        }else{
-//                            jump=0;
-//                        }
-//          
-//            int rssi = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(53, 1)]];//rssi 信号强度
-//            int ts = [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
-//            int right_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(55, 2)]];//3 29新增 右鞋压力
-//            int left_press = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(57, 2)]];//3 29新增 左鞋压力
-//            int frameCheck =  [AlgorithmTool dataToChar:[characteristic subdataWithRange:NSMakeRange(59, 1)]];//校验位
-//        
-//               if (deviceType==DEVICETYPE_MAIN){//主设备
-//                   
-////                   NSLog(@"主设备 接收到 鞋子动作数据 data = %@",characteristic);
-//                   //调取鞋子SDK
-//                   [self shoseSDKRight_pos:right_pos Right_att:right_att Right_acc:righrAcc LeftPos:left_pos Left_att:left_att Left_acc:left_acc ts:ts rightZupt:rightZupt leftZupt:leftZupt jump:jump down:down rssi:rssi girlShoes:girlShoes right_press:right_press left_press:left_press characteristic:characteristic];
-//                   
-//               }else if (deviceType==DEVICETYPE_VICE){//副设备动作数据
-//                   
-////                   NSLog(@"副设备 接收到 鞋子动作数据 data = %@",characteristic);
-//                   //调取鞋子SDK
-//  
-//                   
-//               }
-//              
-//        }else if (dataType == -95){//获取的是查询的数据 char-->int a1 = -95
-//
-//            if (characteristic.length == 74){//A1+0  >> 0: 设备基本信息 ==>> 预留参数 趣动app用 sdk暂未调用
-//                
-////                NSString *deviceModel = [[NSString alloc] initWithData:[characteristic subdataWithRange:NSMakeRange(5, 18)] encoding:NSUTF8StringEncoding];
-////                NSString *softwareVer = [AlgorithmTool hexadecimalString:[characteristic subdataWithRange:NSMakeRange(69, 2)]];//0102
-////                NSString *hardwareVer = [AlgorithmTool hexadecimalString:[characteristic subdataWithRange:NSMakeRange(71, 2)]];//0104
-//                
-//            }else if (characteristic.length == 26){//A1+1 >> 1: 设备数据(左鞋,右鞋)  aa 14 eb a1 01 64 00 1a 0000981d 64 00 17 00000000 f9
-//                
-//                int leftElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(5, 1)]];
-////                int leftTempreature = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(6, 1)]];
-////                int leftPressure = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(7, 4)]];
-////                int leftStepCount = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(11, 4)]];
-////                int rightElectricity = [self dataToInt:[characteristic subdataWithRange:NSMakeRange(12, 1)]];
-//                int rightElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(15, 1)]];//龙哥新协议
-////                int rightTempreature = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(16, 1)]];
-////                int rightPressure = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(17, 4)]];
-////                int rightStepCount = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(21, 4)]];
-//                
-//                if (deviceType==DEVICETYPE_MAIN && LEManager.peripheral!=nil){//主设备
-//                    
-////                    NSLog(@"主设备 接收到 鞋子硬件数据 data 26 = %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
-//
-//                    //主 设备定时器 60秒调一次   /******************ios call unity*****************/
-//                     [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_MAIN
-//                                                 name:LEManager.peripheral.name
-//                                              address:LEManager.peripheral.identifier.UUIDString
-//                                               status:CONNECT_ED
-//                                          electricity:20];
-//             
-//                }else if (deviceType==DEVICETYPE_VICE && LEManager.vicePeripheral!=nil){//副设备
-//                    
-//                    NSLog(@"副设备 接收到 鞋子硬件数据 26 = %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
-//
-//                    //副 设备定时器 60秒调一次   /******************ios call unity*****************/
-//                     [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_VICE
-//                                                 name:LEManager.vicePeripheral.name
-//                                              address:LEManager.vicePeripheral.identifier.UUIDString
-//                                               status:CONNECT_ED
-//                                          electricity:leftElectricity<=rightElectricity?leftElectricity:rightElectricity];
-//                    
-//                }
-//             
-//           }
-//            
-//      }
-//    
-//}
-//
-//#pragma mark ===============================================>> 主设备 报文数据解析后 -- 调用蓝牙鞋子SDK装换数据 -- ios call unity 更新游戏动作
-//-(void)shoseSDKRight_pos:(int[3])right_pos
-//               Right_att:(int[3])right_att
-//               Right_acc:(int[3])right_acc
-//                 LeftPos:(int[3])left_pos
-//                Left_att:(int[3])left_att
-//                Left_acc:(int[3])left_acc
-//                      ts:(int)ts
-//               rightZupt:(int)rightZupt
-//                leftZupt:(int)leftZupt
-//                    jump:(int)jump
-//                    down:(int)down
-//                    rssi:(int)rssi
-//               girlShoes:(int)girlShoes
-//             right_press:(int)right_press
-//              left_press:(int)left_press
-//          characteristic:(NSData*)characteristic{
-//    
-//    /********************初始化 运动轨迹算法 SDK *****************/
-//    //游戏数据
-//    NSData * validData= [characteristic subdataWithRange:NSMakeRange(4, characteristic.length-4)];
-//    Byte * buff = (Byte*)[validData bytes];
-//    game->GameProcessBuf(buff, (int)validData.length);
-//    
-//    int length = 4;
-//    int result[length];
-//    game->getGameResult(result);
-//    //   NSLog(@"result == %d %d %d %d \n",result[0],result[1],result[2],result[3]);
-//
-//    
-//    /******************步频数据处理 + 回调*****************/
-//    int leftStepStatus =  game->getStepStatus(LEFT_FOOT);
-//    int leftStepFreq =  game->getStepFreq(LEFT_FOOT);
-//    int leftStepCount =  game->getStepCount(LEFT_FOOT);
-//    int rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
-//    int rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
-//    int rightStepCount =  game->getStepCount(RIGHT_FOOT);
-//        
-//    /******************左右脚动作数据处理 + 回调*****************/
-//    int motionLeft = result[0];//左脚的动作
-//    int motionRight = result[1];//右脚的动作
-//    int motionJump = result[2];//jump
-//    int motionDown = result[3];//down
-////    if (motionLeft==-1 && motionRight == -1&& motionJump == -1&& motionDown == -1){//无效动作
-////        return;
-////    }else{
-//        //跳跃和蹲下的动作 双脚是同步的
-//        if (motionJump == MOTION_JUMP){
-//            motionLeft = motionJump;
-//            motionRight = motionJump;
-//            NSLog(@" 主设备 ================================== 跳起来 ");
-//        }
-//    
-//        if (motionDown == MOTION_DOWN){
-//            motionLeft = motionDown;
-//            motionRight = motionDown;
-//            NSLog(@" 主设备 =================================== 蹲下去 ");
-//        }
-////    }
-//    
-//    /****************** ios call unity*****************/
-//        if (self.gameModel==YES){//当前是游戏模式
-//
-//            //跑酷需要回调步频
-//            if (self.game_type == GAME_TYPE_RUN){
-//                [[IOSPlatformSDK sharedInstance] bridgingStepAction:DEVICETYPE_MAIN leftStatus:leftStepStatus rightStatus:rightStepStatus leftFrag:leftStepFreq rightFrag:rightStepFreq];
-//            }
-//            //左右脚动作
-//            [[IOSPlatformSDK sharedInstance] bridgingMotionAction:DEVICETYPE_MAIN left:motionLeft right:motionRight];
-//
-//        }else{//当前是交互模式
-//
-//            int interaction = game->getInteractionCMD();
-////            NSLog(@"主设备 当前的脚步交互动作 ===== >> %d",interaction);
-//            [[IOSPlatformSDK sharedInstance] bridgingInteraction:DEVICETYPE_MAIN code:interaction];
-//            if (self.getInteractionBlock){
-//                self.getInteractionBlock(interaction);
-//            }
-//        }
-//    
-//    /******************数据回调缓存*****************/
-//    //标记初始值
-//    if (self.initial_jump_count==0){
-//        self.initial_jump_count = game->getGameJumpCount();
-//    }
-//    if (self.initial_down_count==0) {
-//        self.initial_down_count = game->getGameDownCount();
-//    }
-//    //总数
-//    int total_jump_count = game->getGameJumpCount();
-//    int total_dump_count = game->getGameDownCount();
-//    //当局游戏次数
-//    int current_jump_count = total_jump_count - self.initial_jump_count;
-//    int current_dump_count = total_dump_count - self.initial_down_count;
-//    //数据回调缓存
-//    if (self.allMotionCountBLock){
-//        self.allMotionCountBLock(current_jump_count, current_dump_count, leftStepCount + rightStepCount);
-//    }
-//    
-//    /********************剑波 & 威严 要的图表数据 *****************/
-//    NSString * aString = [NSString stringWithUTF8String:game->getGameDataStr().c_str()];
-//    if (self.RSSI==nil){
-//        self.RSSI = 0;
-//    }
-//     aString = [NSString stringWithFormat:@"%@,%@",aString,self.RSSI];
-//    self.tempStepString = [NSString stringWithFormat:@"%@\n",aString];
-//    if (self.tempStepString!=nil && self.tempStepString.length>1){
-//        [self writeFileToplist];
-//    }
-//  
-//    /********************调试窗数据 *****************/
-//    NSArray *aArray = [self.tempStepString componentsSeparatedByString:@","];
-////    dispatch_async(dispatch_get_main_queue(), ^{
-//        if (self.testLabel!=nil){
-//            self.testLabel.text = [NSString stringWithFormat:@"right:[%d,%d,%d] [%d,%d,%d] [%d,%d,%d] \nleft:[%d,%d,%d] [%d,%d,%d] [%d,%d,%d] \nZupt:[%d,%d]  press:[%d,%d] \nj&d[%d %d]  rssi:[%d %@] ts:%d \n脚步: %@ %@\n步频: %d %d ",right_pos[0],right_pos[1],right_pos[2],right_att[0],right_att[1],right_att[2],right_acc[0],right_acc[1],right_acc[2],left_pos[0],left_pos[1],left_pos[2],left_att[0],left_att[1],left_att[2],left_acc[0],left_acc[1],left_acc[2],rightZupt,leftZupt,right_press,left_press,jump,down,rssi,self.RSSI,ts,aArray[aArray.count-2],aArray.lastObject,leftStepFreq,rightStepFreq];
-//        }
-////    });
-//    
-//    /********************颖嘉+的ts丢包数据 *****************/
-//    NSString * tsString =  aArray[aArray.count-4];
-//    int tsInt = [tsString  intValue];
-//    int total;
-//    //1....255
-//    if (tsInt > self.currentTS){
-//         total = tsInt - self.currentTS - 1;
-//    }
-//    //255...1
-//    if (tsInt < self.currentTS){
-//        if (tsInt ==0) {
-//            total = (255-self.currentTS) + tsInt + 1 - 1;
-//        }else{
-//            total = (255-self.currentTS) + tsInt - 1;
-//        }
-//    }
-////    NSLog(@"tsInt = %d  currentTS = %d total = %d",tsInt,self.currentTS,total);
-//    if (total > 20){
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
-//            [PopupView showCusHUDA:[NSString stringWithFormat:@"丢包数: %d",total]];
-//        });
-//    }
-//    self.currentTS = tsInt;
-//    
-//}
-//
-//
-//#pragma mark ===============================================>> DEBUG
-//-(void)inittestLabel{
-//
-//    if (self.testLabel!=nil){
-//        [self.testLabel removeFromSuperview];
-//    }
-//    
-//    if (self.uploadButton!=nil){
-//        [self.uploadButton removeFromSuperview];
-//    }
-//    
-//    if (self.clearnButton!=nil){
-//        [self.clearnButton removeFromSuperview];
-//    }
-//    
-//    self.uploadButton = [UIButton buttonWithType:UIButtonTypeCustom];
-//    self.uploadButton.frame = CGRectMake(30, SCREEN_HEIGHT-40-10, SCALEoefficient(75), SCALEoefficient(30));
-//    self.uploadButton.backgroundColor = [UIColor redColor];
-//    [self.uploadButton addTarget: self action: @selector (button1BackGroundHighlighted:) forControlEvents:UIControlEventTouchDown];
-//    [self.uploadButton addTarget: self action: @selector (button1BackGroundNormal:) forControlEvents:UIControlEventTouchUpInside];
-//    [self.uploadButton setFont: [UIFont boldSystemFontOfSize:SCALEoefficient(15)]];
-//    [self.uploadButton setTitle:@"上传" forState:UIControlStateNormal];
-//    [self.uploadButton addTarget:self action:@selector(uploadpPlistFile) forControlEvents:UIControlEventTouchUpInside];
-//    
-//    self.clearnButton = [UIButton buttonWithType:UIButtonTypeCustom];
-//    self.clearnButton.frame = CGRectMake(30+SCALEoefficient(75)+20, SCREEN_HEIGHT-40-10, SCALEoefficient(75), SCALEoefficient(30));
-//    self.clearnButton.backgroundColor = [UIColor redColor];
-////    [self.clearnButton addTarget:self action:@selector(button1BackGroundHighlighted:) forControlEvents:UIControlEventTouchDown];
-////    [self.clearnButton addTarget:self action:@selector(button1BackGroundNormal:) forControlEvents:UIControlEventTouchUpInside];
-//    [self.clearnButton setFont: [UIFont boldSystemFontOfSize:SCALEoefficient(15)]];
-//    [self.clearnButton setTitle:@"清理缓存" forState:UIControlStateNormal];
-//    [self.clearnButton addTarget:self action:@selector(clearCacheWithFilePath) forControlEvents:UIControlEventTouchUpInside];
-//    
-//    self.testLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCALEoefficient(20), 0, [UIScreen mainScreen].bounds.size.width-100, SCALEoefficient(160))];
-//    self.testLabel.textColor = [UIColor redColor];
-//    self.testLabel.font = [UIFont boldSystemFontOfSize:SCALEoefficient(14)];
-//    self.testLabel.backgroundColor = [UIColor clearColor];
-//    self.testLabel.textAlignment = NSTextAlignmentCenter;
-//    self.testLabel.numberOfLines = 0;
-//
-//    if ([UIApplication sharedApplication].keyWindow != nil){
-//        [[UIApplication sharedApplication].keyWindow addSubview:self.uploadButton];
-//        [[UIApplication sharedApplication].keyWindow addSubview:self.clearnButton];
-//        [[UIApplication sharedApplication].keyWindow addSubview:self.testLabel];
-//    }
-//
-//}
-//
-////  button普通状态下的背景色
-//- ( void )button1BackGroundNormal:(UIButton *)sender
-//{
-//     sender.backgroundColor = [UIColor redColor];
-//}
-// 
-////  button高亮状态下的背景色
-//- ( void )button1BackGroundHighlighted:(UIButton *)sender
-//{
-//     sender.backgroundColor = [UIColor orangeColor];
-//}
-//
-//#pragma mark ===============================================>> 存储和上传数据
-//- (void)clearCacheWithFilePath{
-//    
-//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//    //获取完整路径
-//    NSString *documentsDirectory = [paths objectAtIndex:0];
-//    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];//这里就是你将要存储的沙盒路径(.plist文件,名字自定义)
-//    NSError *error = nil;
-//    //删除子文件夹
-//    [[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
-//    if (error){
-//        NSLog(@"清理缓存失败");
-//        [PopupView showCusHUDA:@"清理失败"];
-//    }else{
-//        NSLog(@"清理缓存成功");
-//        [PopupView showCusHUDA:@"清理成功"];
-//    }
-//    
-//}
-//
-////数据写入沙河
-//-(void)writeFileToplist{
-//    
-//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//    //获取完整路径
-//    NSString *documentsDirectory = [paths objectAtIndex:0];
-//    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];//这里就是你将要存储的沙盒路径(.plist文件,名字自定义)
-//
-//    if(![[NSFileManager defaultManager] fileExistsAtPath:filePath]){//plistPath这个文件\文件夹是否存在
-//
-//        NSLog(@"-------文件不存在,写入文件----------");
-//
-//               NSError *error;
-//               if([self.tempStepString writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:&error]){
-//                   NSLog(@"------写入文件------success");
-//               }else{
-//                    NSLog(@"------写入文件------fail,error==%@",error);
-//               };
-//
-//    }else{
-//
-////     NSLog(@"-------文件存在,追加文件----------");
-//       NSFileHandle *fileHandle = [NSFileHandle fileHandleForUpdatingAtPath:filePath];
-//       [fileHandle seekToEndOfFile];  //将节点跳到文件的末尾
-//       NSData* stringData  = [self.tempStepString dataUsingEncoding:NSUTF8StringEncoding];
-//       [fileHandle writeData:stringData]; //追加写入数据
-//       [fileHandle closeFile];
-//
-//    }
-//
-//}
-//
-//-(void)uploadpPlistFile{
-//    
-//    //这个方法获取出的结果是一个数组.因为有可以搜索到多个路径.
-//    NSArray *array =  NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-//    //在这里,我们指定搜索的是Cache目录,所以结果只有一个,取出Cache目录
-//    NSString *documentsDirectory = array[0];
-////    NSLog(@"%@",documentsDirectory);
-//    //拼接文件路径
-//    NSString *filePathName = [documentsDirectory stringByAppendingPathComponent:JBSDKLog];
-//    //如果保存的是一个数组.那就通过数组从文件当中加载.
-//    NSString *string = [NSString stringWithContentsOfFile:filePathName encoding:NSUTF8StringEncoding error:nil];
-////    NSLog(@"%@",string);
-//    //4.设置请求体
-//    NSData *upData = [string dataUsingEncoding:NSUTF8StringEncoding];
-//    //
-//    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
-//    manager.requestSerializer.timeoutInterval=15;
-//    [manager.requestSerializer setValue:@"multipart/form-data" forHTTPHeaderField:@"Content-Type"];
-//    manager.requestSerializer = [AFJSONRequestSerializer serializer];
-//    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/html",@"application/json",@"text/javascript",@"image/jpeg",@"image/png",@"application/octet-stream",@"application/x-www-form-urlencoded", nil];
-//    //    NSLog(@"请求URL ===================>> %@",urlString);
-//    NSLog(@"******************* 请求头参数 = %@ ***************************",manager.requestSerializer.HTTPRequestHeaders);
-//    
-//    AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:nil];
-//    [sessionManager POST:@"http://172.16.14.127:8080/upload" parameters:nil headers:nil constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData){
-//
-//        [formData  appendPartWithFileData:upData name:@"file" fileName:[NSString stringWithFormat:@"ios_%@_%@.txt",Game_Type,[self getNowTimeTimestamp]] mimeType:@"text/plain"];
-//
-//        }progress:^(NSProgress * _Nonnull uploadProgress){
-//            NSLog(@"上传进度 = %@",uploadProgress);
-//
-//        }success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject){
-//            NSLog(@"上传成功");
-//
-//        }failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error){
-//
-//            for (NSString * key  in error.userInfo){
-//
-//                if ([key isEqualToString:@"com.alamofire.serialization.response.error.data"]){
-//
-//                    id errorObject = [NSJSONSerialization JSONObjectWithData:error.userInfo[key] options:1  error:nil];
-//
-//                    NSLog(@"上传失败 ===>> %@",errorObject);
-//                    if (errorObject !=nil && [errorObject isKindOfClass:[NSDictionary class]]){
-//                        NSString * result = errorObject[@"result"];
-//                        if ([result intValue] ==1){
-//                            [PopupView showCusHUDA:@"上传成功"];
-//                        }
-//                        
-//                    }
-//
-//                }
-//                
-//          }
-//            
-//    }];
-// 
-//}
-//
-////获取当前时间戳有两种方法(以秒为单位)
-//-(NSString *)getNowTimeTimestamp{
-//
-//    NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
-//
-//    [formatter setDateStyle:NSDateFormatterMediumStyle];
-//
-//    [formatter setTimeStyle:NSDateFormatterShortStyle];
-//
-//    [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
-//
-//    //设置时区,这个对于时间的处理有时很重要
-//
-//    NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
-//
-//    [formatter setTimeZone:timeZone];
-//
-//    NSDate *datenow = [NSDate date];//现在时间,你可以输出来看下是什么格式
-//
-//    NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[datenow timeIntervalSince1970]];
-//
-//    return timeSp;
-//
-//}
-//   
-//@end
-//

+ 24 - 0
RunGame/SDK/BLE/MotionCountObj.h

@@ -0,0 +1,24 @@
+//
+//  MotionCountObj.h
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/5/5.
+//
+
+#import <Foundation/Foundation.h>
+
+
+
+@interface MotionCountObj : NSObject
+
+@property(nonatomic,assign)int step;
+@property(nonatomic,assign)int crouch;
+@property(nonatomic,assign)int jump;
+@property(nonatomic,assign)int tick;
+@property(nonatomic,assign)int trample;
+@property(nonatomic,assign)int scissors;
+@property(nonatomic,assign)int rock;
+@property(nonatomic,assign)int paper;
+
+@end
+

+ 12 - 0
RunGame/SDK/BLE/MotionCountObj.m

@@ -0,0 +1,12 @@
+//
+//  MotionCountObj.m
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/5/5.
+//
+
+#import "MotionCountObj.h"
+
+@implementation MotionCountObj
+
+@end

+ 0 - 16
RunGame/SDK/BLE/ViceShoesAnalysis.h

@@ -1,16 +0,0 @@
-//
-//  ViceShoesAnalysis.h
-//  Unity-iPhone
-//
-//  Created by duowan123 on 2021/12/4.
-//
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface ViceShoesAnalysis : NSObject
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 12
RunGame/SDK/BLE/ViceShoesAnalysis.m

@@ -1,12 +0,0 @@
-//
-//  ViceShoesAnalysis.m
-//  Unity-iPhone
-//
-//  Created by duowan123 on 2021/12/4.
-//
-
-#import "ViceShoesAnalysis.h"
-
-@implementation ViceShoesAnalysis
-
-@end

+ 24 - 29
RunGame/SDK/HTTP/HTTPDataProcession.m

@@ -134,7 +134,7 @@
             result = [result stringByAppendingString:temp];
         }
     }
-    NSLog(@"result = %@",result);
+    NSLog(@"json = %@",result);
 
     return result;
     
@@ -418,44 +418,39 @@
            opponentId:(int)opponentId
      gameEndDataBlock:(GameEndDataBlock)gameEndDataBlock{
     
-    NSMutableDictionary * sportRecord = [NSMutableDictionary new];
+    NSMutableDictionary * gameRecord = [NSMutableDictionary new];
     //缓存的token、game_id
     NSString * game_id = [MYFactoryManager getGameId];
-    [sportRecord setObject:game_id forKey:@"game_id"];//游戏类型
+    [gameRecord setObject:game_id forKey:@"game_id"];//游戏类型
     //预留字段:默认
-    [sportRecord setObject:@0 forKey:@"consume"];//卡路里默认0
-    [sportRecord setObject:@0 forKey:@"screen"];//默认0
-    [sportRecord setObject:@0 forKey:@"distance"];//废弃
-    [sportRecord setObject:@0 forKey:@"is_cancel"];//是否正常停止游戏 正常0 不正常1
+    [gameRecord setObject:@0 forKey:@"distance"];//废弃
+    [gameRecord setObject:@0 forKey:@"is_cancel"];//是否正常停止游戏 正常0 不正常1
     //unity回调数据
-    [sportRecord setObject:[NSNumber numberWithInt:level] forKey:@"level"];
-    [sportRecord setObject:[NSNumber numberWithDouble:score] forKey:@"score"];
-    [sportRecord setObject:[NSNumber numberWithInt:record] forKey:@"record"];
-    [sportRecord setObject:[NSNumber numberWithInt:mode] forKey:@"mode"];
-    [sportRecord setObject:[NSNumber numberWithInt:opponentId] forKey:@"opponentId"];
+    [gameRecord setObject:[NSNumber numberWithDouble:score] forKey:@"score"];
+    [gameRecord setObject:[NSNumber numberWithInt:mode] forKey:@"mode"];
    
-   //新增加时间戳字段
+    //新增加时间戳字段
     if ( [IOS_NSUSERDEFAULT objectForKey:IOSSDK_TIMESTAMP]!=nil){
         NSString * timestamp =  [IOS_NSUSERDEFAULT objectForKey:IOSSDK_TIMESTAMP];
-        [sportRecord setObject:timestamp forKey:@"play_group"];
+        [gameRecord setObject:timestamp forKey:@"play_group"];
     }else{
-        [sportRecord setObject:[AlgorithmTool returnTimestamp] forKey:@"play_group"];
+        [gameRecord setObject:[AlgorithmTool returnTimestamp] forKey:@"play_group"];
     }
   
     //缓存的动作数据和持续时间
-    NSDictionary * acheDict = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_BLESDKDATA];
-    if (acheDict!=nil){
-        [sportRecord addEntriesFromDictionary:acheDict];
-    }else{
-        [sportRecord setObject:@0 forKey:@"jump"];
-        [sportRecord setObject:@0 forKey:@"crouch"];
-        [sportRecord setObject:@0 forKey:@"step"];
-        [sportRecord setObject:@0 forKey:@"duration"];
+    NSDictionary * movements = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_MOTIONCOUNT];
+    if (movements!=nil){
+//        [sportRecord addEntriesFromDictionary:movements];
+        NSDictionary * sub = movements[@"movements"];
+       NSData * jsonData = [NSJSONSerialization dataWithJSONObject:sub options:NSJSONWritingPrettyPrinted error:nil];
+       NSString * jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
+        [gameRecord setObject:jsonString forKey:@"movements"];
+        [gameRecord setObject:movements[@"duration"] forKey:@"duration"];
     }
     
-    NSLog(@"%@",sportRecord);
+    NSLog(@"gameRecord = %@",gameRecord);
 
-    [HTTPDataProcession postHTTPDataProcession:GAME_RECORD withParams:sportRecord  token:[MYFactoryManager getToken] success:^(id data){
+    [HTTPDataProcession postHTTPDataProcession:GAME_RECORD withParams:gameRecord  token:[MYFactoryManager getToken] success:^(id data){
         NSError * error;
         NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
 
@@ -465,18 +460,18 @@
 
             if (code==0){
                 
-                NSLog(@"GameEnd 上传成功 %@",dictionary);
+                NSLog(@"gameRecord 上传成功 %@",dictionary);
                 gameEndDataBlock(@"上传成功");
                 
-        }else{
-                NSLog(@"请求错误 =========== >>> %@",dictionary[@"msg"]);
+            }else{
+                NSLog(@"gameRecord 请求错误 =========== >>> %@",dictionary[@"msg"]);
              }
             
         }
         
     }fail:^(id errorDes){
         
-        NSLog(@"请求失败 =========== >>> %@",errorDes);
+        NSLog(@"gameRecord 请求失败 =========== >>> %@",errorDes);
 
     }];
     

+ 4 - 21
RunGame/SDK/IOSPlatformSDK.mm

@@ -7,8 +7,7 @@
 
 
 #import "IOSPlatformSDK.h"
-#import "AvoidCrash.h"
-//#import <Bugly/Bugly.h>
+#import "BugTool.h"
 
 #pragma mark ============================>> ios call unity (定义名字参数和C#类一样的方法)
 //大概流程就是先将C#的函数指针存入OC内存,在OC需要回调unity的时候就可以使用不同的指针来回调不同的unity方法
@@ -101,29 +100,14 @@ static IOSPlatformSDK * instance;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
         instance = [super init];
+        //开启蓝牙
         [BTDataProcess sharedInstance];
-//        [Bugly startWithAppId:@"36a0c05291"];
-        //防奔溃
-        [AvoidCrash makeAllEffective];
-//        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dealwithCrashMessage:) name:AvoidCrashNotification object:nil];
+        //bug监控
+        [BugTool startAvoidBug];
     });
     return instance;
 }
 
-//- (void)dealwithCrashMessage:(NSNotification *)note{
-//
-// NSDictionary *info = note.userInfo;
-//  NSString *errorReason = [NSString stringWithFormat:@"【ErrorReason】%@========【ErrorPlace】%@========【DefaultToDo】%@========【ErrorName】%@", info[@"errorReason"], info[@"errorPlace"], info[@"defaultToDo"], info[@"errorName"]];
-//  NSLog(@"errorReason = %@",errorReason);
-//  NSArray *callStack = info[@"callStackSymbols"];
-//  [self reportErrorName:@"Bugly_ErrorName_AvoidCrash" errorReason:errorReason callStack:callStack extraInfo:nil];
-//
-//}
-//
-///** 上报错误信息 */
-//- (void)reportErrorName:(NSString *)errorName errorReason:(NSString *)errorReason callStack:(NSArray *)aStackArray extraInfo:(NSDictionary *)info{
-//    [Bugly reportExceptionWithCategory:3 name:errorName reason:errorReason callStack:aStackArray extraInfo:info terminateApp:NO];
-//}
 
 #pragma mark ============================>> public method app 跳转直链
 -(void)startWithUrl:(NSURL*)url{
@@ -422,7 +406,6 @@ void InviteFriend(int friendid,char * info){
         dispatch_async(dispatch_get_main_queue(), ^{
         [PopupView showCusHUDA:jsonString];
         });
-        
     }];
 }
 

+ 16 - 0
RunGame/SDK/Tool/BugTool.h

@@ -0,0 +1,16 @@
+//
+//  BugTool.h
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/6.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface BugTool : NSObject
+
++(void)startAvoidBug;
+
+@end
+
+

+ 42 - 0
RunGame/SDK/Tool/BugTool.m

@@ -0,0 +1,42 @@
+//
+//  BugTool.m
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/6.
+//
+
+#import "BugTool.h"
+#import "AvoidCrash.h"
+//#import <Bugly/Bugly.h>
+
+@implementation BugTool
+
++(void)startAvoidBug{
+//    //bugly抓取
+//    NSString * bundleIdentifier = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
+//    if ([bundleIdentifier isEqualToString:@"com.Oujia.Run"]){
+//        [Bugly startWithAppId:@"36a0c05291"];
+//    }else if ([bundleIdentifier isEqualToString:@"com.Oujia.Dance"]){
+//        [Bugly startWithAppId:@"403d275730"];
+//    }
+    //防奔溃
+    [AvoidCrash makeAllEffective];
+//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dealwithCrashMessage:) name:AvoidCrashNotification object:nil];
+}
+
+//- (void)dealwithCrashMessage:(NSNotification *)note{
+//
+// NSDictionary *info = note.userInfo;
+//  NSString *errorReason = [NSString stringWithFormat:@"【ErrorReason】%@========【ErrorPlace】%@========【DefaultToDo】%@========【ErrorName】%@", info[@"errorReason"], info[@"errorPlace"], info[@"defaultToDo"], info[@"errorName"]];
+//  NSLog(@"errorReason = %@",errorReason);
+//  NSArray *callStack = info[@"callStackSymbols"];
+//  [self reportErrorName:@"Bugly_ErrorName_AvoidCrash" errorReason:errorReason callStack:callStack extraInfo:nil];
+//
+//}
+//
+///** 上报错误信息 */
+//- (void)reportErrorName:(NSString *)errorName errorReason:(NSString *)errorReason callStack:(NSArray *)aStackArray extraInfo:(NSDictionary *)info{
+//    [Bugly reportExceptionWithCategory:3 name:errorName reason:errorReason callStack:aStackArray extraInfo:info terminateApp:NO];
+//}
+
+@end

+ 2 - 2
RunGame/SDK/Tool/MYFactoryManager.h

@@ -62,8 +62,8 @@
 
 //app跳转 用户信息
 #define IOSSDK_USERINFO @"iosSdk_userInfo"
-//缓存的步频数据
-#define IOSSDK_BLESDKDATA @"iosSdk_bleSdk_frequency"
+//缓存的动作数据
+#define IOSSDK_MOTIONCOUNT @"iosSdk_motionCount"
 //游戏组数时间戳 参数是play_gorup
 #define IOSSDK_TIMESTAMP @"iosSdk_timestamp"
 //custom System UserDefaults

+ 4 - 3
RunGame/SDK/Tool/MYFactoryManager.m

@@ -157,8 +157,9 @@ static MYFactoryManager * instance;
 +(NSString*)getToken{
     NSDictionary * urlDict = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_USERINFO];
     NSString * token =  [urlDict objectForKey:@"token"];
+    NSLog(@"token = %@",token);
     if ([token isKindOfClass:[NSNull class]] || token == nil || [token isEqual:[NSNull null]]){
-        [PopupView showCusHUDA:@"获取token失败,请从趣动启动"];
+//        [PopupView showCusHUDA:@"获取token失败,请从趣动启动"];
         return @"";
     }else{
         return token;
@@ -171,7 +172,7 @@ static MYFactoryManager * instance;
     NSDictionary * urlDict = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_USERINFO];
     NSString * game_id =  [urlDict objectForKey:@"game_id"];
     if ([game_id isKindOfClass:[NSNull class]] || game_id == nil || [game_id isEqual:[NSNull null]]){
-         [PopupView showCusHUDA:@"获取id失败,请从趣动启动"];
+//         [PopupView showCusHUDA:@"获取id失败,请从趣动启动"];
         return @"";
     }else{
         return game_id;
@@ -183,7 +184,7 @@ static MYFactoryManager * instance;
     NSDictionary * urlDict = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_USERINFO];
     NSString * game_type =  [urlDict objectForKey:@"game_type"];
     if ([game_type isKindOfClass:[NSNull class]] || game_type == nil || [game_type isEqual:[NSNull null]]){
-         [PopupView showCusHUDA:@"获取type失败,请从趣动启动"];
+//         [PopupView showCusHUDA:@"获取type失败,请从趣动启动"];
         return @"";
     }else{
         return game_type;

+ 0 - 0
RunGame/SDK/BLE/DebugView.h → RunGame/SDK/UI/DebugView.h


+ 0 - 0
RunGame/SDK/BLE/DebugView.m → RunGame/SDK/UI/DebugView.m


+ 1 - 1
RunGame/SDK/UI/SearchDeviceViewController.m

@@ -164,7 +164,7 @@
         TXCarouselCellModel *model = [[TXCarouselCellModel alloc]init];
         model.newsId = i;
         model.peripheral = self.deviceArray[i];
-        NSLog(@"model.peripheral === >> %@",model.peripheral.name);
+//        NSLog(@"model.peripheral === >> %@",model.peripheral.name);
         [dataArr addObject:model];
     }
     [self.shoesCarouselView setArrayData:dataArr];

+ 52 - 42
RunGame/Unity-iPhone.xcodeproj/project.pbxproj

@@ -130,6 +130,9 @@
 		917C4C54AB71F090E6A5CEA8 /* Generics17.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B6C439C9D0853090FCADEB0 /* Generics17.cpp */; };
 		91984D84B3FE92002A071435 /* UnityEngine.SharedInternalsModule_CodeGen.c in Sources */ = {isa = PBXBuildFile; fileRef = 405E41C3995D0BF5696952C7 /* UnityEngine.SharedInternalsModule_CodeGen.c */; };
 		92C044C895A2F97CE833ACC2 /* QFramework.ResKit3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 508F4A078251FE52B15E1A30 /* QFramework.ResKit3.cpp */; };
+		930AE430280047DC00CB6FA2 /* MotionCount.h in Headers */ = {isa = PBXBuildFile; fileRef = 930AE42F280047DC00CB6FA2 /* MotionCount.h */; };
+		930AE432280047E600CB6FA2 /* MotionCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930AE431280047E600CB6FA2 /* MotionCount.cpp */; };
+		930AE433280047E600CB6FA2 /* MotionCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930AE431280047E600CB6FA2 /* MotionCount.cpp */; };
 		932DE0DD27A14E9500664CBC /* BTDataAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = 932DE0DB27A14E9500664CBC /* BTDataAnalysis.h */; };
 		932DE0DE27A14E9500664CBC /* BTDataAnalysis.mm in Sources */ = {isa = PBXBuildFile; fileRef = 932DE0DC27A14E9500664CBC /* BTDataAnalysis.mm */; };
 		932DE0DF27A14E9500664CBC /* BTDataAnalysis.mm in Sources */ = {isa = PBXBuildFile; fileRef = 932DE0DC27A14E9500664CBC /* BTDataAnalysis.mm */; };
@@ -139,6 +142,12 @@
 		9354475A27F305310055C921 /* StepVel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9354475927F305300055C921 /* StepVel.h */; };
 		9354475C27F3053C0055C921 /* StepVel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9354475B27F3053B0055C921 /* StepVel.cpp */; };
 		9354475D27F3053C0055C921 /* StepVel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9354475B27F3053B0055C921 /* StepVel.cpp */; };
+		9364CF5B28236E9500E63D51 /* MotionCountObj.h in Headers */ = {isa = PBXBuildFile; fileRef = 9364CF5928236E9500E63D51 /* MotionCountObj.h */; };
+		9364CF5C28236E9500E63D51 /* MotionCountObj.m in Sources */ = {isa = PBXBuildFile; fileRef = 9364CF5A28236E9500E63D51 /* MotionCountObj.m */; };
+		9364CF5D28236E9500E63D51 /* MotionCountObj.m in Sources */ = {isa = PBXBuildFile; fileRef = 9364CF5A28236E9500E63D51 /* MotionCountObj.m */; };
+		937F5BBD27FD2F030071BC44 /* BugTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5BBB27FD2F030071BC44 /* BugTool.m */; };
+		937F5BBE27FD2F030071BC44 /* BugTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 937F5BBB27FD2F030071BC44 /* BugTool.m */; };
+		937F5BBF27FD2F030071BC44 /* BugTool.h in Headers */ = {isa = PBXBuildFile; fileRef = 937F5BBC27FD2F030071BC44 /* BugTool.h */; };
 		939230C227DF38BF0061812D /* RunGame.h in Headers */ = {isa = PBXBuildFile; fileRef = 939230AA27DF38BF0061812D /* RunGame.h */; };
 		939230C327DF38BF0061812D /* Tricycle.h in Headers */ = {isa = PBXBuildFile; fileRef = 939230AB27DF38BF0061812D /* Tricycle.h */; };
 		939230C427DF38BF0061812D /* H5_Game.h in Headers */ = {isa = PBXBuildFile; fileRef = 939230AC27DF38BF0061812D /* H5_Game.h */; };
@@ -255,20 +264,14 @@
 		93D3D14427797662006D26A0 /* BTDataSend.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D09A27797662006D26A0 /* BTDataSend.m */; };
 		93D3D14527797662006D26A0 /* BTDataSend.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D09A27797662006D26A0 /* BTDataSend.m */; };
 		93D3D14627797662006D26A0 /* BTDataProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D3D09B27797662006D26A0 /* BTDataProcess.h */; };
-		93D3D14727797662006D26A0 /* ViceShoesAnalysis.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D09C27797662006D26A0 /* ViceShoesAnalysis.m */; };
-		93D3D14827797662006D26A0 /* ViceShoesAnalysis.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D09C27797662006D26A0 /* ViceShoesAnalysis.m */; };
 		93D3D14927797662006D26A0 /* DebugView.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D09D27797662006D26A0 /* DebugView.m */; };
 		93D3D14A27797662006D26A0 /* DebugView.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D09D27797662006D26A0 /* DebugView.m */; };
 		93D3D14B27797662006D26A0 /* BTDataProcess.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D09E27797662006D26A0 /* BTDataProcess.mm */; };
 		93D3D14C27797662006D26A0 /* BTDataProcess.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D09E27797662006D26A0 /* BTDataProcess.mm */; };
-		93D3D14D27797662006D26A0 /* MainShoesAnalysis.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D09F27797662006D26A0 /* MainShoesAnalysis.mm */; };
-		93D3D14E27797662006D26A0 /* MainShoesAnalysis.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D09F27797662006D26A0 /* MainShoesAnalysis.mm */; };
 		93D3D14F27797662006D26A0 /* BTDataSend.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D3D0A027797662006D26A0 /* BTDataSend.h */; };
 		93D3D15027797662006D26A0 /* LEONBLManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D0A127797662006D26A0 /* LEONBLManager.m */; };
 		93D3D15127797662006D26A0 /* LEONBLManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D0A127797662006D26A0 /* LEONBLManager.m */; };
 		93D3D15227797662006D26A0 /* CBPeripheral+ADName.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D3D0A227797662006D26A0 /* CBPeripheral+ADName.h */; };
-		93D3D15327797662006D26A0 /* ViceShoesAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D3D0A327797662006D26A0 /* ViceShoesAnalysis.h */; };
-		93D3D15427797662006D26A0 /* MainShoesAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D3D0A427797662006D26A0 /* MainShoesAnalysis.h */; };
 		93D3D15527797662006D26A0 /* DebugView.h in Headers */ = {isa = PBXBuildFile; fileRef = 93D3D0A527797662006D26A0 /* DebugView.h */; };
 		93D3D15727797662006D26A0 /* UserFriendsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D0A827797662006D26A0 /* UserFriendsModel.m */; };
 		93D3D15827797662006D26A0 /* UserFriendsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D3D0A827797662006D26A0 /* UserFriendsModel.m */; };
@@ -669,7 +672,7 @@
 		1859EA9A19214E7B0022C3D3 /* MetalHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MetalHelper.mm; sourceTree = "<group>"; };
 		1C744F5990D1EF722F4FB570 /* Assembly-CSharp4.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "Assembly-CSharp4.cpp"; path = "Classes/Native/Assembly-CSharp4.cpp"; sourceTree = SOURCE_ROOT; };
 		1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
-		1D6058910D05DD3D006BFB54 /* Unity-Target-New.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; name = "Unity-Target-New.app"; path = petsurfer.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		1D6058910D05DD3D006BFB54 /* run.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = run.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		210B4FF8980C22E2C995EEE7 /* QFramework.UIKit.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = QFramework.UIKit.cpp; path = Classes/Native/QFramework.UIKit.cpp; sourceTree = SOURCE_ROOT; };
 		21D3444582E919689B1FBA8B /* UnityEngine.CoreModule_CodeGen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = UnityEngine.CoreModule_CodeGen.c; path = Classes/Native/UnityEngine.CoreModule_CodeGen.c; sourceTree = SOURCE_ROOT; };
 		229A4B3181C0F4809B5E77EF /* UnityEngine.UI.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnityEngine.UI.cpp; path = Classes/Native/UnityEngine.UI.cpp; sourceTree = SOURCE_ROOT; };
@@ -874,12 +877,18 @@
 		8FAC4824BEDA6D652D6E2001 /* UnityEngine.IMGUIModule_CodeGen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = UnityEngine.IMGUIModule_CodeGen.c; path = Classes/Native/UnityEngine.IMGUIModule_CodeGen.c; sourceTree = SOURCE_ROOT; };
 		914642A9ACEDBBFC7BE9E1A3 /* Il2CppMetadataRegistration.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = Il2CppMetadataRegistration.c; path = Classes/Native/Il2CppMetadataRegistration.c; sourceTree = SOURCE_ROOT; };
 		92584C48A14965A935847383 /* Assembly-CSharp8.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "Assembly-CSharp8.cpp"; path = "Classes/Native/Assembly-CSharp8.cpp"; sourceTree = SOURCE_ROOT; };
+		930AE42F280047DC00CB6FA2 /* MotionCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MotionCount.h; sourceTree = "<group>"; };
+		930AE431280047E600CB6FA2 /* MotionCount.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MotionCount.cpp; sourceTree = "<group>"; };
 		932DE0DB27A14E9500664CBC /* BTDataAnalysis.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BTDataAnalysis.h; sourceTree = "<group>"; };
 		932DE0DC27A14E9500664CBC /* BTDataAnalysis.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = BTDataAnalysis.mm; sourceTree = "<group>"; };
 		9354475027F1C4F70055C921 /* Kongfu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Kongfu.h; sourceTree = "<group>"; };
 		9354475227F1C5010055C921 /* Kongfu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Kongfu.cpp; sourceTree = "<group>"; };
 		9354475927F305300055C921 /* StepVel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StepVel.h; sourceTree = "<group>"; };
 		9354475B27F3053B0055C921 /* StepVel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StepVel.cpp; sourceTree = "<group>"; };
+		9364CF5928236E9500E63D51 /* MotionCountObj.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MotionCountObj.h; sourceTree = "<group>"; };
+		9364CF5A28236E9500E63D51 /* MotionCountObj.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MotionCountObj.m; sourceTree = "<group>"; };
+		937F5BBB27FD2F030071BC44 /* BugTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BugTool.m; sourceTree = "<group>"; };
+		937F5BBC27FD2F030071BC44 /* BugTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BugTool.h; sourceTree = "<group>"; };
 		939230AA27DF38BF0061812D /* RunGame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunGame.h; sourceTree = "<group>"; };
 		939230AB27DF38BF0061812D /* Tricycle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tricycle.h; sourceTree = "<group>"; };
 		939230AC27DF38BF0061812D /* H5_Game.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = H5_Game.h; sourceTree = "<group>"; };
@@ -958,15 +967,11 @@
 		93D3D09927797662006D26A0 /* LEONBLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LEONBLManager.h; sourceTree = "<group>"; };
 		93D3D09A27797662006D26A0 /* BTDataSend.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BTDataSend.m; sourceTree = "<group>"; };
 		93D3D09B27797662006D26A0 /* BTDataProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BTDataProcess.h; sourceTree = "<group>"; };
-		93D3D09C27797662006D26A0 /* ViceShoesAnalysis.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViceShoesAnalysis.m; sourceTree = "<group>"; };
 		93D3D09D27797662006D26A0 /* DebugView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugView.m; sourceTree = "<group>"; };
 		93D3D09E27797662006D26A0 /* BTDataProcess.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BTDataProcess.mm; sourceTree = "<group>"; };
-		93D3D09F27797662006D26A0 /* MainShoesAnalysis.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MainShoesAnalysis.mm; sourceTree = "<group>"; };
 		93D3D0A027797662006D26A0 /* BTDataSend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BTDataSend.h; sourceTree = "<group>"; };
 		93D3D0A127797662006D26A0 /* LEONBLManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LEONBLManager.m; sourceTree = "<group>"; };
 		93D3D0A227797662006D26A0 /* CBPeripheral+ADName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CBPeripheral+ADName.h"; sourceTree = "<group>"; };
-		93D3D0A327797662006D26A0 /* ViceShoesAnalysis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViceShoesAnalysis.h; sourceTree = "<group>"; };
-		93D3D0A427797662006D26A0 /* MainShoesAnalysis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainShoesAnalysis.h; sourceTree = "<group>"; };
 		93D3D0A527797662006D26A0 /* DebugView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugView.h; sourceTree = "<group>"; };
 		93D3D0A827797662006D26A0 /* UserFriendsModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserFriendsModel.m; sourceTree = "<group>"; };
 		93D3D0A927797662006D26A0 /* UserFriendsModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserFriendsModel.h; sourceTree = "<group>"; };
@@ -1451,7 +1456,7 @@
 		19C28FACFE9D520D11CA2CBB /* Products */ = {
 			isa = PBXGroup;
 			children = (
-				1D6058910D05DD3D006BFB54 /* Unity-Target-New.app */,
+				1D6058910D05DD3D006BFB54 /* run.app */,
 				5623C57317FDCB0800090B9E /* Unity-iPhone Tests.xctest */,
 				9D25AB9D213FB47800354C27 /* UnityFramework.framework */,
 			);
@@ -1640,6 +1645,7 @@
 				939230AA27DF38BF0061812D /* RunGame.h */,
 				939230AB27DF38BF0061812D /* Tricycle.h */,
 				939230AC27DF38BF0061812D /* H5_Game.h */,
+				930AE42F280047DC00CB6FA2 /* MotionCount.h */,
 				939230AD27DF38BF0061812D /* DanceGame.h */,
 				939230AE27DF38BF0061812D /* Interaction.h */,
 				939230AF27DF38BF0061812D /* pub.h */,
@@ -1662,6 +1668,7 @@
 				939230B827DF38BF0061812D /* FootStep.cpp */,
 				939230B927DF38BF0061812D /* TestGame.cpp */,
 				939230BA27DF38BF0061812D /* Interaction.cpp */,
+				930AE431280047E600CB6FA2 /* MotionCount.cpp */,
 				939230BB27DF38BF0061812D /* H5_Game.cpp */,
 				939230BC27DF38BF0061812D /* Tricycle.cpp */,
 				939230BD27DF38BF0061812D /* Aerobics.cpp */,
@@ -1751,6 +1758,8 @@
 		93D3D07C27797662006D26A0 /* UI */ = {
 			isa = PBXGroup;
 			children = (
+				93D3D0A527797662006D26A0 /* DebugView.h */,
+				93D3D09D27797662006D26A0 /* DebugView.m */,
 				93D3D09327797662006D26A0 /* AnimationVIew */,
 				93D3D07D27797662006D26A0 /* CarouselView */,
 				93D3D09027797662006D26A0 /* NoDeviceTip */,
@@ -1814,20 +1823,16 @@
 			children = (
 				93D3D09B27797662006D26A0 /* BTDataProcess.h */,
 				93D3D09E27797662006D26A0 /* BTDataProcess.mm */,
+				9364CF5928236E9500E63D51 /* MotionCountObj.h */,
+				9364CF5A28236E9500E63D51 /* MotionCountObj.m */,
 				932DE0DB27A14E9500664CBC /* BTDataAnalysis.h */,
 				932DE0DC27A14E9500664CBC /* BTDataAnalysis.mm */,
 				93D3D0A027797662006D26A0 /* BTDataSend.h */,
 				93D3D09A27797662006D26A0 /* BTDataSend.m */,
 				93D3D0A227797662006D26A0 /* CBPeripheral+ADName.h */,
 				93D3D09827797662006D26A0 /* CBPeripheral+ADName.m */,
-				93D3D0A527797662006D26A0 /* DebugView.h */,
-				93D3D09D27797662006D26A0 /* DebugView.m */,
 				93D3D09927797662006D26A0 /* LEONBLManager.h */,
 				93D3D0A127797662006D26A0 /* LEONBLManager.m */,
-				93D3D0A427797662006D26A0 /* MainShoesAnalysis.h */,
-				93D3D09F27797662006D26A0 /* MainShoesAnalysis.mm */,
-				93D3D0A327797662006D26A0 /* ViceShoesAnalysis.h */,
-				93D3D09C27797662006D26A0 /* ViceShoesAnalysis.m */,
 			);
 			path = BLE;
 			sourceTree = "<group>";
@@ -1864,8 +1869,8 @@
 			isa = PBXGroup;
 			children = (
 				93BB2794278585480019B85C /* socket */,
-				93D3D0B227797662006D26A0 /* HTTPDataProcession.m */,
 				93D3D0B327797662006D26A0 /* HTTPDataProcession.h */,
+				93D3D0B227797662006D26A0 /* HTTPDataProcession.m */,
 				93D3D0B427797662006D26A0 /* AFNetworking */,
 			);
 			path = HTTP;
@@ -1957,6 +1962,8 @@
 		93D3D11427797662006D26A0 /* Tool */ = {
 			isa = PBXGroup;
 			children = (
+				937F5BBC27FD2F030071BC44 /* BugTool.h */,
+				937F5BBB27FD2F030071BC44 /* BugTool.m */,
 				93D3D11B27797662006D26A0 /* AlgorithmTool.h */,
 				93D3D11627797662006D26A0 /* AlgorithmTool.m */,
 				93D3D11527797662006D26A0 /* GameObjc.h */,
@@ -2059,6 +2066,7 @@
 				9354475A27F305310055C921 /* StepVel.h in Headers */,
 				93D3D14627797662006D26A0 /* BTDataProcess.h in Headers */,
 				939230C227DF38BF0061812D /* RunGame.h in Headers */,
+				937F5BBF27FD2F030071BC44 /* BugTool.h in Headers */,
 				93BB27AD2785978B0019B85C /* SocketRocketUtility.h in Headers */,
 				93B58DC527A298A5003BB1C2 /* NSObject+AvoidCrash.h in Headers */,
 				93D3D12A27797662006D26A0 /* TXCarouselView.h in Headers */,
@@ -2075,11 +2083,12 @@
 				939230C327DF38BF0061812D /* Tricycle.h in Headers */,
 				93D3D15527797662006D26A0 /* DebugView.h in Headers */,
 				93D3D20C27797663006D26A0 /* AlgorithmTool.h in Headers */,
-				93D3D15427797662006D26A0 /* MainShoesAnalysis.h in Headers */,
+				9364CF5B28236E9500E63D51 /* MotionCountObj.h in Headers */,
 				93D3D14F27797662006D26A0 /* BTDataSend.h in Headers */,
 				9DC67E8521CBBEBB005F9FA1 /* UnityAppController.h in Headers */,
 				93D3D16427797662006D26A0 /* AFSecurityPolicy.h in Headers */,
 				93BB27A8278597830019B85C /* SRWebSocket.h in Headers */,
+				930AE430280047DC00CB6FA2 /* MotionCount.h in Headers */,
 				93D3D17127797663006D26A0 /* AFNetworking.h in Headers */,
 				939230C427DF38BF0061812D /* H5_Game.h in Headers */,
 				93D3D17627797663006D26A0 /* AFCompatibilityMacros.h in Headers */,
@@ -2110,7 +2119,6 @@
 				93D3D16C27797662006D26A0 /* AFURLResponseSerialization.h in Headers */,
 				93D3D12F27797662006D26A0 /* ShoesCollectionCell.h in Headers */,
 				939230CC27DF38BF0061812D /* TestGame.h in Headers */,
-				93D3D15327797662006D26A0 /* ViceShoesAnalysis.h in Headers */,
 				93D3D15227797662006D26A0 /* CBPeripheral+ADName.h in Headers */,
 				93D3D17727797663006D26A0 /* AFHTTPSessionManager.h in Headers */,
 				939230C827DF38BF0061812D /* FingerGuessing.h in Headers */,
@@ -2140,7 +2148,7 @@
 			);
 			name = "Unity-iPhone";
 			productName = "iPhone-target";
-			productReference = 1D6058910D05DD3D006BFB54 /* Unity-Target-New.app */;
+			productReference = 1D6058910D05DD3D006BFB54 /* run.app */;
 			productType = "com.apple.product-type.application";
 		};
 		5623C57217FDCB0800090B9E /* Unity-iPhone Tests */ = {
@@ -2386,6 +2394,7 @@
 				93D3D15F27797662006D26A0 /* IOSPlatformSDK.mm in Sources */,
 				939230DA27DF38BF0061812D /* Aerobics.cpp in Sources */,
 				93D3D13327797662006D26A0 /* TXCarouselView.m in Sources */,
+				930AE432280047E600CB6FA2 /* MotionCount.cpp in Sources */,
 				9354475C27F3053C0055C921 /* StepVel.cpp in Sources */,
 				93D3D13B27797662006D26A0 /* NoDeviceTip.m in Sources */,
 				9354475327F1C5010055C921 /* Kongfu.cpp in Sources */,
@@ -2406,7 +2415,6 @@
 				93B58DB027A298A5003BB1C2 /* NSMutableDictionary+AvoidCrash.m in Sources */,
 				932DE0DE27A14E9500664CBC /* BTDataAnalysis.mm in Sources */,
 				93D3D20F27797663006D26A0 /* MYFactoryManager.m in Sources */,
-				93D3D14D27797662006D26A0 /* MainShoesAnalysis.mm in Sources */,
 				93BB27A6278597830019B85C /* SRWebSocket.m in Sources */,
 				93D3D14B27797662006D26A0 /* BTDataProcess.mm in Sources */,
 				93B58DA727A298A5003BB1C2 /* NSArray+AvoidCrash.m in Sources */,
@@ -2419,9 +2427,10 @@
 				93D3D13527797662006D26A0 /* PopupView.m in Sources */,
 				93D3D16A27797662006D26A0 /* AFHTTPSessionManager.m in Sources */,
 				93D3D12D27797662006D26A0 /* TXCarouselViewLayout.m in Sources */,
-				93D3D14727797662006D26A0 /* ViceShoesAnalysis.m in Sources */,
 				93D3D20527797663006D26A0 /* AlgorithmTool.m in Sources */,
+				9364CF5C28236E9500E63D51 /* MotionCountObj.m in Sources */,
 				93D3D21127797663006D26A0 /* UIView+ST.m in Sources */,
+				937F5BBD27FD2F030071BC44 /* BugTool.m in Sources */,
 				93B58DBB27A298A5003BB1C2 /* NSAttributedString+AvoidCrash.m in Sources */,
 				93D3D17227797663006D26A0 /* AFNetworkReachabilityManager.m in Sources */,
 				939230D627DF38BF0061812D /* H5_Game.cpp in Sources */,
@@ -2540,7 +2549,6 @@
 				28834DFAB23888569E05B5F2 /* Generics10.cpp in Sources */,
 				EB9B4345A7F3FC555EA754A5 /* Generics11.cpp in Sources */,
 				93D3D13F27797662006D26A0 /* AnimationView.m in Sources */,
-				93D3D14827797662006D26A0 /* ViceShoesAnalysis.m in Sources */,
 				CE27444F99CC9834B9674C2C /* Generics12.cpp in Sources */,
 				FD504BBDB8B2893A67BAB751 /* Generics13.cpp in Sources */,
 				8B364B76A109874B92DBB212 /* Generics14.cpp in Sources */,
@@ -2654,7 +2662,6 @@
 				93B58DBA27A298A5003BB1C2 /* NSMutableAttributedString+AvoidCrash.m in Sources */,
 				93D3D20E27797663006D26A0 /* GameObjc.mm in Sources */,
 				939230D727DF38BF0061812D /* H5_Game.cpp in Sources */,
-				93D3D14E27797662006D26A0 /* MainShoesAnalysis.mm in Sources */,
 				63874FF894D46F7E0EC018D1 /* QFramework.Log_CodeGen.c in Sources */,
 				E943401C8805FA94C4D8DF1B /* QFramework.Pool.cpp in Sources */,
 				F5C847BE9954BAC633CA2588 /* QFramework.Pool_CodeGen.c in Sources */,
@@ -2696,6 +2703,7 @@
 				AC8C4D988C1EC33C2D824BF7 /* System.Xml_CodeGen.c in Sources */,
 				9C3B4143BFDE95D54DCC3147 /* System1.cpp in Sources */,
 				DC6C4F2A9B90584428EC5432 /* System2.cpp in Sources */,
+				937F5BBE27FD2F030071BC44 /* BugTool.m in Sources */,
 				D7CC4B5CB91772C09E5A25FF /* System3.cpp in Sources */,
 				93D3D17027797663006D26A0 /* AFURLRequestSerialization.m in Sources */,
 				77824302ADD4DE2F0F8CC8DF /* System4.cpp in Sources */,
@@ -2732,6 +2740,7 @@
 				723045B9B3373A7FBB934392 /* UnityEngine.IMGUIModule_CodeGen.c in Sources */,
 				069C4F8EBD0BED1E895B574C /* UnityEngine.InputLegacyModule.cpp in Sources */,
 				2974481ABAADB14301525952 /* UnityEngine.InputLegacyModule_CodeGen.c in Sources */,
+				930AE433280047E600CB6FA2 /* MotionCount.cpp in Sources */,
 				D6714B91A1F7D89A7C6AE374 /* UnityEngine.JSONSerializeModule.cpp in Sources */,
 				6FFD49C281460AD78FD8FC8C /* UnityEngine.JSONSerializeModule_CodeGen.c in Sources */,
 				BB9A4B3FAF5DB1EFC26E71B3 /* UnityEngine.ParticleSystemModule.cpp in Sources */,
@@ -2771,6 +2780,7 @@
 				0EC947FEA3A266DA874F186D /* UnityEngine_CodeGen.c in Sources */,
 				E03A4DEA9C0B41D039DFF210 /* UnityICallRegistration.cpp in Sources */,
 				517847F18EDB961F67E23E82 /* UnresolvedVirtualCallStubs.cpp in Sources */,
+				9364CF5D28236E9500E63D51 /* MotionCountObj.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2819,7 +2829,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 1.0.0;
+				CURRENT_PROJECT_VERSION = 10014;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2836,7 +2846,7 @@
 				IPHONEOS_DEPLOYMENT_TARGET = 10.0;
 				LD_GENERATE_MAP_FILE = YES;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 1.0.2;
+				MARKETING_VERSION = 1.1.0;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = (
 					"$(inherited)",
@@ -2847,13 +2857,13 @@
 					"$(OTHER_CFLAGS)",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.Oujia.Run;
-				PRODUCT_NAME = "$(PRODUCT_NAME_APP)";
+				PRODUCT_NAME = run;
 				PROVISIONING_PROFILE = "$(PROVISIONING_PROFILE_APP)";
 				PROVISIONING_PROFILE_APP = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SDKROOT = iphoneos;
 				SUPPORTED_PLATFORMS = iphoneos;
-				TARGETED_DEVICE_FAMILY = 1;
+				TARGETED_DEVICE_FAMILY = "1,2";
 				UNITY_RUNTIME_VERSION = 2019.3.7f1;
 				UNITY_SCRIPTING_BACKEND = il2cpp;
 			};
@@ -2878,7 +2888,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 1.0.0;
+				CURRENT_PROJECT_VERSION = 10014;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2892,7 +2902,7 @@
 				IPHONEOS_DEPLOYMENT_TARGET = 10.0;
 				LD_GENERATE_MAP_FILE = YES;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 1.0.2;
+				MARKETING_VERSION = 1.1.0;
 				ONLY_ACTIVE_ARCH = NO;
 				OTHER_CFLAGS = (
 					"$(inherited)",
@@ -2903,13 +2913,13 @@
 					"$(OTHER_CFLAGS)",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.Oujia.Run;
-				PRODUCT_NAME = "$(PRODUCT_NAME_APP)";
+				PRODUCT_NAME = run;
 				PROVISIONING_PROFILE = "$(PROVISIONING_PROFILE_APP)";
 				PROVISIONING_PROFILE_APP = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SDKROOT = iphoneos;
 				SUPPORTED_PLATFORMS = iphoneos;
-				TARGETED_DEVICE_FAMILY = 1;
+				TARGETED_DEVICE_FAMILY = "1,2";
 				UNITY_RUNTIME_VERSION = 2019.3.7f1;
 				UNITY_SCRIPTING_BACKEND = il2cpp;
 			};
@@ -3058,7 +3068,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 1.0.0;
+				CURRENT_PROJECT_VERSION = 10014;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -3073,7 +3083,7 @@
 				IPHONEOS_DEPLOYMENT_TARGET = 10.0;
 				LD_GENERATE_MAP_FILE = YES;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 1.0.2;
+				MARKETING_VERSION = 1.1.0;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = (
 					"$(inherited)",
@@ -3084,13 +3094,13 @@
 					"$(OTHER_CFLAGS)",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.Oujia.Run;
-				PRODUCT_NAME = "$(PRODUCT_NAME_APP)";
+				PRODUCT_NAME = run;
 				PROVISIONING_PROFILE = "$(PROVISIONING_PROFILE_APP)";
 				PROVISIONING_PROFILE_APP = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SDKROOT = iphoneos;
 				SUPPORTED_PLATFORMS = iphoneos;
-				TARGETED_DEVICE_FAMILY = 1;
+				TARGETED_DEVICE_FAMILY = "1,2";
 				UNITY_RUNTIME_VERSION = 2019.3.7f1;
 				UNITY_SCRIPTING_BACKEND = il2cpp;
 			};
@@ -3184,7 +3194,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 1.0.0;
+				CURRENT_PROJECT_VERSION = 10014;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -3198,7 +3208,7 @@
 				IPHONEOS_DEPLOYMENT_TARGET = 10.0;
 				LD_GENERATE_MAP_FILE = YES;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 1.0.2;
+				MARKETING_VERSION = 1.1.0;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = (
 					"$(inherited)",
@@ -3209,13 +3219,13 @@
 					"$(OTHER_CFLAGS)",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.Oujia.Run;
-				PRODUCT_NAME = "$(PRODUCT_NAME_APP)";
+				PRODUCT_NAME = run;
 				PROVISIONING_PROFILE = "$(PROVISIONING_PROFILE_APP)";
 				PROVISIONING_PROFILE_APP = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SDKROOT = iphoneos;
 				SUPPORTED_PLATFORMS = iphoneos;
-				TARGETED_DEVICE_FAMILY = 1;
+				TARGETED_DEVICE_FAMILY = "1,2";
 				UNITY_RUNTIME_VERSION = 2019.3.7f1;
 				UNITY_SCRIPTING_BACKEND = il2cpp;
 			};

BIN
RunGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcuserdata/duowan123.xcuserdatad/UserInterfaceState.xcuserstate


+ 4 - 4
RunGame/Unity-iPhone.xcodeproj/xcshareddata/xcschemes/Unity-iPhone.xcscheme

@@ -15,7 +15,7 @@
             <BuildableReference
                BuildableIdentifier = "primary"
                BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
-               BuildableName = "petsurfer.app"
+               BuildableName = "run.app"
                BlueprintName = "Unity-iPhone"
                ReferencedContainer = "container:Unity-iPhone.xcodeproj">
             </BuildableReference>
@@ -31,7 +31,7 @@
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
-            BuildableName = "petsurfer.app"
+            BuildableName = "run.app"
             BlueprintName = "Unity-iPhone"
             ReferencedContainer = "container:Unity-iPhone.xcodeproj">
          </BuildableReference>
@@ -73,7 +73,7 @@
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
-            BuildableName = "petsurfer.app"
+            BuildableName = "run.app"
             BlueprintName = "Unity-iPhone"
             ReferencedContainer = "container:Unity-iPhone.xcodeproj">
          </BuildableReference>
@@ -90,7 +90,7 @@
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
-            BuildableName = "petsurfer.app"
+            BuildableName = "run.app"
             BlueprintName = "Unity-iPhone"
             ReferencedContainer = "container:Unity-iPhone.xcodeproj">
          </BuildableReference>

+ 14 - 0
RunGame/Unity-iPhone.xcodeproj/xcuserdata/duowan123.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -3,4 +3,18 @@
    uuid = "374FE224-E446-4897-B0F5-E9A59BA9543B"
    type = "1"
    version = "2.0">
+   <Breakpoints>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
+         <BreakpointContent
+            uuid = "9E485834-32DE-4121-A5ED-FECE74406BDA"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            breakpointStackSelectionBehavior = "1"
+            scope = "1"
+            stopOnStyle = "0">
+         </BreakpointContent>
+      </BreakpointProxy>
+   </Breakpoints>
 </Bucket>