iOS AILinkBleSDK - 蓝牙SDK
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ELCM02_BleManager.h 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. //
  2. // ELCM02_BleManager.h
  3. // AILinkBleSDK
  4. //
  5. // Created by cliCk on 2021/9/13.
  6. // Copyright © 2021 IOT. All rights reserved.
  7. //
  8. #import "ELBluetoothManager.h"
  9. #import "ELCM02_HeartbeatBleModel.h"
  10. #import "ELCM02_BatteryBleModel.h"
  11. #import "ELCM02_BleSupportFunctionModel.h"
  12. #import "ELCM02_BleHeader.h"
  13. NS_ASSUME_NONNULL_BEGIN
  14. @protocol CM02_BleDelegate <NSObject>
  15. @optional
  16. - (void)CM02ManagerUpdateState:(enum ELBluetoothState)state;
  17. - (void)CM02ManagerScanDevices:(NSArray<ELPeripheralModel *> *_Nullable)CM02Devices;
  18. /** 返回设备支持的功能 */
  19. - (void)CM02ManagerBackSupportFunctionModel:(ELCM02_BleSupportFunctionModel *)model;
  20. /** CM02返回设备心跳数据 */
  21. - (void)CM02ManagerBackHeartbeatModel:(ELCM02_HeartbeatBleModel *)model;
  22. /** CM02回复修改密码结果 */
  23. - (void)CM02ManagerBackUpdatePasswordResult:(enum CM02_Result_Type)result;
  24. /** CM02回复解锁和开锁状态 */
  25. - (void)CM02ManagerBackLockState:(enum CM02_LockState_Type)lock passwordResult:(enum CM02_PasswordCorrect_Type)result;
  26. /** CM02回复售后密码 */
  27. - (void)CM02ManagerBackAfterSalesPassword:(NSString *)afterSalesPassword;
  28. /** CM02回复单次行程和对应时间 */
  29. - (void)CM02ManagerBackSingleMileage:(float)kmMileage time:(NSInteger)second;
  30. /** CM02回复总里程信息 */
  31. - (void)CM02ManagerBackTotalMileage:(float)kmMileage;
  32. /** CM02回复电池信息 */
  33. - (void)CM02ManagerBackBatteryBleModel:(ELCM02_BatteryBleModel *)model;
  34. /** CM02回复控制器编号,硬件版本号和软件版本号 */
  35. - (void)CM02ManagerBackControlCode:(NSString *)code hardwareVersion:(NSString *)hardwareVersion softwareVersion:(NSString *)softwareVersion;
  36. /** CM02回复仪表编号,硬件版本和软件版本号 */
  37. - (void)CM02ManagerBackDashboardCode:(NSString *)code hardwareVersion:(NSString *)hardwareVersion softwareVersion:(NSString *)softwareVersion;
  38. #pragma mark - 仪表OTA
  39. /** 返回ota是否可以升级和可以接收的最大长度 */
  40. - (void)CM02ManagerBackCanOTA:(BOOL)can maxLength:(int)length;
  41. /** 返回ota升级数据结果以及接受到的数据包编号 */
  42. - (void)CM02ManagerBackOTASendResult:(BOOL)canSendNext index:(long long)index;
  43. /** 返回ota升级结果 */
  44. - (void)CM02ManagerBackOTAUpdateResult:(BOOL)result;
  45. #pragma mark -
  46. @end
  47. @interface ELCM02_BleManager : ELBluetoothManager
  48. @property (nonatomic, weak) id<CM02_BleDelegate> CM02Delegate;
  49. + (ELCM02_BleManager *)shareManager;
  50. ///** 查询接收端类型及支持的功能 */
  51. - (void)getDeviceBaseInformation;
  52. /** 切换单位 */
  53. - (void)changeUnit:(enum CM02_Unit_Type)unit;
  54. /** 定速巡航开关 */
  55. - (void)setCruiseSwitch:(BOOL)state;
  56. /** 是否为非零速度启动 */
  57. - (void)setSpeedStart:(BOOL)state;
  58. /** 恢复出厂设置 */
  59. - (void)resetDevice;
  60. /** 清除除里程和时间外的其它控制器及仪表参数 */
  61. - (void)clearOtherCacheData;
  62. /** 清除总里程 */
  63. - (void)clearTotalMileage;
  64. /** 清除单次里程时间(设备一开机就会记录骑行时间和里程,当需要记录这些时间和里程的时候需要清除一下当次时间,重新开始记录) */
  65. - (void)clearSingleTime;
  66. /** 设置档位(1-7) */
  67. - (void)setGear:(NSInteger)gear;
  68. /** 开关灯 */
  69. - (void)setLightState:(BOOL)state;
  70. /** 修改密码 */
  71. - (void)updatePasswordWithOldPassword:(NSString *)oldPassword newPassword:(NSString *)newPassword;
  72. /** 解锁或者锁车(锁车无需传密码) */
  73. - (void)setLockState:(enum CM02_LockState_Type)lock password:(NSString *)password;
  74. /** 查询售后密码 */
  75. - (void)getAfterSalesPassword;
  76. /** 查询单次行驶里程和时间 */
  77. - (void)getNowSingleMileageInformation;
  78. /** 查询总里程 */
  79. - (void)getTotalMileageInformation;
  80. /** 查询电池信息 */
  81. - (void)getBatteryInformation;
  82. /** 查询控制器厂商代码及编号 */
  83. - (void)getControlVersion;
  84. /** 查询仪表盘固件版本 */
  85. - (void)getDashboardVersion;
  86. #pragma mark - 仪表OTA
  87. /** 发送OTA开始指令
  88. * @param size : ota文件长度
  89. * @param data : crc32校验码,4个byte
  90. * @param length : 单次发送OTA数据包最大的长度
  91. */
  92. - (void)sendStartOTAWithFileSize:(long long)size crc32Data:(NSData *)data maxPacketLength:(int)length;
  93. /** 发送OTA数据 */
  94. - (void)sendOTAUpdateFileWithIndex:(long long)index data:(NSData *)data;
  95. /** 发送OTA完成指令 */
  96. - (void)sendEndOTACommand;
  97. #pragma mark - 断开设备清除缓存信息
  98. - (void)cleanData;
  99. @end
  100. NS_ASSUME_NONNULL_END