//
//  RDSDeviceCmd.h
//  RuiZhi
//
//  Created by Rayson on 2020/6/12.
//  Copyright © 2020 RDIOT. All rights reserved.
//

#import <Foundation/Foundation.h>


typedef NS_ENUM(NSUInteger, RDSMsgType) {

    MsgDevicePairing = 0x81,// 配对
    MsgModel = 0x82,        // 模式修改
    MsgRecordForNum = 0x83, // 设备记录
    MsgDelRecord = 0x84,    // 删除记录
    //MsgHeartbeat = 0x85,
    
    
    MsgModelReported = 0x86,    // 模式上报
    MsgTempReported = 0x87,     // 记录上报
    
    MsgChangeTempUnit = 0x88,   // 切换温度单位 华氏度摄氏度
    MsgArchiveRecord = 0x89,    // 设备记录个数
    MsgUnbindDevice = 0x8d,     // 解绑设备配对
    
    MsgOtaNotify = 0x10,         // 设备进行固件升级，APP在此期间不需要向设备发送心跳
};

typedef NS_ENUM(NSUInteger, RDSBindStep) {

    Step1 = 0x01,   // 设备等待wifi信息
    Step2 = 0x02,   // 正在连接wifi
    Step3 = 0x03,   // 注册设备中
    Step4 = 0x04,   // 注册房间中
    Step5 = 0x05,   // 配网完成
    
};


@class RDSDeviceReply, RDSTempRecord;

typedef void(^RDSCmdReceiveCmdFinish)(RDSDeviceReply *reply);

@interface RDSDeviceCmd : NSObject

@property (nonatomic, copy) NSString *header;
@property (nonatomic, copy) NSString *leng;
@property (nonatomic, copy) NSString *cmd;
@property (nonatomic, copy) NSString *sn;
@property (nonatomic, copy) NSString *content;
@property (nonatomic, copy) NSString *checksum;

// 接收 解析设备回复
@property (nonatomic, assign) RDSMsgType msgType;
@property (nonatomic, strong) RDSDeviceReply *reply; // 用通知发送

@property (nonatomic, copy) void(^onReceiveCmdFinish)(RDSDeviceReply *reply);

#pragma mark - 给设备发送指令


#pragma mark - 解析接收设备指令
+(void) rds_receiveData:(NSData *)data finish:(RDSCmdReceiveCmdFinish)finish;

@end




@interface RDSDeviceReply : NSObject
@property (nonatomic, strong) NSString *msg;
@property (nonatomic, assign) RDSMsgType msgType;
@property (nonatomic, assign) RDSBindStep bindStep;

@property (nonatomic, assign) int code;



@end






