iOS AILinkBleSDK - 蓝牙SDK
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

ELCM02_BleManager.h 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. @property (nonatomic, assign) ELSupportDeviceType deviceType;
  50. + (ELCM02_BleManager *)shareManager;
  51. ///** 查询接收端类型及支持的功能 */
  52. - (void)getDeviceBaseInformation;
  53. /** 切换单位 */
  54. - (void)changeUnit:(enum CM02_Unit_Type)unit;
  55. /** 定速巡航开关 */
  56. - (void)setCruiseSwitch:(BOOL)state;
  57. /** 是否为非零速度启动 */
  58. - (void)setSpeedStart:(BOOL)state;
  59. /** 恢复出厂设置 */
  60. - (void)resetDevice;
  61. /** 清除除里程和时间外的其它控制器及仪表参数 */
  62. - (void)clearOtherCacheData;
  63. /** 清除总里程 */
  64. - (void)clearTotalMileage;
  65. /** 清除单次里程时间(设备一开机就会记录骑行时间和里程,当需要记录这些时间和里程的时候需要清除一下当次时间,重新开始记录) */
  66. - (void)clearSingleTime;
  67. /** 设置档位(1-7) */
  68. - (void)setGear:(NSInteger)gear;
  69. /** 开关灯 */
  70. - (void)setLightState:(BOOL)state;
  71. /** 修改密码 */
  72. - (void)updatePasswordWithOldPassword:(NSString *)oldPassword newPassword:(NSString *)newPassword;
  73. /** 解锁或者锁车(锁车无需传密码) 、查询仪表开锁验证密码功能状态、打开/关闭仪表开锁验证密码功能(需要携带密码)*/
  74. - (void)setLockState:(enum CM02_LockState_Type)lock password:(NSString *)password;
  75. //查询仪表开锁验证密码功能状态
  76. - (void)requestUnlockPasswordState;
  77. //打开仪表开锁验证密码功能(需要携带密码)
  78. - (void)setUnlockPasswordOn:(NSString *)password;
  79. //关闭仪表开锁验证密码功能(需要携带密码)
  80. - (void)setUnlockPasswordOff:(NSString *)password;
  81. /** 查询售后密码 */
  82. - (void)getAfterSalesPassword;
  83. /** 查询单次行驶里程和时间 */
  84. - (void)getNowSingleMileageInformation;
  85. /** 查询总里程 */
  86. - (void)getTotalMileageInformation;
  87. /** 查询电池信息 */
  88. - (void)getBatteryInformation;
  89. /** 查询控制器厂商代码及编号 */
  90. - (void)getControlVersion;
  91. /** 查询仪表盘固件版本 */
  92. - (void)getDashboardVersion;
  93. /** 导航推送
  94. * @param state : 更新导航数据 、开启导航、关闭导航
  95. * @param code : 导航方向代码
  96. * @param segmentRemainDistance : 当前方向剩余路程 m
  97. * @param routeRemainDistance : 总剩余路程 m
  98. */
  99. - (void)setNavigationPushWithState:(enum ElectricScooter_NavigationState)state code:(enum ElectricScooter_NavigationPushCode)code segmentRemainDistance:(NSInteger)segmentRemainDistance routeRemainDistance:(NSInteger)routeRemainDistance;
  100. /// 当前时区
  101. /// @param positive YES:东时区,NO:西时区
  102. /// @param value 时区,范围0-12
  103. - (void)setCurrentTimeZoneWithPositive:(BOOL)positive value:(NSUInteger)value;
  104. #pragma mark - 仪表OTA
  105. /** 发送OTA开始指令
  106. * @param size : ota文件长度
  107. * @param data : crc32校验码,4个byte
  108. * @param length : 单次发送OTA数据包最大的长度
  109. */
  110. - (void)sendStartOTAWithFileSize:(long long)size crc32Data:(NSData *)data maxPacketLength:(int)length;
  111. /** 发送OTA数据 */
  112. - (void)sendOTAUpdateFileWithIndex:(long long)index data:(NSData *)data;
  113. /** 发送OTA完成指令 */
  114. - (void)sendEndOTACommand;
  115. #pragma mark - 断开设备清除缓存信息
  116. - (void)cleanData;
  117. @end
  118. NS_ASSUME_NONNULL_END