// // DBDevices.h // CareRingApp // // Created by Linktop on 2022/6/7. // 绑定设备表 #import #import "SRDeviceInfo.h" NS_ASSUME_NONNULL_BEGIN @class DeviceOtherInfo; typedef NS_ENUM(NSInteger, DBDEVICE_CHARGE_TYPE) { CHARGE_UNKNOW = -1, // Charging type not obtained CHARGE_MA = 0, // Magnetic charging CHARGE_WILESS = 1, // Wireless charging CHARGE_NFC = 2, // NFC charging }; typedef NS_ENUM(NSUInteger, RING_PROJECT_ID) { PROJ_NOT_SUPPORT = 0, //Older device versions do not support this parameter PROJ_SR03 = 0x10, PROJ_SRO9W = 0x20 , PROJ_SRO9N = 0x21 , PROJ_SR01A = 0x22 , PROJ_SR23_NFC = 0x30 , PROJ_SR26 = 0x40 , }; @interface DBDevices : NSObject @property(assign, nonatomic)NSNumber *cId; // unique index @property(strong, nonatomic)NSString *macAddress; // Bluetooth peripheral mac address @property(strong, nonatomic)DeviceOtherInfo *otherInfo; // Other information about the device /// Query all DBDevices instances saved locally /// - Parameter cmpBlk: return result +(void)queryAllByCpmplete:(void(^)(NSMutableArray *results))cmpBlk; /// Save a new binded device record locally /// - Parameter complete: return result -(void)insert:(void(^)(BOOL succ))complete; /// Update other information of the device saved locally /// - Parameter complete: return result -(void)updateOtherInfo:(void(^)(BOOL succ))complete; /// delete binded device,All data associated with the mac address of this device will /// be cleared. /// - Parameter cmpBlk: call back -(void)deleteFromTable:(void (^)(void))cmpBlk; /// Select ota parameters /// - Parameter blk: call back. cat:Used to query firmware package information.If it is nil, an error has occurred. -(void)chooseOTAugument:(void(^)(NSString * _Nullable cat))blk; @end @interface DeviceOtherInfo :NSObject @property(assign, nonatomic)DEV_COLOR color; // ring's color @property(assign, nonatomic)NSInteger size; // ring's size @property(strong, nonatomic)NSString *sn, *fireWareVersion;// sn=serial number, fireWareVersion=Device firmware version number @property(assign, nonatomic)MAIN_CHIP_TYPE mainChipType; // 主芯片型号 @property(assign, nonatomic)NSUInteger deviceGeneration; // 迭代版本 @property(assign, nonatomic)BOOL isSupportSportMode; @property(assign, nonatomic)DBDEVICE_CHARGE_TYPE chargeType; @property(assign, nonatomic)BOOL isSupportEcg; @property(assign, nonatomic)RING_PROJECT_ID projectId;// Distinguish the model of the ring /// Convert to a.b.c format -(NSString *)transFirmVersionToRemoteType; @end NS_ASSUME_NONNULL_END