iOS AILinkBleSDK - 蓝牙SDK
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

ELToothbrushBleManager.h 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. /// Recall the data of manually set gear(回调手动设置档位的数据)
  33. /// @param custom data(数据)
  34. - (void)toothbrushReceiveCustomData:(ToothbrushCustomData)custom;
  35. /// Callback switch toothbrush result(回调开关牙刷结果)
  36. /// @param result 结果
  37. - (void)toothbrushReceiveSwitchResult:(ToothbrushSetResult)result;
  38. /// Callback three-axis direction(回调三轴方向)
  39. /// @param direction 方向
  40. - (void)toothbrushReceiveTriaxialDirection:(ToothbrushTriaxialDirection)direction;
  41. /// Recall three-axis data(回调三轴数据)
  42. /// @param success 是否成功
  43. /// @param x x轴数据
  44. /// @param y y轴数据
  45. /// @param z z轴数据
  46. - (void)toothbrushReceiveTriaxialData:(BOOL)success triaxialX:(int)x triaxialY:(int)y triaxialZ:(int)z;
  47. /// Default value of second gear(二档档位默认值)
  48. /// @param gear Second gear(二档档位)
  49. - (void)toothbrushReceiveTwoGearDefault:(ToothbrushGearType)gear;
  50. /// Set the second gear default gear result(设置二档默认档位结果)
  51. /// @param result 结果
  52. - (void)toothbrushReceiveSettingTwoGearDefaultResult:(ELSetBluetoothResponseType)result;
  53. /// Call back brushing data(回调刷牙数据)
  54. /// @param data 刷牙数据
  55. - (void)toothbrushtReceiveToothbrushData:(ToothbrushData)data;
  56. /// Call back brushing offline data(回调刷牙数据)
  57. /// @param data 刷牙离线数据
  58. - (void)toothbrushtReceiveToothbrushOfflineData:(ToothbrushOfflineData)data;
  59. - (void)toothbrushtReceiveToothbrushOfflineDataCount:(unsigned char)count result:(unsigned char)result;
  60. /** MCU replies to the result of setting the ip address (MCU回复设置ip地址结果 )
  61. * @param result : 1:成功,0:失败,2:不支持
  62. */
  63. - (void)toothbrushManagerCallBackSetIPAddressResult:(NSInteger)result;
  64. @end
  65. @interface ELToothbrushBleManager : ELBluetoothManager
  66. //Current working mode(当前工作模式)
  67. @property(nonatomic, assign) ToothbrushGearType currentMode;
  68. //Current default working hours(当前默认工作时长)
  69. @property(nonatomic, assign) NSInteger currentWorkTime;
  70. //Current gear(当前档位)
  71. @property(nonatomic, assign) ToothSupportGearType currentGear;
  72. @property(nonatomic, weak) id <ToothbrushDelegate> toothbrushDelegate;
  73. + (instancetype)shareManager;
  74. //Get supported gear(获取支持的档位)
  75. - (void)getGear;
  76. /// Set brushing mode(设置刷牙模式)
  77. /// @param gearType Brushing mode(刷牙模式)
  78. /// @param interval Brushing time (0: do not modify the working time, before keeping)(刷牙时间(0:不修改工作时长,保留之前))
  79. /// @param supportType Which gear is it(是哪个档位)
  80. - (void)setWorkGear:(ToothbrushGearType)gearType interval:(int)interval supportGearType:(ToothSupportGearType)supportType;
  81. - (void)setWorkGear:(ToothbrushGearType)gearType interval:(int)interval supportGearType:(ToothSupportGearType)supportType withCid:(ELSupportDeviceType)cid;
  82. /// Get the current working gear(获取当前工作的档位)
  83. - (void)getWorkGear;
  84. - (void)getWorkGearWithCid:(ELSupportDeviceType)cid;
  85. /// try out(试用)
  86. /// @param gear Gear (ToothbrushGearTypeStop_00 means stop trial)(档位(ToothbrushGearTypeStop_00 表示停止试用))
  87. /// @param supportType Which gear(第几档)
  88. /// @param frequency 频率
  89. /// @param duty 占空比
  90. - (void)tryGear:(ToothbrushGearType)gear supportType:(ToothSupportGearType)supportType frequency:(int)frequency duty:(int)duty;
  91. - (void)tryGear:(ToothbrushGearType)gear supportType:(ToothSupportGearType)supportType frequency:(int)frequency duty:(int)duty withCid:(ELSupportDeviceType)cid;
  92. /// Get the current work stage(获取当前工作阶段)
  93. - (void)getWorkPhase;
  94. - (void)getWorkPhaseWithCid:(ELSupportDeviceType)cid;
  95. /// Set manual setting gear(设置手动设置档位)
  96. /// @param frequency 频率
  97. /// @param duty 占空比
  98. /// @param interval 时间
  99. - (void)setCustomGearData:(int)frequency duty:(int)duty interval:(int)interval;
  100. - (void)setCustomGearData:(int)frequency duty:(int)duty interval:(int)interval withCid:(ELSupportDeviceType)cid;
  101. /// Get manual profile data(获取手动设置档数据)
  102. - (void)getCustomGear;
  103. - (void)getCustomGearWithCid:(ELSupportDeviceType)cid;
  104. /// Switch toothbrush(开关牙刷)
  105. - (void)switchToothbrush;
  106. - (void)switchToothbrushWithCid:(ELSupportDeviceType)cid;
  107. //Get three axis direction(获取三轴方向)
  108. - (void)getTriaxialDirection;
  109. //APP 获取离线历史记录条数 二级指令 0x11
  110. - (void)getOfflineDataCount;
  111. //APP 请求接收离线历史记录 二级指令 0x12
  112. - (void)getOfflineDataStart;
  113. //APP 取消接收离线历史记录 二级指令 0x13
  114. - (void)getOfflineDataCancel;
  115. //APP 请求清空离线历史记录 二级指令 0x14
  116. - (void)getOfflineDataClear;
  117. //Get three-axis data(获取三轴数据)
  118. - (void)getTriaxialData;
  119. //Set the second gear default gear(设置二档默认档位)
  120. - (void)setTwoGearDefaultGear:(ToothbrushGearType)gear;
  121. - (void)setTwoGearDefaultGear:(ToothbrushGearType)gear withCid:(ELSupportDeviceType)cid;
  122. //Get the second gear default gear(获取二档默认档位)
  123. - (void)getTwoGearDefualt;
  124. - (void)getTwoGearDefualtWithCid:(ELSupportDeviceType)cid;
  125. //Report the results of receiving brushing data(上报刷牙数据接收结果)
  126. - (void)reportReceiveResultOfToothbrushData:(BOOL)result;
  127. - (void)reportReceiveResultOfToothbrushData:(BOOL)result withCid:(ELSupportDeviceType)cid;
  128. ///清除wifi记录指令
  129. - (void)bleWifiCleanWifiRecord;
  130. ///获取设备连接的wifi名称
  131. - (void)getBleLinkWifiName;
  132. /// Request device authorization(请求设备授权)
  133. /// @param interval 时间截
  134. -(void)requestDeviceAuthorization:(NSInteger)interval;
  135. /** 设置设备的IP地址,端口号和访问路径 */
  136. - (void)setDevAccessIpAddress:(NSString *)address portNumber:(NSUInteger)portNum path:(NSString *)path;
  137. @end
  138. NS_ASSUME_NONNULL_END