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.

ELToothbrushBleManager.h 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. //
  2. // ELToothbrushBleManager.h
  3. // Elink
  4. //
  5. // Created by iot_user on 2020/5/11.
  6. // Copyright © 2020 iot_iMac. All rights reserved.
  7. //
  8. #import "ELBluetoothManager.h"
  9. #import "ELToothburshHeader.h"
  10. NS_ASSUME_NONNULL_BEGIN
  11. @protocol ToothbrushDelegate <NSObject>
  12. @optional
  13. //Bluetooth status callback(回调蓝牙状态)
  14. - (void)toothbrushReceiveState:(ELBluetoothState)state;
  15. //Callback toothbrush device list(回调牙刷设备列表)
  16. - (void)toothbrushReceiveDevices:(NSArray<ELPeripheralModel *> *)devices;
  17. /// Callback gear information(回调档位信息)
  18. /// @param oneGear First gear(一档档位)
  19. /// @param twoGear Second gear(二档档位)
  20. - (void)toothbrushReceiveOneGear:(NSArray<NSNumber *> *)oneGear twoGear:(NSArray<NSNumber *> *)twoGear;
  21. /// Set work gear result(设置工作档位结果)
  22. /// @param result 结果
  23. - (void)toothbrushReceiveSetWorkGearResult:(ELSetBluetoothResponseType)result;
  24. //Call back current working gear information(回调当前工作档位信息)
  25. - (void)toothbrushReceiveWorkGear:(ToothbrushWorkGear)workGear;
  26. /// Call back trial results(回调试用结果)
  27. /// @param result 结果
  28. - (void)toothbrushReceiveTryResult:(ToothbrushSetResult)result;
  29. /// Report work phase(上报工作阶段)
  30. /// @param workPhase Work stage information(工作阶段信息)
  31. - (void)toothbrushReceiveWorkPhase:(ToothBrushWorkPhase)workPhase;
  32. /** 0xFC 针对当前刷牙时间新增的上报工作状态 */
  33. - (void)toothbrushReceiveNewWorkPhase:(ToothBrushNewWorkPhase)workPhase;
  34. /// Recall the data of manually set gear(回调手动设置档位的数据)
  35. /// @param custom data(数据)
  36. - (void)toothbrushReceiveCustomData:(ToothbrushCustomData)custom;
  37. /// Callback switch toothbrush result(回调开关牙刷结果)
  38. /// @param result 结果
  39. - (void)toothbrushReceiveSwitchResult:(ToothbrushSetResult)result;
  40. /// Callback three-axis direction(回调三轴方向)
  41. /// @param direction 方向
  42. - (void)toothbrushReceiveTriaxialDirection:(ToothbrushTriaxialDirection)direction;
  43. /// Recall three-axis data(回调三轴数据)
  44. /// @param success 是否成功
  45. /// @param x x轴数据
  46. /// @param y y轴数据
  47. /// @param z z轴数据
  48. - (void)toothbrushReceiveTriaxialData:(BOOL)success triaxialX:(int)x triaxialY:(int)y triaxialZ:(int)z;
  49. /// Default value of second gear(二档档位默认值)
  50. /// @param gear Second gear(二档档位)
  51. - (void)toothbrushReceiveTwoGearDefault:(ToothbrushGearType)gear;
  52. /// Set the second gear default gear result(设置二档默认档位结果)
  53. /// @param result 结果
  54. - (void)toothbrushReceiveSettingTwoGearDefaultResult:(ELSetBluetoothResponseType)result;
  55. /// Call back brushing data(回调刷牙数据)
  56. /// @param data 刷牙数据
  57. - (void)toothbrushtReceiveToothbrushData:(ToothbrushData)data;
  58. /// Call back brushing offline data(回调刷牙数据)
  59. /// @param data 刷牙离线数据
  60. - (void)toothbrushtReceiveToothbrushOfflineData:(ToothbrushOfflineData)data;
  61. - (void)toothbrushtReceiveToothbrushOfflineDataCount:(unsigned char)count result:(unsigned char)result;
  62. /** 回复离线历史记录数据发送状态 */
  63. - (void)toothbrushReceiveRecordDataStatus:(enum ToothbrushOfflineRecrodStatusType)status;
  64. /** MCU replies to the result of setting the ip address (MCU回复设置ip地址结果 )
  65. * @param result : 1:成功,0:失败,2:不支持
  66. */
  67. - (void)toothbrushManagerCallBackSetIPAddressResult:(NSInteger)result;
  68. @end
  69. @interface ELToothbrushBleManager : ELBluetoothManager
  70. //Current working mode(当前工作模式)
  71. @property(nonatomic, assign) ToothbrushGearType currentMode;
  72. //Current default working hours(当前默认工作时长)
  73. @property(nonatomic, assign) NSInteger currentWorkTime;
  74. //Current gear(当前档位)
  75. @property(nonatomic, assign) ToothSupportGearType currentGear;
  76. @property(nonatomic, weak) id <ToothbrushDelegate> toothbrushDelegate;
  77. + (instancetype)shareManager;
  78. //Get supported gear(获取支持的档位)
  79. - (void)getGear;
  80. /// Set brushing mode(设置刷牙模式)
  81. /// @param gearType Brushing mode(刷牙模式)
  82. /// @param interval Brushing time (0: do not modify the working time, before keeping)(刷牙时间(0:不修改工作时长,保留之前))
  83. /// @param supportType Which gear is it(是哪个档位)
  84. - (void)setWorkGear:(ToothbrushGearType)gearType interval:(int)interval supportGearType:(ToothSupportGearType)supportType;
  85. - (void)setWorkGear:(ToothbrushGearType)gearType interval:(int)interval supportGearType:(ToothSupportGearType)supportType withCid:(ELSupportDeviceType)cid;
  86. /// Get the current working gear(获取当前工作的档位)
  87. - (void)getWorkGear;
  88. - (void)getWorkGearWithCid:(ELSupportDeviceType)cid;
  89. /// try out(试用)
  90. /// @param gear Gear (ToothbrushGearTypeStop_00 means stop trial)(档位(ToothbrushGearTypeStop_00 表示停止试用))
  91. /// @param supportType Which gear(第几档)
  92. /// @param frequency 频率
  93. /// @param duty 占空比
  94. - (void)tryGear:(ToothbrushGearType)gear supportType:(ToothSupportGearType)supportType frequency:(int)frequency duty:(int)duty;
  95. - (void)tryGear:(ToothbrushGearType)gear supportType:(ToothSupportGearType)supportType frequency:(int)frequency duty:(int)duty withCid:(ELSupportDeviceType)cid;
  96. /// Get the current work stage(获取当前工作阶段)
  97. - (void)getWorkPhase;
  98. - (void)getWorkPhaseWithCid:(ELSupportDeviceType)cid;
  99. /// Set manual setting gear(设置手动设置档位)
  100. /// @param frequency 频率
  101. /// @param duty 占空比
  102. /// @param interval 时间
  103. - (void)setCustomGearData:(int)frequency duty:(int)duty interval:(int)interval;
  104. - (void)setCustomGearData:(int)frequency duty:(int)duty interval:(int)interval withCid:(ELSupportDeviceType)cid;
  105. /// Get manual profile data(获取手动设置档数据)
  106. - (void)getCustomGear;
  107. - (void)getCustomGearWithCid:(ELSupportDeviceType)cid;
  108. /// Switch toothbrush(开关牙刷)
  109. - (void)switchToothbrush;
  110. - (void)switchToothbrushWithCid:(ELSupportDeviceType)cid;
  111. //Get three axis direction(获取三轴方向)
  112. - (void)getTriaxialDirection;
  113. //APP 获取离线历史记录条数 二级指令 0x11
  114. - (void)getOfflineDataCount;
  115. //APP 请求接收离线历史记录 二级指令 0x12
  116. - (void)getOfflineDataStart;
  117. //APP 取消接收离线历史记录 二级指令 0x13
  118. - (void)getOfflineDataCancel;
  119. //APP 请求清空离线历史记录 二级指令 0x14
  120. - (void)getOfflineDataClear;
  121. //APP 请求设备继续发送离线历史记录 二级指令 0x16
  122. - (void)getOfflineNextRecord;
  123. //Get three-axis data(获取三轴数据)
  124. - (void)getTriaxialData;
  125. //Set the second gear default gear(设置二档默认档位)
  126. - (void)setTwoGearDefaultGear:(ToothbrushGearType)gear;
  127. - (void)setTwoGearDefaultGear:(ToothbrushGearType)gear withCid:(ELSupportDeviceType)cid;
  128. //Get the second gear default gear(获取二档默认档位)
  129. - (void)getTwoGearDefualt;
  130. - (void)getTwoGearDefualtWithCid:(ELSupportDeviceType)cid;
  131. //Report the results of receiving brushing data(上报刷牙数据接收结果)
  132. - (void)reportReceiveResultOfToothbrushData:(BOOL)result;
  133. - (void)reportReceiveResultOfToothbrushData:(BOOL)result withCid:(ELSupportDeviceType)cid;
  134. ///清除wifi记录指令
  135. - (void)bleWifiCleanWifiRecord;
  136. ///获取设备连接的wifi名称
  137. - (void)getBleLinkWifiName;
  138. /// Request device authorization(请求设备授权)
  139. /// @param interval 时间截
  140. -(void)requestDeviceAuthorization:(NSInteger)interval;
  141. /** 设置设备的IP地址,端口号和访问路径 */
  142. - (void)setDevAccessIpAddress:(NSString *)address portNumber:(NSUInteger)portNum path:(NSString *)path;
  143. /** app查询BLE工作状态 0xFC */
  144. - (void)getDevBleWorkState:(enum ELSupportDeviceType)cid;
  145. @end
  146. NS_ASSUME_NONNULL_END