iOS AILinkBleSDK - 蓝牙SDK
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ELWeightAlgorithmusModel.h 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // ELWeightAlgorithmusModel.h
  3. // Elink
  4. //
  5. // Created by iot_user on 2020/6/4.
  6. // Copyright © 2020 iot_iMac. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "ELSDKHeader.h"
  10. NS_ASSUME_NONNULL_BEGIN
  11. //体重单位st:lb分隔符 @":"
  12. extern NSString *const WeightUnitST_LBDelimiter;
  13. //kg转lb的系数=2.2046226f
  14. extern double const ELWeightKG_LB_CONST;
  15. //st转lb的系数=14.0f
  16. extern double const ELWeightST_LB_CONST;
  17. @interface ELWeightAlgorithmusModel : NSObject
  18. /// 体重数据转换成体重显示值的方法
  19. /// @param weight 蓝牙发送的体重数据
  20. /// @param weightPoint 体重小数点
  21. /// @param weightUnit 体重单位
  22. +(NSString *)getWeightStringWithWeight:(int)weight weightPoint:(int)weightPoint weightUnit:(ELDeviceWeightUnit)weightUnit;
  23. /**
  24. Convert the integer returned by Bluetooth to the character string required for interface display, the display unit is the current user unit
  25.   @param weightInt AILink protocol integer returned by Bluetooth
  26.   @param unit kg / lb / st: lb / jin
  27.   @param point 1,2
  28.   @return The weight displayed on the interface, such as 5: 6.5 st: lb
  29. 将蓝牙返回的整数,转换为界面显示所需要的字符串,显示单位为当前用户单位
  30. // weightInt AILink协议蓝牙返回的整数
  31. // unit kg/lb/st:lb/jin
  32. // point 1,2
  33. // 界面显示的体重,如 5:6.5 st:lb
  34. */
  35. + (NSString *)getWeightShowStrWithTargetUnit:(ELDeviceWeightUnit)targetUnit bleWeightInt:(NSUInteger)weightInt bleWeightUnit:(ELDeviceWeightUnit)unit bleWeightPoint:(NSUInteger)point;
  36. /**
  37. 将服务器返回的5:6.5、56.2等数据转换为kg,用来画图或者换算
  38. @param weightShow 从数据库中直接读出来的,或者AILink协议蓝牙返给界面的数据 68.56(kg) 120.6(lb)
  39. @param unit kg/lb/st:lb/jin
  40. @param point 1,2
  41. @return 转换为kg的值(用于绘图或换算的kg数,一律四舍五入保留2位小数)
  42. */
  43. + (NSString *)getKgWithWeightShowStr:(NSString *)weightShow weightUnit:(ELDeviceWeightUnit)unit weightPoint:(NSUInteger)point;
  44. @end
  45. NS_ASSUME_NONNULL_END