//
//  EZIoTDevControlManager.h
//  EZIoTBluetoothSDK
//
//  Created by yuqian on 2021/12/8.
//

#import <Foundation/Foundation.h>
#import "EZIoTBLECommonDefine.h"
#import "EZIoTFeatureLiteConfigParam.h"

NS_ASSUME_NONNULL_BEGIN

@class EZIoTPeripheral,EZIoTBlePropsFeatureInfo;

@interface EZIoTDevControlManager : NSObject

#pragma mark - OTAP

- (int)setPropFeature:(EZIoTPeripheral *)p
          configParam:(EZIoTFeatureLiteConfigParam *)configParam
           completion:(EZIoTBLEDevControlFeatureSetBlock)completion;

- (int)getPropFeature:(EZIoTPeripheral *)p
               configParam:(NSArray <EZIoTFeatureLiteConfigParam *> *)configParam
                completion:(EZIoTBLEDevControlFeatureGetBlock)completion;

- (int) setActionFeature:(EZIoTPeripheral *)p
             configParam:(EZIoTFeatureLiteConfigParam *)configParam
              completion:(EZIoTBLEDevControlFeatureSetBlock)completion;

- (void)sendOperationResult:(EZIoTPeripheral *)p
                         seqNum:(NSUInteger)seqNum
                        cmdType:(NSUInteger)cmdType
                           code:(NSInteger)code
                            msg:(NSString *)msg;

- (int)sendTransparentData:(EZIoTPeripheral *)p
                   content:(NSData *)data
                completion:(EZIoTBLEUniversalSetResultBlock)completion;

- (int)sendTransparentNOAuthWithData:(EZIoTPeripheral *)p
                           content:(NSData *)data
                        completion:(EZIoTBLEUniversalSetResultBlock)completion;

- (int)sendTransparentMessage:(EZIoTPeripheral *)p
                      content:(NSData *)data
                   completion:(EZIoTBLEUniversalSetResultBlock)completion;

- (void)getBatchHistoryEventsData:(EZIoTPeripheral *)p;

- (void)getFullDevPropertiesData:(EZIoTPeripheral *)p;

#pragma mark - WiFi Info

- (void)getWiFiConfigData:(EZIoTPeripheral *)p
                     ssid:(NSString *)ssid
                 password:(NSString *)password
              encryptType:(NSUInteger)encryptType
              countryCode:(NSString *)countryCode
                      lbs:(NSString *)lbs
                    token:(NSString *)token
                    bssid:(NSString *)bssid
               completion:(EZIoTBLEUniversalSetResultBlock)completion;

/// 设置主备网络接口
/// - Parameters:
///   - p: 蓝牙设备
///   - ssid: Wi-Fi名称
///   - password: 密码
///   - encryptType: 加密类型
///   - countryCode: 国家从的
///   - lbs: lbs
///   - token: token
///   - bssid: bssid
///   - priorityType: 类型：0主网络，1备网络
///   - completion: 完成回调
- (void)getWiFiConfigData:(EZIoTPeripheral *)p
                     ssid:(NSString *)ssid
                 password:(NSString *)password
              encryptType:(NSUInteger)encryptType
              countryCode:(NSString *)countryCode
                      lbs:(NSString *)lbs
                    token:(NSString *)token
                    bssid:(NSString *)bssid
             priorityType:(NSUInteger)priorityType
               completion:(EZIoTBLEUniversalSetResultBlock)completion;

- (void)getWiFiListData:(EZIoTPeripheral *)p completion:(EZIoTBLEUniversalArrayResultBlock)completion;

/// 获取设备AP热点信息
- (void)getDevWifiInfo:(EZIoTPeripheral *)p
            completion:(EZIoTBLEUniversalGETResultBlock)completion;

/// 注册功能点推送
/// - Parameter callback: 回调
- (void)registerFeatureListener:(EZIoTBLEDevControlFeatureReportBlock __nullable)callback;

#pragma mark - Dev Debug & Log

/// 日志设置
/// @param isOn 日志记录开关：0 表示关闭，1 表示打开
/// @param logLevel 日志等级调整：低于且等于设定等级的日志，进行记录
/// 0 ASSERT
/// 1 ERROR
/// 2 WARNNING 3 INFO 4 DEBUG 5 VERBOSE
- (void)setDebugLog:(EZIoTPeripheral *)p
                   isOn:(BOOL)isOn
               logLevel:(uint8_t)logLevel
             completion:(EZIoTBLEUniversalSetResultBlock)completion;

/// 日志拉取
/// @param logNums 拉取日志条数。0-所有日志。
- (void)fetchDevLog:(EZIoTPeripheral *)p
            logNums:(NSUInteger)logNums
         completion:(EZIoTBLEFetchDevlogBlock)completion;

#pragma mark - Handelr

- (int) devControlHanler:(EZIoTPeripheral *)p
                  cmdType:(int)cmdType
                    value:(NSData *)value
              needPackage:(BOOL)needPackage;

@end

NS_ASSUME_NONNULL_END

