iOS AILinkBleSDK - 蓝牙SDK
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

ELSDKHeader.h 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. //
  2. // ELSDKHeader.h
  3. // AILinkSDKDemo
  4. //
  5. // Created by iot_user on 2019/5/10.
  6. // Copyright © 2019 IOT. All rights reserved.
  7. //
  8. #ifndef ELSDKHeader_h
  9. #define ELSDKHeader_h
  10. //Bluetooth command type(蓝牙指令类型)
  11. typedef NS_ENUM(NSUInteger, ELInetBleDataType) {
  12. ELInetBleDataPackHead_A6 = 0xA6,
  13. ELInetBleDataPackTail_6A = 0x6A,
  14. ELInetBleDataPackHead_A7 = 0xA7,
  15. ELInetBleDataPackTail_7A = 0x7A,
  16. };
  17. //The type of instruction acquired by Inet(Inet获取的指令类型)
  18. typedef NS_ENUM(NSUInteger, ELInetGetCmdType) {
  19. ELInetGetCmdTypeGetName = 0x02, //-Get the Bluetooth name(获取蓝牙名称)
  20. ELInetGetCmdTypeGetBroadcastInterval = 0x06, //-Get broadcast interval (unit: ms)(获取广播间隔时间(单位:ms))
  21. ELInetGetCmdTypeGetConnectedInterval = 0x08, //-Get Bluetooth connection interval(获取蓝牙连接间隔)
  22. ELInetGetCmdTypeGetTransmittingPower = 0x0A, //-Get Bluetooth transmit power(获取蓝牙发射功率)
  23. ELInetGetCmdTypeGetSerialPortbaudRate = 0x0C, //-Get the serial port baud rate(获取串口波特率)
  24. ELInetGetCmdTypeGetMACAddress = 0x0D, //-Read MAC address value(读取MAC地址值)
  25. ELInetGetCmdTypeGetBMVersion = 0x0E, //-Read the BM module software and hardware version number(读取BM模块软硬件版本号)
  26. ELInetGetCmdTypeGetMCUVersion = 0x10, //-Obtain the MCU software and hardware version number(获取MCU软硬件版本号)
  27. ELInetGetCmdTypeGetMACAddressType = 0x12, //-Get the big endian or little endian of the Mac address in the broadcast manufacturer's custom data(获取广播厂家自定义数据中Mac地址的大端序或小端序)
  28. ELInetGetCmdTypeGetUUID = 0x14, //-Get service and feature UUID(获取服务和特征UUID)
  29. ELInetGetCmdTypeGetMCUMode = 0x16, //-Get master-slave mode(获取主从模式)
  30. ELInetGetCmdTypeGetAutoSleepTime = 0x18, //-Get automatic sleep time value(获取自动睡眠时间值)
  31. ELInetGetCmdTypeGetMCUDate = 0x1C, //-Get the current time of the system(获取系统当前时间)
  32. ELInetGetCmdTypeGetC_V_P_ID = 0x1E, //-Read CID, VID, PID(读取CID、VID、PID)
  33. ELInetGetCmdTypeGetCommunicationMode = 0x20, //-Get module communication mode(获取模块通信模式)
  34. ELInetGetCmdTypeGetConnectState = 0x26, //-Get Bluetooth and WiFi connection status(获取蓝牙和WiFi连接状态)
  35. ELInetGetCmdTypeGetBatteryState = 0x28, //-Get MCU battery status(获取MCU电池状态)
  36. ELInetGetCmdTypeGetHandshake = 0x24, //-Encrypted handshake data returned by Bluetooth(蓝牙返回的加密的握手数据)
  37. ELInetGetCmdTypeGetBodyFatScaleA6Data = 0x2B, //-Body fat scale 0x2B stands for A6 protocol (see the second level instructions for details)(体脂秤0x2B代表A6协议(具体见二级指令))
  38. ELInetGetCmdTypeReadDeviceSupportUnit = 0x2C, //-APP reads the MCU end unit instruction(APP读取MCU端单位指令)
  39. ELInetGetCmdTypeGetSendKeyState = 0x31, //-APP reads the result of sending the decoding key(APP读取下发解码秘钥的结果)
  40. ELInetGetCmdTypeGetSmartLockA6Data = 0x34, //-Door lock 0x34 represents the A6 protocol (see the second level command for details)(门锁0x34代表A6协议(具体见二级指令))
  41. ELInetGetCmdTypeGetBasicInfoData = 0x36, //Obtain basic device information data(获取设备基本信息数据)
  42. #pragma mark ============ Begin 蓝牙Wifi ==============
  43. ELInetGetCmdTypeBleWifiGetNearbyWifi = 0x80, //Get nearby Wifi(获取附近Wifi)
  44. ELInetGetCmdTypeBleWifiReceiveWifiName = 0x81, //Reply to wifi name(回复wifi名字)
  45. ELInetGetCmdTypeBleWifiReceiveWifiMac = 0x82, //Reply to wifi mac(回复wifi mac)
  46. ELInetGetCmdTypeBleWifiReceiveScanResult = 0x83, //Reply to scan Wifi result(回复扫描Wifi结果)
  47. ELInetGetCmdTypeBleWifiGetWifiMac = 0x85, //Get Wifi Mac address(获取Wifi的Mac地址)
  48. ELInetGetCmdTypeBleWifiGetWifiPwd = 0x87, //Get Wifi password(获取Wifi密码)
  49. ELInetGetCmdTypeBleWifiGetDTIMInterval = 0x8A, //Get DTIM interval(获取DTIM间隔)
  50. ELInetGetCmdTypeBleWifiSetIpAddress = 0x8B, //Set the access ip address(设置访问的ip地址
  51. ELInetGetCmdTypeBleWifiGetURL = 0x8C, //Get visited sites(获取访问的网站)
  52. ELInetGetCmdTypeBleWifiSetPort = 0x8D, //set acces port number
  53. ELInetGetCmdTypeBleWifiGetPort = 0x8E, //Get access port number(获取访问的端口号)
  54. ELInetGetCmdTypeBleWifiGetSNNumber = 0x93, //Get SN number (session code:deviceId)(获取SN号(会话码:设备ID))
  55. ELInetGetCmdTypeBleWifiName = 0x94, //获取wifi名称
  56. ELInetGetCmdTypeBleWifiSetPathAddress = 0x96, //Set access path(设置访问的路径
  57. ELInetGetCmdTypeBleWifiGetPathAddress = 0x97, //get access path
  58. #pragma mark ============End 蓝牙Wifi ==============
  59. ELInetGetCmdTypeRequestAuthorize = 0x7F, //Request device authorization (请求设备授权)
  60. ELInetGetCmdTypeToothbrushA6Data = 0xC0, //A6 data for toothbrush(牙刷专用A6数据,详情请见协议的2级指令)(See the second order for details)
  61. };
  62. //Instruction type set by Inet(Inet设置的指令类型)
  63. typedef NS_ENUM(NSUInteger, ELInetSetCmdType) {
  64. ELInetSetCmdTypeSetName = 0x01, //Set the broadcast name(设置广播名称)
  65. ELInetSetCmdTypeSetBroadcastInterval = 0x05, //Set the broadcast interval(设置广播间隔时间)
  66. ELInetSetCmdTypeSetConnectedInterval = 0x07, //Set the connection interval(设置连接间隔)
  67. ELInetSetCmdTypeSetTransmittingPower = 0x09, //Set the transmit power(设置发射功率)
  68. ELInetSetCmdTypeSetSerialPortbaudRate = 0x0B, //Set the serial port baud rate(设置串口波特率)
  69. ELInetSetCmdTypeSetMCUVersion = 0x0F, //Set the MCU software and hardware version number(设置MCU软硬件版本号)
  70. ELInetSetCmdTypeSetMACAddressType = 0x11, //Set the big endian or little endian of the Mac address in the broadcast manufacturer's custom data.(设置广播厂家自定义数据中Mac地址的大端序或小端序)
  71. ELInetSetCmdTypeSetUUID = 0x13, //Set the module's service and feature UUID(设置模块的服务和特征UUID)
  72. ELInetSetCmdTypeSetMCUMode = 0x15, //Set the master-slave mode of the module(设置模块的主从模式)
  73. ELInetSetCmdTypeSetAutoSleepTime = 0x17, //Set the module's automatic sleep time without connection(设置模块无连接的自动休眠时间)
  74. ELInetSetCmdTypeSetGotoSleep = 0x19, //Set to sleep(设置进入睡眠)
  75. ELInetSetCmdTypeSetMCUWakeUp = 0x1A, //Set module wake up(设置模块唤醒)
  76. ELInetSetCmdTypeSetMCUNowDate = 0x1B, //Set the current time of the system(设置系统当前时间)
  77. ELInetSetCmdTypeSetC_V_P_ID = 0x1D, //Set CID, VID, PID(设置CID、VID、PID)
  78. ELInetSetCmdTypeSetCommunicationMode = 0x1F, //Set module serial port mode, I2C mode, SPI mode(设置模块串口模式、I2C模式、SPI模式)
  79. ELInetSetCmdTypeSetMCURestart = 0x21, //Set module restart(设置模块重启)
  80. ELInetSetCmdTypeSetFactoryDataReset = 0x22, //Set factory reset(设置恢复出厂设置)
  81. ELInetSetCmdTypeSetConnectState = 0x25, //Set the Bluetooth connection status(设置蓝牙连接状态)
  82. ELInetSetCmdTypeSetHandshake = 0x23, //Encrypted handshake data returned by Bluetooth(蓝牙返回的加密的握手数据)
  83. ELInetSetCmdTypeSetKey = 0x31, //APP sends the decoding key(APP下发解码秘钥)
  84. ELInetSetCmdTypeSetSmartLockA6Data = 0x34, //Door lock 0x34 represents the A6 protocol (see the second level command for details)(门锁0x34代表A6协议(具体见二级指令))
  85. ELInetSetCmdTypeSyncMCUNowDate = 0x37, //Sync the current time of the system(设置系统当前时间)
  86. #pragma mark ============ 蓝牙Wifi ==============
  87. ELInetSetCmdTypeBleWifiSetWifiMac = 0x84, //设置WIFI Mac地址
  88. ELInetSetCmdTypeBleWifiSetWifiPwd = 0x86, //设置WIFI 密码
  89. ELInetSetCmdTypeBleWifiSetConnectWifi = 0x88, //设置设备连接WIFI
  90. ELInetSetCmdTypeBleWifiSetDTIMInterval = 0x89, //设置DTIM间隔
  91. ELInetSetCmdTypeBleWifiSetWifiURL = 0x8B, //设置访问的URL
  92. ELInetSetCmdTypeBleWifiSetWifiPort = 0x8D, //设置端口号
  93. };
  94. //Response to Bluetooth after device(给蓝牙进行设置后的响应)
  95. typedef NS_ENUM(NSUInteger, ELSetBluetoothResponseType) {
  96. ELSetBluetoothResponseTypeSuccess =0 , //success(成功)
  97. ELSetBluetoothResponseTypeFailure =1 , //failure(失败)
  98. ELSetBluetoothResponseTypeNoSupport =2 , //not support(不支持)
  99. };
  100. //Device types supported by Elink: Please communicate with the hardware to set(Elink支持的设备类型:请与硬件沟通后设置)
  101. typedef NS_ENUM(NSUInteger, ELSupportDeviceType) {
  102. ELSupportDeviceTypeUnkonwn = 0x0000 , //unknown(未知)
  103. ELSupportDeviceTypeBlood = 0x0001 , //sphygmomanometer(血压计)
  104. ELSupportDeviceTypeForehead = 0x0002 , //Temperature gun(额温枪)
  105. ELSupportDeviceTypeThermometer = 0x0003 , //thermometer(体温计)
  106. ELSupportDeviceTypeBabyScale = 0x0004 , //Baby scale(婴儿秤)
  107. ELSupportDeviceTypeHeightGauge = 0x0005 , //Height meter(身高仪)
  108. ELSupportDeviceTypeSmartLock = 0x000B , //Smart door lock(智能门锁)
  109. ELSupportDeviceTypeRemoteControl = 0x000C , //Internal projection vision tester(内投影视力检查仪)
  110. ELSupportDeviceTypeWheelMonitor = 0x000D , //TPMS(胎压转接板)
  111. ELSupportDeviceTypeBodyFatScale = 0x000E , //Body fat scale(体脂秤)
  112. ELSupportDeviceTypeSmatLockRemote = 0x0010 , //Smart door lock remote control(智能门锁遥控器)
  113. ELSupportDeviceTypeBLE_WIFIScale = 0x0011 , //Ble and wifi Scale(蓝牙Wifi体脂秤)
  114. ELSupportDeviceTypeBLE_WIFIToothbrush = 0x0012, //Bluetooth and wifi toothbrush(蓝牙wifi牙刷)
  115. ELSupportDeviceTypeBLE_EightScale = 0x0013 , //Eight electrode scale(八电极蓝牙秤)
  116. ELSupportDeviceTypeAnemometer = 0x0014 , //anemometer(风速计),0x0015
  117. ELSupportDeviceTypeClampMeter = 0x0015 , //clamp meter(钳表)
  118. ELSupportDeviceTypeWatch = 0x001D , //华盛达手表
  119. ELSupportDeviceTypeBloodSugar = 0x001C , //blood sugar(血糖仪)
  120. ELSupportDeviceTypeInfThermt = 0x0020 , //Infrared Thermometer(红外测温仪)
  121. ELSupportDeviceTypeOximeter = 0x0021 , //Oximeter (血氧仪)
  122. ELSupportDeviceTypeFaceMask = 0x0022 , //face mask(智能口罩)
  123. ELSupportDeviceTypeCoffeeScale = 0x0024 , //咖啡秤
  124. ELSupportDeviceTypeElectricScooter= 0x0025 , //滑板车
  125. ELSupportDeviceTypeHeightBodyFatScale = 0x0026 , //身高体脂秤
  126. ELSupportDeviceTypeBLEToothbrush = 0x002D, //Bluetooth toothbrush(蓝牙牙刷)
  127. ELSupportDeviceTypeHygrothermograph = 0x002E , //温湿度计
  128. ELSupportDeviceTypeSkip = 0x002F , //跳绳
  129. ELSupportDeviceTypeBroadcastScale = (0xffff +0x01) , //655536 Broadcast body fat scale(AILink广播体脂秤)
  130. ELSupportDeviceTypeBroadcastHeightGauge = (0xffff + 0x03) , //65538 广播身高仪
  131. ELSupportDeviceTypeBroadcastScale_Lingyang = (0xffff +0x16) , //65557 凌阳广播体脂秤
  132. };
  133. //Communication mode(通信模式)
  134. typedef NS_ENUM(NSInteger, ELCommunicationModeType) {
  135. ELCommunicationModeTypeSerialPort = 0, //Serial port mode(串口模式)
  136. ELCommunicationModeTypeI2C = 1, //I2C mode(I2C模式)
  137. ELCommunicationModeTypeSPI = 2, //SPI mode( SPI模式)
  138. };
  139. //Battery charge status (电池充电状态)
  140. typedef NS_ENUM(NSUInteger, ELBatteryChargingState) {
  141. ELBatteryChargingStateDefault = 0x00, //No charging (default)(没有充电(默认))
  142. ELBatteryChargingStateWorking = 0x01, //charging(充电中)
  143. ELBatteryChargingStateComplete = 0x02, //full charge(充满电)
  144. ELBatteryChargingStateException = 0x03, //Abnormal charging(充电异常)
  145. ELBatteryChargingStatePowerLow = 0x04, //Low battery(电量过低)
  146. };
  147. //CID,VID,PID
  148. struct ELDIDStruct {
  149. ELSupportDeviceType deviceType; //CID
  150. int vendorID; //VID
  151. int productID; //PID
  152. };
  153. //Battery charging state and power structur(电池充电状态和电量的结构体)
  154. struct ELBatteryStruct {
  155. ELBatteryChargingState state; //charging(充电状态)
  156. int power; //Electricity(电量)(0—100%)
  157. };
  158. //Connection interval structure(连接间隔时间的结构体)
  159. struct ELConnectIntervalStruct {
  160. int interval; //Connection interval, unit: ms; range: 20-2000(连接间隔,单位:ms;范围:20-2000)
  161. int latency; //Slave delay, value: 0-4(从设备延时,取值:0-4)
  162. int timeout; //Connection timeout, unit: ms; Range: 1000~6000(连接超时,单位:ms; 范围: 1000~6000)
  163. };
  164. struct ELUUIDStruct {
  165. char *serviceUUID; //Service UUID(服务UUID)
  166. char *writeUUID; //For APP to send data to MCU (write)(用于 APP 下发数据到 MCU(write))
  167. char *notifyUUID; //Used for MCU data transfer to APP (notify)(用于 MCU 数据传输到 APP (notify))
  168. };
  169. struct ELAutoSleepTimeStruct {
  170. int sleepTime; //Automatic sleep time, unit: s(自动睡眠时间,单位:s)
  171. int open; //Whether to enable low frequency broadcast after sleep: 0: not open, 1: open(睡眠后是否开启低频广播: 0:不开启 ,1:开启)
  172. int interval; //Low frequency broadcast interval, unit: ms; range 20~2000(低频广播间隔,单位 :ms ;范围 20~2000)
  173. };
  174. //WiFi连接状态
  175. typedef NS_ENUM(NSUInteger, BleWiFiConnectState) {
  176. BleWiFiConnectStateNoWiFi = 0,//0:没有连接,0: No connection
  177. BleWiFiConnectStateConnectFail = 1 ,//1:尝试连接热点,但是失败1: Attempt to connect to the hotspot, but failed
  178. BleWiFiConnectStateNoNetwork = 2 ,//2:连接热点,热点无网络,2: Connected to the hotspot, the hotspot has no network
  179. BleWiFiConnectStateSuccess = 3 ,//3:连接热点,热点有网络,3: Connected to the hotspot, the hotspot has a network
  180. BleWiFiConnectStateNoConnect = 4 ,//4:有热点信息,未连接,4: There is hotspot information, not connected
  181. };
  182. struct ELMCUStateStruct {
  183. int connectState; //Connection status: 0: no connection 1: connected(蓝牙连接状态: 0:无连接 1:已连接 2:配对完成)
  184. BleWiFiConnectState wifiState; //
  185. int workState; //Working status: 0: Wake 1: Go to sleep 2: Module is ready(工作状态: 0:唤醒 1:进入休眠 2:模块准备就绪)
  186. };
  187. #pragma mark - AiLink unit
  188. /** Type key of unit string(单位字符串的type key) */
  189. #define ELDeviceUnitTypeKey @"type"
  190. /** supportUnit key */
  191. #define ELDeviceUnitSupportUnitKey @"supportUnit"
  192. /** Ailink unit */
  193. typedef NS_ENUM(NSInteger, ELDeviceUnitType) {
  194. /** Weight(重量) */
  195. ELDeviceUnitType_Weight = 1 ,
  196. /** length(长度) */
  197. ELDeviceUnitType_Height = 2 ,
  198. /** temperature(温度) */
  199. ELDeviceUnitType_Temperature = 3 ,
  200. /** Pressure(血压) */
  201. ELDeviceUnitType_BloodPressure = 4 ,
  202. /** Tire pressure(轮胎胎压压力) */
  203. ELDeviceUnitType_Pressure = 5 ,
  204. /**Blood sugar(血糖单位)*/
  205. ELDeviceUnitType_BloodSugar = 6 ,
  206. };
  207. #define AiLinkBleWeightUnit_KG_Str @"kg"
  208. #define AiLinkBleWeightUnit_Jin_Str @"斤"
  209. #define AiLinkBleWeightUnit_LB_OZ_Str @"lb:oz"
  210. #define AiLinkBleWeightUnit_OZ_Str @"oz"
  211. #define AiLinkBleWeightUnit_ST_LB_Str @"st:lb"
  212. #define AiLinkBleWeightUnit_G_Str @"g"
  213. #define AiLinkBleWeightUnit_LB_Str @"lb"
  214. #define AiLinkBleWeightUnitStrDic(key) [@{AiLinkBleWeightUnit_KG_Str:@(ELDeviceWeightUnit_KG),AiLinkBleWeightUnit_Jin_Str:@(ELDeviceWeightUnit_JIN),AiLinkBleWeightUnit_LB_OZ_Str:@(ELDeviceWeightUnit_LB_OZ),AiLinkBleWeightUnit_OZ_Str:@(ELDeviceWeightUnit_OZ),AiLinkBleWeightUnit_ST_LB_Str:@(ELDeviceWeightUnit_ST_LB),AiLinkBleWeightUnit_G_Str:@(ELDeviceWeightUnit_G),AiLinkBleWeightUnit_LB_Str:@(ELDeviceWeightUnit_LB)}[key] integerValue]
  215. #define AiLinkBleWeightUnitDic @{@(ELDeviceWeightUnit_KG):AiLinkBleWeightUnit_KG_Str,@(ELDeviceWeightUnit_JIN):AiLinkBleWeightUnit_Jin_Str,@(ELDeviceWeightUnit_LB_OZ):AiLinkBleWeightUnit_LB_OZ_Str,@(ELDeviceWeightUnit_OZ):AiLinkBleWeightUnit_OZ_Str,@(ELDeviceWeightUnit_ST_LB):AiLinkBleWeightUnit_ST_LB_Str,@(ELDeviceWeightUnit_G):AiLinkBleWeightUnit_G_Str,@(ELDeviceWeightUnit_LB):AiLinkBleWeightUnit_LB_Str}
  216. /** AiLink Weight unit(体重单位)*/
  217. typedef NS_ENUM(NSInteger, ELDeviceWeightUnit) {
  218. /** kg */
  219. ELDeviceWeightUnit_KG = 0x00 ,
  220. /** 斤 */
  221. ELDeviceWeightUnit_JIN = 0x01 ,
  222. /** lb:oz */
  223. ELDeviceWeightUnit_LB_OZ = 0x02 ,
  224. /** oz */
  225. ELDeviceWeightUnit_OZ = 0x03 ,
  226. /** st:lb */
  227. ELDeviceWeightUnit_ST_LB = 0x04 ,
  228. /** g */
  229. ELDeviceWeightUnit_G = 0x05 ,
  230. /** lb */
  231. ELDeviceWeightUnit_LB = 0x06 ,
  232. /** Unsupported unit */
  233. ELDeviceWeightUnit_Fail = 0xFF ,
  234. };
  235. #define AiLinkBleHeightUnit_CMStr @"cm"
  236. #define AiLinkBleHeightUnit_InchStr @"inch"
  237. #define AiLinkBleHeightUnit_FeetStr @"feet"
  238. #define AiLinkBleHeightUnitDic @{@(ELDeviceHeightUnit_CM):AiLinkBleHeightUnit_CMStr,@(ELDeviceHeightUnit_Inch):AiLinkBleHeightUnit_InchStr,@(ELDeviceHeightUnit_FT_IN):AiLinkBleHeightUnit_FeetStr}
  239. /** AiLink Length unit(长度单位) */
  240. typedef NS_ENUM(NSInteger, ELDeviceHeightUnit) {
  241. /** cm */
  242. ELDeviceHeightUnit_CM = 0x00 ,
  243. /** inch */
  244. ELDeviceHeightUnit_Inch = 0x01 ,
  245. /** feet:inch */
  246. ELDeviceHeightUnit_FT_IN = 0x02 ,
  247. //
  248. ELDeviceHeightUnit_M = 0x03 ,
  249. /** Unsupported unit */
  250. ELDeviceHeightUnit_Fail = 0xFF ,
  251. };
  252. #define AiLinkBleSpeedUnit_M_S @"m/s"
  253. #define AiLinkBleSpeedUnit_KM_H @"km/h"
  254. #define AiLinkBleSpeedUnit_FT_Min @"ft/min"
  255. #define AiLinkBleSpeedUnit_Knots @"knots"
  256. #define AiLinkBleSpeedUnit_MPH @"MPH"
  257. #define AiLinkBleSpeedUnitDic @{@(ELDeviceSpeedUnit_M_S):AiLinkBleSpeedUnit_M_S,@(ELDeviceSpeedUnit_KM_H):AiLinkBleSpeedUnit_KM_H,@(ELDeviceSpeedUnit_FT_Min):AiLinkBleSpeedUnit_FT_Min,@(ELDeviceSpeedUnit_Knots):AiLinkBleSpeedUnit_Knots,@(ELDeviceSpeedUnit_MPH):AiLinkBleSpeedUnit_MPH}
  258. /** AiLink速度单位 */
  259. typedef NS_ENUM(NSInteger, ELDeviceSpeedUnit) {
  260. /** m/s */
  261. ELDeviceSpeedUnit_M_S = 0x00 ,
  262. /** km/h */
  263. ELDeviceSpeedUnit_KM_H = 0x01 ,
  264. /** ft/min */
  265. ELDeviceSpeedUnit_FT_Min = 0x02 ,
  266. /** knots(节,海里/小时,1节=1海里/小时=1.852公里/小时) */
  267. ELDeviceSpeedUnit_Knots = 0x03 ,
  268. /** MPH(1 迈= 1.609344 千米/小时) */
  269. ELDeviceSpeedUnit_MPH = 0x04 ,
  270. /** Unsupported unit */
  271. ELDeviceSpeedUnit_Fail = 0xFF ,
  272. };
  273. #define AiLinkBleTempUnit_CStr @"℃"
  274. #define AiLinkBleTempUnit_FStr @"℉"
  275. #define AiLinkBleTempUnitDic @{@(ELDeviceTemperatureUnit_C):AiLinkBleTempUnit_CStr,@(ELDeviceTemperatureUnit_F):AiLinkBleTempUnit_FStr}
  276. /** AiLink Temperature unit(温度单位)*/
  277. typedef NS_ENUM(NSInteger, ELDeviceTemperatureUnit) {
  278. /** ℃ */
  279. ELDeviceTemperatureUnit_C = 0x00 ,
  280. /** ℉ */
  281. ELDeviceTemperatureUnit_F = 0x01 ,
  282. /** Unsupported unit */
  283. ELDeviceTemperatureUnit_Fail = 0xFF ,
  284. };
  285. #define AiLinkBloodUnit_mmHgStr @"mmHg"
  286. #define AiLinkBloodUnit_kPaStr @"kPa"
  287. #define AiLinkBloodUnitDic @{\
  288. @(ELDeviceBloodPressureUnit_mmhg):AiLinkBloodUnit_mmHgStr,\
  289. @(ELDeviceBloodPressureUnit_kPa):AiLinkBloodUnit_kPaStr\
  290. }
  291. /** AiLink Blood pressure unit(血压单位) */
  292. typedef NS_ENUM(NSInteger, ELDeviceBloodPressureUnit) {
  293. /** mmhg */
  294. ELDeviceBloodPressureUnit_mmhg = 0x00 ,
  295. /** kPa */
  296. ELDeviceBloodPressureUnit_kPa ,
  297. /** Unsupported unit */
  298. ELDeviceBloodPressureUnit_Fail ,
  299. };
  300. #define AiLinkBlePressureUnit_BarStr @"Bar"
  301. #define AiLinkBlePressureUnit_PsiStr @"Psi"
  302. #define AiLinkBlePressureUnit_KpaStr @"Kpa"
  303. #define AiLinkBlePressureUnitDic @{@(ELDevicePressureUnit_Bar):AiLinkBlePressureUnit_BarStr,@(ELDevicePressureUnit_Psi):AiLinkBlePressureUnit_PsiStr,@(ELDevicePressureUnit_kPa):AiLinkBlePressureUnit_KpaStr}
  304. /** AiLink Tire tire pressure unit(轮胎胎压单位) */
  305. typedef NS_ENUM(NSInteger, ELDevicePressureUnit) {
  306. /** kPa */
  307. ELDevicePressureUnit_kPa = 0x00 ,
  308. /** Psi */
  309. ELDevicePressureUnit_Psi = 0x01 ,
  310. /** Bar */
  311. ELDevicePressureUnit_Bar = 0x02 ,
  312. /** Unsupported unit */
  313. ELDevicePressureUnit_Fail ,
  314. };
  315. #define AiLinkBleBloodSugarUnit_mmolStr @"mmol/L"
  316. #define AiLinkBleBloodSugarUnit_mgStr @"mg/dL"
  317. #define AiLinkBleBloodSugarUnitDic @{@(ELDeviceBloodSugarUnit_mmol_L):AiLinkBleBloodSugarUnit_mmolStr,@(ELDeviceBloodSugarUnit_mg_dL):AiLinkBleBloodSugarUnit_mgStr,}
  318. typedef NS_ENUM(NSUInteger, ELDeviceBloodSugarUnit) {
  319. ELDeviceBloodSugarUnit_mmol_L = 0x01,//mmol/L 毫摩尔/升
  320. ELDeviceBloodSugarUnit_mg_dL = 0x02,//mg/dL 毫克/分升
  321. ELDeviceBloodSugarUnit_Fail ,
  322. };
  323. #pragma mark ============ 枚举 ==============
  324. typedef NS_ENUM(NSUInteger, ELBluetoothState) {
  325. ELBluetoothStateUnavailable, //Bluetooth is not available(蓝牙不可用)
  326. ELBluetoothStateAvailable, //Bluetooth available(蓝牙可用)
  327. ELBluetoothStateStopScan, //Stop scanning(停止扫描)
  328. ELBluetoothStateScaning, //Scanning(正在扫描)
  329. ELBluetoothStateWillConnect, //Will connect(将要连接)
  330. ELBluetoothStateDidConnect, //Already connected(已经连接)
  331. ELBluetoothStateConnectFail, //Connection error(连接出错)
  332. ELBluetoothStateDidDiscoverCharacteristics, //Peripheral feature callback(外设特征回调)
  333. ELBluetoothStateDidDisconnect, //Disconnect(断开连接)
  334. ELBluetoothStateDidValidationPass, //approved(通过验证)
  335. ELBluetoothStateFailedValidation, //Failed verification(未通过验证)
  336. };
  337. //sex(性别)
  338. typedef NS_ENUM(NSUInteger, ELBluetoothUserSex) {
  339. ELBluetoothUserSex_Woman = 0x00,//female(女)
  340. ELBluetoothUserSex_Man = 0x01,//male(男)
  341. };
  342. //设备授权结果
  343. typedef NS_ENUM(NSUInteger, ELBluetoothDeviceAuthorizeResult) {
  344. ELBluetoothDeviceAuthorizeResultNoAuth =0,//No(没有)
  345. ELBluetoothDeviceAuthorizeResultAuthorized ,//Authorized(已经授权)
  346. ELBluetoothDeviceAuthorizeResultNoNeed ,//No authorization required(不需要授权)
  347. ELBluetoothDeviceAuthorizeResultSuccess ,//Authorization succeeded(授权成功)
  348. };
  349. #endif /* ELSDKHeader_h */