//
//  ELMeatProbeBoxMultipleBleCmdTool.m
//  Pods
//

#import "ELMeatProbeBoxMultipleBleCmdTool.h"
#import <AILinkBleSDK/ELAILinkBleManager.h>
#import "ELMeatProbeBoxMultipleBleBBQParamModel.h"

@implementation ELMeatProbeBoxMultipleBleCmdTool

//APP获取设备基础信息
+ (NSData *)requestStatus:(ELAILinkBleManager *)manager {
    const Byte cmd = ELMeatProbeBoxMultipleCMDAppGetStatus_Type01;
    Byte payloadBytes[] = { cmd, 0x01 };
    NSData *payloadData = [NSData dataWithBytes:payloadBytes length:sizeof(payloadBytes)];
    [manager sendA7Payload:payloadData];
    return [NSData dataWithBytes:payloadBytes length:sizeof(payloadBytes)];
}

//切换单位
+ (NSData *)switchUnit:(UInt8)unit manager:(ELAILinkBleManager *)manager {
    if (unit > 1) { return nil; }
    const Byte cmd = ELMeatProbeBoxMultipleCCMDAppSwitchUnit_Type03;
    Byte payloadBytes[] = { cmd, unit };
    NSData *payloadData = [NSData dataWithBytes:payloadBytes length:sizeof(payloadBytes)];
    [manager sendA7Payload:payloadData];
    return [NSData dataWithBytes:payloadBytes length:sizeof(payloadBytes)];
}

+ (NSData *)requestParams:(ELAILinkBleManager *)manager {
    const Byte cmd = ELMeatProbeBoxMultipleCMDSetInfo_Type09;
    Byte payloadBytes[] = { cmd, 0x01 };
    NSData *payloadData = [NSData dataWithBytes:payloadBytes length:sizeof(payloadBytes)];
    [manager sendA7Payload:payloadData];
    return [NSData dataWithBytes:payloadBytes length:sizeof(payloadBytes)];
}

+ (NSData *)setupParam:(ELMeatProbeBoxMultipleBleBBQParamModel *)param supportProbe:(UInt8)supportProbe manager:(ELAILinkBleManager *)manager {
    const Byte cmd = ELMeatProbeBoxMultipleCMDSetInfo_Type09;
    Byte payloadBytes[] = { cmd, 0x00, supportProbe };
    NSMutableData *payloadData = [NSMutableData dataWithBytes:payloadBytes length:sizeof(payloadBytes)];
    [payloadData appendData:param.dataValue];
    [manager sendA7Payload:payloadData.copy];
    return [NSData dataWithBytes:payloadBytes length:sizeof(payloadBytes)];
}

+ (void)requestIColornfoWithManager:(ELAILinkBleManager *)manager {
    const Byte read = 0x00;
    Byte payloadBytes[] = { ELMeatProbeBoxMultipleCMDColorInfoRequest_Type0B, read };
    NSData *payloadData = [NSData dataWithBytes:payloadBytes length:sizeof(payloadBytes)];
    [manager sendA7Payload:payloadData.copy];
}

+ (void)requestOTAStatusWithManager:(ELAILinkBleManager *)manager {
    const Byte ELInetGetCmdTypeSpecialFunc = 0x49, op = 0x01;
    Byte payloadBytes[16] = { ELInetGetCmdTypeSpecialFunc, op };
    NSData *payloadData = [NSData dataWithBytes:payloadBytes length:sizeof(payloadBytes)];
    [manager sendA6Payload:payloadData.copy];
}

@end
