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.
150 lines
6.8 KiB
150 lines
6.8 KiB
// |
|
// ECellBLEConst.h |
|
// ECellBluetooth |
|
// |
|
// Created by lemo. on 2019/5/22. |
|
// Copyright © 2019 chentingfeng. All rights reserved. |
|
// |
|
|
|
#ifndef ECellBLEConst_h |
|
#define ECellBLEConst_h |
|
#import <ECellBluetooth/ECellBLEEnum.h> |
|
|
|
#define IsDelegate(delegate,method) delegate != nil && [delegate respondsToSelector:@selector(method)] |
|
#define kNotification [NSNotificationCenter defaultCenter] |
|
/// 蓝牙数据拼接分隔符 |
|
#define DataSeparator @"!@#$" |
|
// 蓝牙指令数据回调Block |
|
typedef void (^ResultBlock)(ECell_BLE_COMMAND_ERROR_TYPE errorType, NSDictionary * _Nullable json); |
|
typedef void (^ResultReportBlock)(ECell_BLE_REPORT_COMMAND reportCmd, NSDictionary * _Nullable json); |
|
typedef void (^ResultCmdBlock)(ECell_BLE_COMMAND_ERROR_TYPE errorType); |
|
typedef void (^ParseCmdResultBlock)(ECell_BLE_COMMAND_PARSE_ERROR_TYPE errorType, NSDictionary * _Nullable result); |
|
|
|
|
|
// 服务UUID |
|
#define kScanServiceUUID @"FBC0" |
|
#define kServiceUUID @"C3E6FBC0-E966-1000-8000-BE99C223DF6A" |
|
// 指令通道 |
|
#define kNotifyCharacteristic @"C3E6FEA2-E966-1000-8000-BE99C223DF6A" |
|
#define kWriteCharacteristic @"C3E6FEA1-E966-1000-8000-BE99C223DF6A" |
|
|
|
#pragma mark - Sandbox |
|
|
|
/** 本地设备信息KEY(连接后自动保存,手动断开删除) */ |
|
#define ECellLocalDeviceInfo @"ECellLocalDeviceInfo" |
|
|
|
#pragma mark - Log |
|
// 默认关闭日志输出 |
|
static BOOL ECellBluetoothReportLoggerIsOpen = NO; |
|
#define ECellLog(...) if (ECellBluetoothReportLoggerIsOpen) NSLog(@"%@\n\n",[NSString stringWithFormat:__VA_ARGS__]) |
|
|
|
#pragma mark - Cmd |
|
|
|
/// 指令码 |
|
typedef NS_ENUM(NSInteger, ECell_BLECMD) { |
|
ECell_BLECMD_firmware = 0x01, |
|
ECell_BLECMD_setUp = 0x02, |
|
ECell_BLECMD_weather = 0x03, |
|
ECell_BLECMD_device = 0x04, |
|
ECell_BLECMD_find = 0x05, |
|
ECell_BLECMD_remind = 0x06, |
|
ECell_BLECMD_heart = 0x09, |
|
ECell_BLECMD_sync = 0x0A, |
|
ECell_BLECMD_factory = 0x0C, |
|
ECell_BLECMD_pushPhone = 0x0D, |
|
ECell_BLECMD_pushDevice = 0x0E, |
|
ECell_BLECMD_adjusting = 0x0F, |
|
ECell_BLECMD_ecg = 0x11, |
|
ECell_BLECMD_temperature = 0x12, |
|
ECell_BLECMD_sendFlash = 0x14, |
|
ECell_BLECMD_dialPush = 0x16 |
|
}; |
|
|
|
/// 指令KEY |
|
typedef NS_ENUM(NSInteger, ECell_BLECMD_KEY) { |
|
// 固件升级命令(Command 0x01) |
|
ECell_BLECMD_KEY_firmwareInfo = 0x12, //!< 固件版本信息 |
|
ECell_BLECMD_KEY_firmwareInfo_return = 0x13,//!< 固件版本信息返回 |
|
ECell_BLECMD_KEY_firmwareUpdate = 0x10, //!< 固件升级启动 0x10 |
|
// 设置命令(Command 0x02) |
|
ECell_BLECMD_KEY_unitSetting = 0x01, //!< 单位设置设置 |
|
ECell_BLECMD_KEY_setIngTime = 0x20, //!< 时间设置 |
|
ECell_BLECMD_KEY_setAlarmClock = 0x21, //!< 闹钟设置 |
|
ECell_BLECMD_KEY_setSportTarget = 0x22, //!< 运动目标设置 |
|
ECell_BLECMD_KEY_setUserInfo = 0x23, //!< 用户信息设置 |
|
ECell_BLECMD_KEY_setTheLost = 0x24, //!< 防丢设置 |
|
ECell_BLECMD_KEY_setSedentary = 0x25, //!< 久坐设置 |
|
ECell_BLECMD_KEY_setSleep = 0x26, //!< 自动睡眠设置 |
|
ECell_BLECMD_KEY_setSystemUser = 0x27, //!< 系统用户设置 |
|
ECell_BLECMD_KEY_setDrinkRemind = 0x28, //!< 喝水提醒设置 |
|
ECell_BLECMD_KEY_setPush = 0x29, //!< 推送设置 |
|
ECell_BLECMD_KEY_readProfile = 0x2E, //!< 读取手环配置请求 |
|
ECell_BLECMD_KEY_readProfile_return = 0x2F,//!< 读取手环配置请求 |
|
ECell_BLECMD_KEY_breathe = 0x30, //!< 呼吸设置 |
|
ECell_BLECMD_KEY_readBraceletSet = 0x2D, //!< 读取手环设置请求 |
|
ECell_BLECMD_KEY_notDisturb = 0x2A, //!< 勿扰模式 |
|
ECell_BLECMD_KEY_remindModel = 0x2B, //!< 提醒模式 |
|
ECell_BLECMD_KEY_heartRateCheck = 0x2C, //!< 心率监测 |
|
// 天气推送(Command 0x03) |
|
ECell_BLECMD_KEY_weatherPush = 0x30, //!< 天气推送 |
|
ECell_BLECMD_KEY_ultravioletPush = 0x31, //!< 紫外线推送 |
|
ECell_BLECMD_KEY_airPressurePush = 0x33, //!< 气压推送 |
|
ECell_BLECMD_KEY_altitudePush = 0x35, //!< 海拔推送 |
|
// 设备命令(Command 0x04) |
|
ECell_BLECMD_KEY_battery = 0x40, //!< 设备电量 |
|
ECell_BLECMD_KEY_battery_return = 0x41, //!< 设备电量返回 |
|
ECell_BLECMD_KEY_unbinding = 0x42, //!< 解除绑定 |
|
ECell_BLECMD_KEY_binding = 0x44, //!< 设备绑定 |
|
ECell_BLECMD_KEY_camera = 0x46, //!< 拍照控制 |
|
ECell_BLECMD_KEY_camera_return = 0x47, //!< 拍照控制返回 |
|
ECell_BLECMD_KEY_camera_preview = 0x48, //!< 拍照预览请求 |
|
ECell_BLECMD_KEY_camera_preview_return = 0x49,//!< 拍照预览请求返回 |
|
ECell_BLECMD_KEY_relationDisplay = 0x4B, //!< 横竖显示 |
|
ECell_BLECMD_KEY_handUp = 0x4A, /// 抬手亮屏 |
|
// 查找命令(Command 0x05) |
|
ECell_BLECMD_KEY_findDevice = 0x50, //!< 查找设备 |
|
ECell_BLECMD_KEY_findPhone = 0x51, //!< 查找手机 |
|
// 提醒命令(Command 0x06) |
|
ECell_BLECMD_KEY_remindSwitch = 0x60, //!< 提醒开关 |
|
// 心率命令(Command 0x09) |
|
|
|
// 同步命令(Command 0x0A) |
|
ECell_BLECMD_KEY_syncHealth = 0xA0, //!< 同步健康数据指令 |
|
ECell_BLECMD_KEY_syncBack = 0xA1, //!< 同步健康返回 0xA1 |
|
ECell_BLECMD_KEY_sleep_return = 0xA2, //!< 睡眠数据 |
|
ECell_BLECMD_KEY_step_return = 0xA3, //!< 计步数据 |
|
ECell_BLECMD_KEY_heartRate_return = 0xA4, //!< 心率数据 |
|
ECell_BLECMD_KEY_sport_return = 0xA5, //!< 运动模式数据返回 |
|
ECell_BLECMD_KEY_bloodPressure_return = 0xA6,//!< 血压数据返回 |
|
ECell_BLECMD_KEY_bloodOxygen_return = 0xA7,//!< 血氧数据返回 |
|
ECell_BLECMD_KEY_ECG_return = 0xA9, //!< 心电数据返回 |
|
ECell_BLECMD_KEY_realTimesync = 0xB0, //!< 同步实时数据 |
|
ECell_BLECMD_KEY_realStep = 0xB3, //!< 实时计步数据 |
|
ECell_BLECMD_KEY_realHeartRate = 0xB4, //!< 实时心率数据 |
|
|
|
ECell_BLECMD_KEY_realBloodPressure = 0xB6, //!< 实时血压数据返回 |
|
ECell_BLECMD_KEY_realBloodOxygen = 0xB7, //!< 实时血氧数据返回 |
|
ECell_BLECMD_KEY_realTiwen_return = 0xB8, //!<实时体温数据返回 |
|
ECell_BLECMD_KEY_realECG_return = 0xB9, //!<实时体温数据返回 |
|
// 工厂命令(Command 0x0C) |
|
|
|
// 推送数据到手机(Command 0x0D) |
|
|
|
// 推送数据到设备(Command 0x0E) |
|
ECell_BLECMD_KEY_weatherIndex = 0xE1, //!< 气象指数推送 0xE1 |
|
|
|
// 校准命令(Command 0xa0F) |
|
|
|
// 体温命令(Command 0x12) |
|
|
|
// 发送FLASH数据命令(Command 0x14) |
|
ECell_BLECMD_KEY_falshSend = 0x03, //!< FLASH数据发送 |
|
// 表盘推送(Command 0x16) |
|
ECell_BLECMD_KEY_dialPush = 0x05, //!< 推送表盘 0x05 |
|
|
|
ECell_BLECMD_KEY_restoreFactory = 0xC7, //!< 恢复出厂 0xC7 |
|
}; |
|
|
|
|
|
|
|
#endif /* ECellBLEConst_h */
|
|
|