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 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. //MCU response Prevent Splashing mode 防飞溅
  69. - (void)toothbrushtReceivePreventSplashing:(Byte)support on:(Byte)on;
  70. @end
  71. @interface ELToothbrushBleManager : ELBluetoothManager
  72. //Current working mode(当前工作模式)
  73. @property(nonatomic, assign) ToothbrushGearType currentMode;
  74. //Current default working hours(当前默认工作时长)
  75. @property(nonatomic, assign) NSInteger currentWorkTime;
  76. //Current gear(当前档位)
  77. @property(nonatomic, assign) ToothSupportGearType currentGear;
  78. @property(nonatomic, weak) id <ToothbrushDelegate> toothbrushDelegate;
  79. + (instancetype)shareManager;
  80. //Get supported gear(获取支持的档位)
  81. - (void)getGear;
  82. /// Set brushing mode(设置刷牙模式) //******** wifi 牙刷专用方法
  83. /// @param gearType Brushing mode(刷牙模式)
  84. /// @param interval Brushing time (0: do not modify the working time, before keeping)(刷牙时间(0:不修改工作时长,保留之前))
  85. /// @param supportType Which gear is it(是哪个档位)
  86. - (void)setWorkGear:(ToothbrushGearType)gearType interval:(int)interval supportGearType:(ToothSupportGearType)supportType;
  87. //******** 通用牙刷专用方法
  88. - (void)setWorkGear:(ToothbrushGearType)gearType interval:(int)interval supportGearType:(ToothSupportGearType)supportType withCid:(ELSupportDeviceType)cid;
  89. /// Get the current working gear(获取当前工作的档位) //******** wifi 牙刷专用方法
  90. - (void)getWorkGear;
  91. //******** 通用牙刷专用方法
  92. - (void)getWorkGearWithCid:(ELSupportDeviceType)cid;
  93. /// try out(试用) //******** wifi 牙刷专用方法
  94. /// @param gear Gear (ToothbrushGearTypeStop_00 means stop trial)(档位(ToothbrushGearTypeStop_00 表示停止试用))
  95. /// @param supportType Which gear(第几档)
  96. /// @param frequency 频率
  97. /// @param duty 占空比
  98. - (void)tryGear:(ToothbrushGearType)gear supportType:(ToothSupportGearType)supportType frequency:(int)frequency duty:(int)duty;
  99. //******** 通用牙刷专用方法
  100. - (void)tryGear:(ToothbrushGearType)gear supportType:(ToothSupportGearType)supportType frequency:(int)frequency duty:(int)duty withCid:(ELSupportDeviceType)cid;
  101. /// Get the current work stage(获取当前工作阶段) //******** wifi 牙刷专用方法
  102. - (void)getWorkPhase;
  103. //******** 通用牙刷专用方法
  104. - (void)getWorkPhaseWithCid:(ELSupportDeviceType)cid;
  105. /// Set manual setting gear(设置手动设置档位) //******** wifi 牙刷专用方法
  106. /// @param frequency 频率
  107. /// @param duty 占空比
  108. /// @param interval 时间
  109. - (void)setCustomGearData:(int)frequency duty:(int)duty interval:(int)interval;
  110. //******** 通用牙刷专用方法
  111. - (void)setCustomGearData:(int)frequency duty:(int)duty interval:(int)interval withCid:(ELSupportDeviceType)cid;
  112. /// Get manual profile data(获取手动设置档数据)
  113. - (void)getCustomGear;
  114. - (void)getCustomGearWithCid:(ELSupportDeviceType)cid;
  115. /// Switch toothbrush(开关牙刷)
  116. - (void)switchToothbrush;
  117. - (void)switchToothbrushWithCid:(ELSupportDeviceType)cid;
  118. //Get three axis direction(获取三轴方向)
  119. - (void)getTriaxialDirection;
  120. //APP 获取离线历史记录条数 二级指令 0x11
  121. - (void)getOfflineDataCount;
  122. //APP 请求接收离线历史记录 二级指令 0x12
  123. - (void)getOfflineDataStart;
  124. //APP 取消接收离线历史记录 二级指令 0x13
  125. - (void)getOfflineDataCancel;
  126. //APP 请求清空离线历史记录 二级指令 0x14
  127. - (void)getOfflineDataClear;
  128. //APP 请求设备继续发送离线历史记录 二级指令 0x16
  129. - (void)getOfflineNextRecord;
  130. //Get three-axis data(获取三轴数据)
  131. - (void)getTriaxialData;
  132. //Set the second gear default gear(设置二档默认档位) //******** wifi 牙刷专用方法
  133. - (void)setTwoGearDefaultGear:(ToothbrushGearType)gear;
  134. //******** 通用牙刷专用方法
  135. - (void)setTwoGearDefaultGear:(ToothbrushGearType)gear withCid:(ELSupportDeviceType)cid;
  136. //Get the second gear default gear(获取二档默认档位)
  137. - (void)getTwoGearDefualt;
  138. //******** 通用牙刷专用方法
  139. - (void)getTwoGearDefualtWithCid:(ELSupportDeviceType)cid;
  140. //Report the results of receiving brushing data(上报刷牙数据接收结果) //******** wifi 牙刷专用方法
  141. - (void)reportReceiveResultOfToothbrushData:(BOOL)result;
  142. //******** 通用牙刷专用方法
  143. - (void)reportReceiveResultOfToothbrushData:(BOOL)result withCid:(ELSupportDeviceType)cid;
  144. ///清除wifi记录指令
  145. - (void)bleWifiCleanWifiRecord;
  146. ///获取设备连接的wifi名称
  147. - (void)getBleLinkWifiName;
  148. /// Request device authorization(请求设备授权)
  149. /// @param interval 时间截
  150. -(void)requestDeviceAuthorization:(NSInteger)interval;
  151. /** 设置设备的IP地址,端口号和访问路径 */
  152. - (void)setDevAccessIpAddress:(NSString *)address portNumber:(NSUInteger)portNum path:(NSString *)path;
  153. /** app查询BLE工作状态 0xFC */
  154. - (void)getDevBleWorkState:(enum ELSupportDeviceType)cid;
  155. //APP request Prevent Splashing mode 防飞溅 (cid 0x002D BLE only)
  156. - (void)getPreventSplashingMode;
  157. - (void)setPreventSplashingMode:(BOOL)on;
  158. @end
  159. NS_ASSUME_NONNULL_END