//
//  cf680SDK.h
//  cf680SDK
//
//  Created by tommy on 2023/8/28.
//

// https://blog.51cto.com/u_15740864/5542137?articleABtest=0

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

@interface cf680SDK : NSObject

-(void) SetVideoRect:(CGRect)FrameRect viewlay:(CALayer *)layer; //Normal windows.
-(void) SetVideoFullScreenRect:(CGRect) FrameRect;   //full screen windows.
-(void) ShowVideoRect:(Boolean) hidden;             //display or hidden windows.
-(void) SetVideoWindows:(int) mode;                 //display windows mode. 0: Normal windows; 1: full screen windows

//设置抓拍图片保存路径
-(void) SetCapturePath:(char *)foldpath;            //set jpg path;
//手工抓拍一张，制定要保存的文件名称 比如 20240801144020.jpg
-(void) ManualCapture:(char *)filename;             //capture one;

//打开视频
-(int)  StartVideo:(char *) ipaddr;                 //device ip: 192.168.1.1
//关闭视频
-(void) StopVideo;


/*  视频文件保存路径  jpgvideo
  //视频文件名称  20240801143820.mov

 -(NSString *)recordSavedPath:(NSString *) recordName
 {
     NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     NSString *documentPath = [path objectAtIndex:0];
     NSFileManager *fileManager = [NSFileManager defaultManager];
     NSString *imageDocPath = [documentPath stringByAppendingPathComponent:@"jpgvideo"];
    
     [fileManager createDirectoryAtPath:imageDocPath withIntermediateDirectories:YES attributes:nil error:nil];
     NSString * imagePath = [imageDocPath stringByAppendingPathComponent:recordName];
     return imagePath;
 }
 */

//启动录像. 是否推送到相册 0: 不用 1:推送
-(void) JPGStartRecord:(int) savetoalbum;
//停止录像
-(void) JPGStopRecord;


//1 成功. char Version[32]
-(int)GetDeviceVersion:(char *)Version;

//1: 成功 -4 10秒链接超时。-1 错误
//-(int)GetConnectStatus;



//以下函数在设备使用路由模式下使用，一般无用。
-(int)  FindDevice:(char *)ipaddr;
//char ssid[32];
//char pwd[20];
int     getwifiinfo(char* ip,int port,char *ssid,char *pwd);
//mode: 0---switch to AP mode. 1: set route info.  channel: 157/36
int     setwifiinfo(char* ip,int port,int mode,int channel,char *ssid,char *pwd);

@end
