//
//  ELThermometerBleManager.h
//  Elink
//
//  Created by 王庭 on 2019/5/28.
//  Copyright © 2019 iot_iMac. All rights reserved.
//

#import "ELBluetoothManager.h"
#import "ELThermometerDeviceModel.h"
#import "ELThermometerBleModel.h"

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger , ThermometerBleDataType) {
    
    /**Stable temperature（ 稳定温度 ）*/
    ThermometerBleDataType_StableData           = 0x01 ,
    /** Real-time temperature（实时温度） */
    ThermometerBleDataType_RealtimeData         = 0x02 ,
    
    /** App release unit settings（app下发单位设置） */
    ThermometerBleDataType_AppSendUnit          = 0x81 ,
    /** The MCU replies to the setting result（MCU回复设置结果） */
    ThermometerBleDataType_BackSendUnit         = 0x82 ,
    
    /** Error code sent on the device（设备上发错误码） */
    ThermometerBleDataType_DeviceBackErrorCode  = 0xFF ,
};

typedef NS_ENUM(NSInteger , ThermometerBleResultType) {
    /** success(设置成功 )*/
    ThermometerBleResultType_Succeed            = 0x01 ,
    /** failure(设置失败) */
    ThermometerBleResultType_Failure                   ,
    /** unsupport(不支持设置) */
    ThermometerBleResultType_Unsupported               ,
};

typedef NS_ENUM(NSInteger , ThermometerBleErrorCode) {
    /** Hyperthermia(体温过高) */
    ThermometerBleErrorCode_Hyperthemia         = 0x00 ,
    /** Hypothermia(体温过低 )*/
    ThermometerBleErrorCode_Hypothermia                ,
    /** error(测量出错) */
    ThermometerBleErrorCode_Failure                    ,
};

@protocol ELThermometerBleDelegate <NSObject>

@optional
/** Callback Bluetooth status(回调蓝牙状态) */
- (void)thermometerManagerUpdateState:(ELBluetoothState )state;

/** Call back all thermometer devices(回调所有体温计设备) */
- (void)thermometerManagerScanDevices:(NSArray<ELThermometerDeviceModel *> *)thermometerDevices;

/** Callback temperature data(回调温度数据) */
- (void)thermometerManagerReceiveModel:(ELThermometerBleModel *)model;

/** Return unit setting result(返回单位设置结果) */
- (void)thermometerManagerSetUnitResults:(ThermometerBleResultType )result;

/** Error code sent on the device(设备上发错误码)*/
- (void)thermometerManagerBackDeviceErrorCode:(ThermometerBleErrorCode )code;


@end

@interface ELThermometerBleManager : ELBluetoothManager


@property (nonatomic,weak) id<ELThermometerBleDelegate> thermometerDelegate;

+ (ELThermometerBleManager *)shareManager;

/** App release unit settings(app下发单位设置 )*/
- (void)changeThermometerUnit:(ELDeviceTemperatureUnit )unit;

@end

NS_ASSUME_NONNULL_END
