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.

iFreshSDK.h 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. //
  2. // iFreshSDK.h
  3. // iFreshSDK
  4. //
  5. // Created by zhang on 16/9/9.
  6. // Copyright © 2016年 taolei. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "iFreshModel.h"
  10. #import "AiFreshHeader.h"
  11. #import "iFreshDevice.h"
  12. @protocol BleReturnValueDelegate <NSObject>
  13. @optional
  14. /**
  15. ble Penetrate Data(蓝牙透传数据)
  16. @param data Penetrate data(透传数据)
  17. */
  18. -(void)bluetoothManagerReturePenetrateData:(NSData *)data;
  19. /**
  20. * Model model: value ble returns the value (model模型:value ble返还数值)
  21. *
  22. * @param model Global Bluetooth model data(全局蓝牙模型数据)
  23. */
  24. - (void)bleReturnValueModel:(iFreshModel*)model;
  25. /**
  26. * Proxy method triggered by end switching unit(称端切换单位触发的代理方法)
  27. * GN_UnitEnum Unit enumeration(单位枚举)
  28. * unitChang Switched unit(切换后的单位)
  29. */
  30. - (void)changeUnitWithBle:(GN_UnitEnum)unitChange;
  31. /**
  32. * Proxy method for changing Bluetooth connection status(蓝牙连接状态改变的代理方法)
  33. * GN_BleStatus Bluetooth status enumeration(蓝牙状态枚举)
  34. * bleStatus Current Bluetooth status(当前蓝牙状态)
  35. */
  36. - (void)bleStatusupdate:(GN_BleStatus)bleStatus;
  37. /**
  38. *Callback Bluetooth device type(回调蓝牙设备类型)
  39. *deviceType:Bluetooth device type, default AiFrushDeviceTypeUnknown when no device is connected(蓝牙设备类型,未连接设备时,默认AiFrushDeviceTypeUnknown)
  40. */
  41. - (void)bleReturnDeviceType:(AiFrushDeviceType)deviceType;
  42. /**
  43. *Callback Bluetooth scanned devices(回调扫描到的设备)
  44. */
  45. - (void)bleReturnScannedDevice:(iFreshDevice *)device;
  46. #pragma mark ============ Coffee scale callback(咖啡秤回调) ==============
  47. /**
  48. *Coffee scale support agent callback(咖啡秤支持的代理回调)
  49. *workType:Coffee scale operation instructions(咖啡秤的操作指令)
  50. */
  51. -(void)bluetoothManagerCoffeeTimingWork:(BleCoffeeTimingWorkType)workType;
  52. /**
  53. *Coffee scale return time(咖啡秤返回的时间)
  54. *min:minute(分)
  55. *sec:second(秒)
  56. *countdown:Whether it is countdown, YES: countdown, NO: timing(是否是倒计时,YES:倒计时,NO:正计时)
  57. */
  58. -(void)bluetoothManagerCoffeeTime:(int )min second:(int)sec isCountdown:(BOOL)countdown;
  59. /**
  60. *Coffee scale countdown starts(咖啡秤倒计时开始)
  61. *min:minute(分)
  62. *sec:second(秒)
  63. */
  64. -(void)bluetoothManagerCoffeeCountdownStartTime:(int )min second:(int)sec;
  65. /**
  66. Bluetooth pause timing callback(蓝牙暂停计时的回调)
  67. @param type Pause type(暂停类型)
  68. @param min minute(分钟)
  69. @param sec second(秒)
  70. */
  71. -(void)bluetoothManagerCoffeePauseType:(BleCoffeeTimingWorkType)type minute:(int)min second:(int)sec;
  72. /**
  73. 设备发送停止报警指令
  74. */
  75. -(void)bluetoothManagerCoffeeReceiveStopAlarm;
  76. @end
  77. @interface iFreshSDK : NSObject
  78. /// Whether to link to Bluetooth(是否链接上蓝牙)
  79. @property (nonatomic, assign) BOOL isBle_Link;
  80. @property (nonatomic, assign, readonly) GN_UnitEnum unitEnum;
  81. @property (nonatomic, assign , readonly) AiFrushDeviceType deviceType;
  82. ////
  83. //+(void)setAppKey:(NSString *)key appSecret:(NSString *)secret;
  84. /**
  85. * shareManager
  86. */
  87. + (instancetype)shareManager;
  88. /*
  89. * write data to ble(写入数据)
  90. */
  91. - (void)sendDataToBle:(NSData *)data;
  92. /**
  93. * start scaning(开始扫描)
  94. */
  95. - (void)bleDoScan;
  96. /**
  97. * stop scaning(停止扫描)
  98. */
  99. - (void)bleStopScan;
  100. /**
  101. * stop connect device(停止连接设备)
  102. */
  103. - (void)bleDisconnect;
  104. /**
  105. * Follow the protocol call(遵循协议的调用)
  106. */
  107. - (void)setbleReturnValueDelegate:(id<BleReturnValueDelegate>)delegate;
  108. /**
  109. * setting unit(设置单位)
  110. *
  111. * @param unit Write units according to GN_UnitEnum enumeration(根据GN_UnitEnum枚举写入单位)
  112. */
  113. - (void)insertTheUnit:(GN_UnitEnum)unit;
  114. /**
  115. * Return to zero(归零)
  116. */
  117. - (void)zeroWriteBle;
  118. /*
  119. * Shutdown command(关机指令)
  120. *
  121. */
  122. - (void)turnOffDevice;
  123. /*
  124. * The SDK is no longer automatically connected, so you should call the following methods to connect
  125. * (SDK不再自动连接,需要App调用如下方法连接设备)
  126. *
  127. */
  128. - (void)connectDevice:(iFreshDevice *)device;
  129. #pragma mark ============ No longer use(不再使用) ==============
  130. /*
  131. Setting weight(设置重量)
  132. */
  133. - (void)setWeight:(NSInteger)weight;
  134. /*
  135. * Set a single calorie(设置单项卡路里)
  136. */
  137. - (void)setCalorie:(NSInteger)calories;
  138. /*
  139. * Set total calories(设置总卡路里)
  140. */
  141. - (void)setTotalCalorie:(NSInteger)toatlCalories;
  142. /*
  143. * Set total fat(设置总脂肪)
  144. */
  145. - (void)setTotalFat:(NSInteger)fat;
  146. /*
  147. * Set total protein(设置总蛋白质)
  148. */
  149. - (void)setTotalProtein:(NSInteger)protein;
  150. /*
  151. * Set total carbohydrates(设置总碳水化合物)
  152. */
  153. - (void)setTotalCarbohydrates:(NSInteger)carbohydertes;
  154. /*
  155. * Set total fat fiber(设置总脂肪纤维)
  156. */
  157. - (void)setTotalFiber:(NSInteger)fiber;
  158. /*
  159. * Set total cholesterol(设置总胆固醇)
  160. */
  161. - (void)setTotalCholesterd:(NSInteger)cholesterd;
  162. /*
  163. * Set total sodium content(设置总钠含量)
  164. */
  165. - (void)setTotalSodium:(NSInteger)sodium;
  166. /*
  167. * Set total sugar content(设置总糖含量)
  168. */
  169. - (void)setTotalSugar:(NSInteger)sugar;
  170. /*
  171. *Setting fat(设置脂肪)
  172. */
  173. - (void)setFat:(NSInteger)fat;
  174. /*
  175. *Set protein(设置蛋白质)
  176. */
  177. - (void)setProtein:(NSInteger)protein;
  178. /*
  179. *Set carbohydrates(设置碳水化合物)
  180. */
  181. - (void)setCarbohydrates:(NSInteger)carbohydertes;
  182. /*
  183. *Setting dietary fiber(设置膳食纤维)
  184. */
  185. - (void)setFiber:(NSInteger)fiber;
  186. /*
  187. *Set cholesterol(设置胆固醇)
  188. */
  189. - (void)setCholesterd:(NSInteger)cholesterd;
  190. /*
  191. *Set sodium content(设置钠含量)
  192. */
  193. - (void)setSodium:(NSInteger)sodium;
  194. /*
  195. *Setting the sugar content(设置糖含量)
  196. */
  197. - (void)setSugar:(NSInteger)sugar;
  198. #pragma mark ============ Coffee scale(咖啡秤) ==============
  199. //start the timer(开始计时)
  200. -(void)bluetoothCoffeeStartTime;
  201. //pause(暂停)
  202. -(void)bluetoothCoffeePauseType:(BleCoffeeTimingWorkType)type minute:(int)min second:(int)sec;
  203. //reset(重置)
  204. -(void)bluetoothCoffeeResetTime;
  205. //Countdown starts(倒计时开始)
  206. -(void)bluetoothCoffeeCountdownStartTime:(int)min second:(int)sec;
  207. //APP reply stop alarm command(APP 回复停止报警指令)
  208. -(void)bluetoothManagerSendStopAlarm;
  209. @end