#ifndef _HIK_NET_SDK_H_
#define _HIK_NET_SDK_H_

#if defined(_WIN32) || defined(_WIN64)

#if (defined HK_NET_LIBRARY)
#define HK_NET_API __declspec(dllexport) bool __stdcall
#else
#define HK_NET_API __declspec(dllimport) bool __stdcall
#endif

#define CALLBACK __stdcall

#else

#define HK_NET_API bool
#define CALLBACK

#endif

#ifdef __cplusplus
extern "C"
{
#endif

#ifndef _HK_DEFINE_HKHANDLE_
#define _HK_DEFINE_HKHANDLE_
	typedef void *HKHANDLE;
	typedef void **PHKHANDLE;
#endif

#ifndef _HK_DEVICE_TYPE_DEF_
#define _HK_DEVICE_TYPE_DEF_
    enum {
        DEVICE_TYPE_HKDQ = 0,
        DEVICE_TYPE_HIKVISION = 1, //暂未支持

        DEVICE_TYPE_MAX,
    };
#endif

#ifndef _HK_SSADP_INFO_DEF_
#define _HK_SSADP_INFO_DEF_
	typedef struct tagSADPInfo
	{
        int             i_type;
        char			sseries[64];
		char			szSerialNO[64];
		char			szMac[64];
		char			szIPv4[64];
		char			szSubnetMask[64];
		char			szSoftVersion[64];
		char			szDSPVersion[64];
        char            szRelevanceSerialNo[64];
        char            szGateWay[64];
        int             i_dhcp;
    }SSADPINFO, *PSSADPINFO;
#endif

#ifndef _HK_DISCOVERY_DEVICE_CB_FUNC_DEF_
#define _HK_DISCOVERY_DEVICE_CB_FUNC_DEF_
    typedef bool(CALLBACK *DISCOVERY_DEVICE_CB_FUNC)(SSADPINFO st_dev_info, void *p_user_data);
#endif

	//广播发现接口
    HK_NET_API hk_discovery_init(PHKHANDLE p_h, DISCOVERY_DEVICE_CB_FUNC p_func, void *p_user);
    HK_NET_API hk_discovery_send_inquiry(HKHANDLE h);
    HK_NET_API hk_discovery_stop(PHKHANDLE p_h);

    HK_NET_API hk_discovery_modify_ip(HKHANDLE h, const char *pc_src_ip, const char *pc_passwd, bool b_dhcp, const char *pc_ip, const char *pc_netmask, const char *pc_gateway, const char *pc_dns1, const char *pc_dns2);

	//总的初始化与反初始化接口,无论设备多少只调用一次
    HK_NET_API hk_net_sdk_init(const char *pc_path);//"/usr/local/HKNetDeviceSDK"
	HK_NET_API hk_net_sdk_uninit();

    enum{
        STREAM_TYPE_MAIN = 0,
        STREAM_TYPE_SUB = 1,

        STREAM_TYPE_MAX,
    };

#ifndef _HK_REALTIME_VIDEO_CB_FUNC_DEF_
#define _HK_REALTIME_VIDEO_CB_FUNC_DEF_
    typedef bool(CALLBACK *REALTIME_VIDEO_CB_FUNC)(unsigned int ui_channel_no, unsigned int ui_type, unsigned char *puc_data, unsigned int ui_len, void *p_user_data);
#endif

#ifndef _HK_REALTIME_TEMPERATURE_INFO_DEF_
#define _HK_REALTIME_TEMPERATURE_INFO_DEF_
    struct HK_STREAM_FRAME_INFO_S
    {
        unsigned int ui_magic_no;
        unsigned int ui_header_size;//结构体长度
        unsigned int ui_stream_type;//0-h264,1-h265,2-jpeg,3-aud,4-meta,5-update,6-rtdata
        unsigned int ui_stream_len;//数据长度

        //rt data info
        unsigned int ui_rt_data_type;//1-14bit裸数据,2-全屏测温结果数据,3-YUV数据
        unsigned int ui_frame_no;
        unsigned int ui_std_stamp;//DSP相对时间戳
        unsigned short us_year;
        unsigned short us_month;
        unsigned short us_dayofweek;//0-周日，6-周六
        unsigned short us_day;
        unsigned short us_hour;
        unsigned short us_minute;
        unsigned short us_second;
        unsigned short us_millisecond;
        unsigned int ui_width;
        unsigned int ui_height;
        unsigned int ui_len;
        unsigned int ui_fps;
        unsigned int ui_chan;

        //fs support info
        unsigned int ui_tm_data_mode;//4字节 or 2字节
        unsigned int ui_tm_scale;//测温缩放比例
        unsigned int ui_tm_offset;//测温偏移量
        unsigned int ui_tm_res;

        unsigned int ui_res[12];
        unsigned int uc_crc_val;//crc校验码
    };
#endif

#ifndef _HK_REALTIME_TEMPERATURE_STREAM_CB_FUNC_DEF_
#define _HK_REALTIME_TEMPERATURE_STREAM_CB_FUNC_DEF_
    typedef bool(CALLBACK *REALTIME_TEMPERATURE_STREAM_CB_FUNC)(HK_STREAM_FRAME_INFO_S st_frame_info, unsigned char *puc_data, void *p_user_data);
#endif

	//设备操作相关接口
	//初始化，反初始化
    HK_NET_API hk_net_dev_init(PHKHANDLE p_h);	

    //指定初始化，不用再调用以下接口
    //hk_net_dev_login
    //hk_net_dev_set_realplay_callback
    //hk_net_dev_start_realplay
    //hk_net_dev_set_temperature_stream_callback
    //hk_net_dev_start_temperature_stream_realplay
    HK_NET_API hk_net_dev_init_ex(PHKHANDLE p_h, int i_type, const char *pc_ip, unsigned int port, const char *pc_mac, const char *pc_sn, const char *pc_user, const char *pc_pwd,
                                  REALTIME_VIDEO_CB_FUNC p_vs_func, void *p_vs_user, REALTIME_TEMPERATURE_STREAM_CB_FUNC p_ts_func, void *p_ts_user );

    HK_NET_API hk_net_dev_uninit(PHKHANDLE p_h);

#ifndef _HK_EXCEPTION_CB_FUNC_DEF_
#define _HK_EXCEPTION_CB_FUNC_DEF_
    //ui_type: 1-网络预览异常, 2-预览时重连, 3-预览时重连成功
    typedef bool(CALLBACK *EXCEPTION_CB_FUNC)(unsigned int ui_type, unsigned int lhandle, void *p_user_data);
#endif
	HK_NET_API hk_net_dev_set_exception_callback(HKHANDLE h, EXCEPTION_CB_FUNC p_func, void *p_user);

	//登陆登出接口
    HK_NET_API hk_net_dev_login(HKHANDLE h, int i_type, const char *pc_ip, unsigned int port, const char *pc_mac, const char *pc_sn, const char *pc_user, const char *pc_pwd);
    HK_NET_API hk_net_dev_login_nvr(HKHANDLE h, const char *pc_ip, unsigned int port, const char *pc_mac, const char *pc_sn, const char *pc_user, const char *pc_pwd);
	HK_NET_API hk_net_dev_logout(HKHANDLE h);
    HK_NET_API hk_net_dev_get_sn(HKHANDLE h, char *pc_sn, int *ui_len);

    HK_NET_API hk_net_dev_get_cfg_version(HKHANDLE h, char pc_dev_type[64], char pc_software_version[64], char pc_system_version[64], char pc_hardware_version[64]);

    //IP设置
    HK_NET_API hk_net_dev_set_ip(HKHANDLE h, bool b_dhcp, char *pc_ip, char *pc_netmask, char *pc_gateway, char *pc_dns1, char *pc_dns2);
    HK_NET_API hk_net_dev_get_ip(HKHANDLE h, bool *b_dhcp, char *pc_ip, char *pc_netmask, char *pc_gateway, char *pc_dns1, char *pc_dns2);
    //重启
    HK_NET_API hk_net_dev_reboot(HKHANDLE h);

    //时间设置
    HK_NET_API hk_net_dev_set_time(HKHANDLE h, unsigned int ui_year, unsigned int ui_month, unsigned int ui_day, unsigned int ui_hour, unsigned int ui_mintue, unsigned int ui_second);

#ifndef _HK_VIDEO_RESOLUTION_INFO_DEF_
#define _HK_VIDEO_RESOLUTION_INFO_DEF_
    struct video_resolution{
        unsigned short us_width;
        unsigned short us_height;
    };
#endif
    //支持的分辨率列表
    HK_NET_API hk_net_dev_get_support_resolutions(HKHANDLE h, unsigned int channel, int i_stream_type, struct video_resolution result[10], int *p_num);//i_stream_type: STREAM_TYPE_MAIN/STREAM_TYPE_SUB
    //分辨率设置
    HK_NET_API hk_net_dev_set_resolution(HKHANDLE h, unsigned int channel, int i_stream_type, unsigned short us_width, unsigned short us_height);//i_stream_type: STREAM_TYPE_MAIN/STREAM_TYPE_SUB
    //主码流分辨率获取
    HK_NET_API hk_net_dev_get_resolution(HKHANDLE h, unsigned int channel, unsigned short *pus_width, unsigned short *pus_height);
    HK_NET_API hk_net_dev_get_channel_num(HKHANDLE h, unsigned int *pui_channel_num, unsigned int *pui_start_channel_num, unsigned int *pui_ip_channel_num, unsigned int *pui_start_ip_channel_num);

    //获取温度矩阵宽高
    HK_NET_API hk_net_dev_get_temperature_resolution(HKHANDLE h, unsigned short *pus_width, unsigned short *pus_height);

	//获取红外/可见光实时图像
	HK_NET_API hk_net_dev_set_realplay_callback(HKHANDLE h, REALTIME_VIDEO_CB_FUNC p_func, void *p_user);
    HK_NET_API hk_net_dev_start_realplay(HKHANDLE h, unsigned int ui_channel_no, int i_stream_type);//i_stream_type: STREAM_TYPE_MAIN/STREAM_TYPE_SUB
    HK_NET_API hk_net_dev_stop_transferdata(HKHANDLE h, unsigned int ui_channel_no);
    HK_NET_API hk_net_dev_stop_realplay(HKHANDLE h, unsigned int ui_channel_no);

#ifndef _HK_REALTIME_TEMPERATURE_RULE_DEF_
#define _HK_REALTIME_TEMPERATURE_RULE_DEF_
	struct STRU_ANA_INFO {
        char pc_ana[64];
	};
#endif

#ifndef _HK_LOCAL_TEMPERATURE_INFO_DEF_
#define _HK_LOCAL_TEMPERATURE_INFO_DEF_
	typedef struct STRU_TEMPERTURE_INFO
	{
		int iType; //0, point, 1 rect,  2 line
		float fMax;
		int fMaxX;
		int fMaxY;

		float fMin;
		int fMinX;
		int fMinY;

		float fAvg;

		float fTemp; //iType point
		int fX; //iType point
		int fY; //iType point

		STRU_TEMPERTURE_INFO()
		{
			iType = -1;
			fMax = 0;
			fMaxX = 0;
			fMaxY = 0;
			fMin = 0;
			fMinX = 0;
			fMinY = 0;
			fAvg = 0;
			fTemp = 0;
			fX = 0;
			fY = 0;
		}
    }LOCAL_TEMPERATURE_INFO;
#endif

	//实时分析及温度相关接口
#ifndef _HK_REALTIME_TEMPERATURE_RULE_CB_FUNC_DEF_
#define _HK_REALTIME_TEMPERATURE_RULE_CB_FUNC_DEF_
    typedef bool(CALLBACK *REALTIME_TEMPERATURE_RULE_CB_FUNC)(const char *pc_ana, LOCAL_TEMPERATURE_INFO local_info, void *p_user_data);
#endif

    //设置测温分析,此接口需hk_net_dev_start_temperature_stream_realplay接口调用成功并获取到回调数据后再调用,规则不会存储到设备中
    HK_NET_API hk_net_dev_set_temperature_rule(HKHANDLE h, unsigned short us_width, unsigned short us_height, STRU_ANA_INFO *pv_ana_info, unsigned int ui_cnt);
    //HK_NET_API hk_net_dev_set_temperature_callback(HKHANDLE h, REALTIME_TEMPERATURE_RULE_CB_FUNC p_func, void *p_user);

	//抓图
	HK_NET_API hk_net_dev_capture_ir_jpg(HKHANDLE h, char *pc_name);
	HK_NET_API hk_net_dev_capture_vi_jpg(HKHANDLE h, char *pc_name);
    HK_NET_API hk_net_dev_capture_temperature_data(HKHANDLE h, char *puc_temperature_data, unsigned int *pui_temp_len);

    //pc_data, 14位时间,例："20210802151515"
    HK_NET_API hk_net_dev_save_ir_to_national_grid_image(HKHANDLE h, const char *pc_date, char *puc_ir_data, unsigned int ui_ir_len, const char *pc_file);
    HK_NET_API hk_net_dev_append_temperature_to_national_grid_image(HKHANDLE h, const char *pc_date, const char *pc_file);    

    //实时温度流
    HK_NET_API hk_net_dev_set_temperature_stream_callback(HKHANDLE h, REALTIME_TEMPERATURE_STREAM_CB_FUNC p_func, void *p_user);
    HK_NET_API hk_net_dev_start_temperature_stream_realplay(HKHANDLE h);
    HK_NET_API hk_net_dev_stop_temperature_stream_realplay(HKHANDLE h);

    HK_NET_API hk_net_dev_record_realdata(HKHANDLE h, unsigned int ui_channel, const char *pc_file);
    HK_NET_API hk_net_dev_stop_record_realdata(HKHANDLE h, unsigned int ui_channel);

    enum{
        PALETTE_IRON2 = 0,//铁红2
        PALETTE_BLACKHOT = 1,//黑热
        PALETTE_WHITEHOT = 2,//白热
        PALETTE_RAINBOW = 3,//彩虹
        PALETTE_MAX = 4,
    };
    //调色板设置
    HK_NET_API hk_net_dev_set_palette(HKHANDLE h, int i_palette);
    HK_NET_API hk_net_dev_get_palette(HKHANDLE h, int *pi_palette);    

    //基础参数配置,距离单位米
    HK_NET_API hk_net_dev_get_thermometry_basic_config(HKHANDLE h, float *pf_emiss, float *pf_dist);
    HK_NET_API hk_net_dev_thermometry_basic_config(HKHANDLE h, float f_emiss, float f_dist);

    HK_NET_API hk_net_dev_get_all_temperature_paras(HKHANDLE h, float *pf_emiss, float *pf_dist, float *pf_env_temp, float *pf_hum);
    HK_NET_API hk_net_dev_set_all_temperature_paras(HKHANDLE h, float f_emiss, float f_dist, float f_env_temp, float f_hum);

#ifndef _HK_ANA_TEMPERATURE_DEF_
#define _HK_ANA_TEMPERATURE_DEF_
    struct STRU_ANA_TEMPERATURE{
        float fp_max;
        unsigned short us_max_x;
        unsigned short us_max_y;

        float fp_min;
        unsigned short us_min_x;
        unsigned short us_min_y;

        float fp_avg;
    };
#endif
    HK_NET_API hk_net_dev_capture_one_frame(HKHANDLE h);
    HK_NET_API hk_net_dev_get_max_temperature(HKHANDLE h, float *fp_max, unsigned short *us_max_x, unsigned short *us_max_y);
    HK_NET_API hk_net_dev_get_min_temperature(HKHANDLE h, float *fp_min, unsigned short *us_min_x, unsigned short *us_min_y);
    HK_NET_API hk_net_dev_get_avg_temperature(HKHANDLE h, float *fp_avg);
    HK_NET_API hk_net_dev_get_temperature_from_ana(HKHANDLE h, const char *pc_ana, struct STRU_ANA_TEMPERATURE *temperature );

    //测温规则设置,会存储到设备中
    //pc_rules: R01:1,1;10,10;-L02:2,2;10,10;-P03:5,5;-
    HK_NET_API hk_net_dev_del_preset_temperature_rules(HKHANDLE h, unsigned int ui_preset_no);
    HK_NET_API hk_net_dev_set_preset_temperature_rules(HKHANDLE h, unsigned int ui_preset_no, float pf_emiss, float pf_dist, const char *pc_rules, unsigned int ui_rules_len);
    HK_NET_API hk_net_dev_get_preset_temperature_rules(HKHANDLE h, unsigned int ui_preset_no, float *pf_emiss, float *pf_dist, char *pc_rules, unsigned int *pui_rules_len);

    //报警规则设置,会存储到设备中,报警条件的温度均按摄氏度计算,调用相关接口时先调用hk_net_dev_set_temperature_unit将测温单位切换为摄氏度。
    //pc_rules:R01:Max>10;P02:Min<5;P03:Avg>10;
    HK_NET_API hk_net_dev_del_preset_temperature_alarm_rules(HKHANDLE h, unsigned int ui_preset_id);
    HK_NET_API hk_net_dev_set_preset_temperature_alarm_rules(HKHANDLE h, unsigned int ui_preset_id, char *pc_rules, unsigned int ui_lens);
    HK_NET_API hk_net_dev_get_preset_temperature_alarm_rules(HKHANDLE h, unsigned int ui_preset_id, char *pc_rules, unsigned int *pui_lens);

    //区域报警规则设置,会存储到设备中
    HK_NET_API hk_net_dev_del_preset_diff_temperature_alarm_rules(HKHANDLE h, unsigned int ui_preset_id);
    HK_NET_API hk_net_dev_set_preset_diff_temperature_alarm_rules(HKHANDLE h, unsigned int ui_preset_id, char *pc_rules, unsigned int ui_lens);
    HK_NET_API hk_net_dev_get_preset_diff_temperature_alarm_rules(HKHANDLE h, unsigned int ui_preset_id, char *pc_rules, unsigned int *pui_lens);

    //自动切换测温档相关接口
#ifndef _HK_NET_MEAS_RANGE_
#define _HK_NET_MEAS_RANGE_
    struct HK_NET_MEAS_RANGE{
        unsigned char uc_range_type;
        float f_range_min;
        float f_range_max;
    };
#endif
    HK_NET_API hk_net_dev_get_temperature_meas_range(HKHANDLE h, unsigned int *pui_cnt, struct HK_NET_MEAS_RANGE *pst_range);
    HK_NET_API hk_net_dev_get_curr_temperature_meas_range(HKHANDLE h, unsigned int *ui_meas_range, float *f_range_min, float *f_range_max);
    HK_NET_API hk_net_dev_set_temperature_meas_range(HKHANDLE h, unsigned int ui_meas_range);

    HK_NET_API hk_net_dev_is_support_auto_change_meas(HKHANDLE h, bool *pb_auto_meas_range);
    HK_NET_API hk_net_dev_is_auto_temperature_meas_range(HKHANDLE h, bool *pb_auto_meas_range);
    HK_NET_API hk_net_dev_set_auto_temperature_meas_range(HKHANDLE h, bool b_auto_meas_range);

    //设置与获取测温单位
#ifndef _HK_NET_TEMPERTATURE_UNIT_
#define _HK_NET_TEMPERTATURE_UNIT_
    enum {
        TEMPERATURE_UNIT_CELSIUS = 0,//摄氏度
        TEMPERATURE_UNIT_FAHRENHEIT,//华氏度

        TEMPERATURE_UNIT_MAX,
    };
#endif
    HK_NET_API hk_net_dev_set_temperature_unit(HKHANDLE h, int e_type);
    HK_NET_API hk_net_dev_get_temperature_unit(HKHANDLE h, int* pe_type);

    //视频叠加温度配置,会存储到设备中
    HK_NET_API hk_net_dev_set_video_overlay_temperature_info(HKHANDLE h, bool b_enable);
    HK_NET_API hk_net_dev_get_video_overlay_temperature_info(HKHANDLE h, bool *pb_enable);    

#ifndef _HK_OSD_CONFIG_
#define _HK_OSD_CONFIG_
    struct STRU_OSD_CONFIG{
        unsigned char uc_show_chan;//0:不显示, 1:显示
        unsigned char puc_chan_name[32];
        unsigned short us_chan_name_x;
        unsigned short us_chan_name_y;

        unsigned char uc_show_time;//0:不显示, 1:显示
        unsigned short us_time_x;
        unsigned short us_time_y;
        unsigned char uc_time_type;//0: XXXX-XX-XX 年月日, 1: XX-XX-XXXX 月日年, 2: XXXX年XX月XX日, 3: XX月XX日XXXX年, 4: XX-XX-XXXX 日月年, 5: XX日XX月XXXX年, 6: xx/xx/xxxx(月/日/年), 7: xxxx/xx/xx(年/月/日),8: xx/xx/xxxx(日/月/年)
        unsigned char uc_show_week;//是否显示星期 0:不显示, 1:显示
        unsigned char uc_time_attrib;// 1: 透明，闪烁, 2, 透明，不闪烁, 3: 不透明，闪烁, 4: 不透明，不闪烁
        unsigned char uc_time_hour_type;//OSD小时制:0-24小时制,1-12小时制
    };
#endif

    HK_NET_API hk_net_dev_get_osd(HKHANDLE h, unsigned int ui_channel_no, STRU_OSD_CONFIG &st_config);
    HK_NET_API hk_net_dev_set_osd(HKHANDLE h, unsigned int ui_channel_no, STRU_OSD_CONFIG st_config);

    //调焦-
    HK_NET_API hk_net_dev_zoom_in(HKHANDLE h, unsigned int ui_channel_no, int i_stop);
    //调焦+
    HK_NET_API hk_net_dev_zoom_out(HKHANDLE h, unsigned int ui_channel_no, int i_stop);
    //聚焦-
    HK_NET_API hk_net_dev_focus_near(HKHANDLE h, unsigned int ui_channel_no, int i_stop);
    //聚焦+
    HK_NET_API hk_net_dev_focus_far(HKHANDLE h, unsigned int ui_channel_no, int i_stop);
    //光圈-
    HK_NET_API hk_net_dev_iris_close(HKHANDLE h, unsigned int ui_channel_no, int i_stop);
    //光圈+
    HK_NET_API hk_net_dev_iris_open(HKHANDLE h, unsigned int ui_channel_no, int i_stop);

    //开灯
    HK_NET_API hk_net_dev_open_light(HKHANDLE h);
    //关灯
    HK_NET_API hk_net_dev_close_light(HKHANDLE h);
    //开雨刷
    HK_NET_API hk_net_dev_open_wiper(HKHANDLE h);
    //关雨刷
    HK_NET_API hk_net_dev_close_wiper(HKHANDLE h);

    enum{
        PTZ_TILT_UP = 0, //上
        PTZ_TILT_DOWN = 1,//下
        PTZ_PAN_LEFT = 2,//左
        PTZ_PAN_RIGHT = 3,//右
        PTZ_UP_LEFT = 4,//左上
        PTZ_UP_RIGHT = 5,//右上
        PTZ_DOWN_LEFT = 6,//左下
        PTZ_DOWN_RIGHT = 7,//右下
        PTZ_PAN_AUTO = 8,//左右自动扫描
    };
    HK_NET_API hk_net_dev_ptz_control(HKHANDLE h, int ptz_control_type, int i_speed, int i_stop);//i_speed: 1~7

    //预置点设置
    HK_NET_API hk_net_dev_ptz_set_preset(HKHANDLE h, int i_preset_index);
    //召回预置点
    HK_NET_API hk_net_dev_ptz_goto_preset(HKHANDLE h, int i_preset_index);
    //删除预置点
    HK_NET_API hk_net_dev_ptz_del_preset(HKHANDLE h, int i_preset_index);
    //清空预置点
    HK_NET_API hk_net_dev_ptz_clear_all_preset(HKHANDLE h);

#ifndef _HK_PRESET_CONFIG_
#define _HK_PRESET_CONFIG_
    struct STRU_PRESET_CONFIG{
        unsigned int ui_enable; //1 enable, 0 disable
        unsigned int ui_especial; //1 especial, 0 normal
        unsigned int ui_no;
        unsigned char puc_preset_name[64];
    };
#endif
    //获取预置点列表
    HK_NET_API hk_net_dev_ptz_get_preset_list(HKHANDLE h, STRU_PRESET_CONFIG *p_preset, unsigned int *pui_count);

#ifndef LIBRARY_SUPPORT_ONLY_HEIKA
    //同步视场角
    HK_NET_API hk_net_dev_synchronzie_fov(HKHANDLE h);

//nvr--------------------------------------------------------start
    //NVR相关
#ifndef _HK_NVR_FILE_DEF_
#define _HK_NVR_FILE_DEF_
    struct HK_NVR_FILE_COND{
        unsigned int ui_start_year;
        unsigned int ui_start_month;
        unsigned int ui_start_day;
        unsigned int ui_start_hour;
        unsigned int ui_start_minute;
        unsigned int ui_start_second;

        unsigned int ui_stop_year;
        unsigned int ui_stop_month;
        unsigned int ui_stop_day;
        unsigned int ui_stop_hour;
        unsigned int ui_stop_minute;
        unsigned int ui_stop_second;
    };

    struct HK_NVR_FILE_INFO{
        char pc_file_name[128];
        unsigned int ui_file_size;

        unsigned int ui_start_year;
        unsigned int ui_start_month;
        unsigned int ui_start_day;
        unsigned int ui_start_hour;
        unsigned int ui_start_minute;
        unsigned int ui_start_second;

        unsigned int ui_stop_year;
        unsigned int ui_stop_month;
        unsigned int ui_stop_day;
        unsigned int ui_stop_hour;
        unsigned int ui_stop_minute;
        unsigned int ui_stop_second;
    };
#endif

#ifndef _HK_NVR_IP_CHANNEL_
#define _HK_NVR_IP_CHANNEL_
    struct STRU_NVR_IP_CHANNEL{
        char pc_ip[16];
        unsigned int ui_channel[2];
    };
#endif

    //NVR相关接口仅针对海康NVR
    HK_NET_API hk_net_dev_get_channels_config(HKHANDLE h, STRU_NVR_IP_CHANNEL *pst_ip_channels, unsigned int *ui_cnt);
    //获取NVR文件列表
    HK_NET_API hk_net_dev_get_file_list(HKHANDLE h, unsigned int channel, HK_NVR_FILE_COND st_condtion, HK_NVR_FILE_INFO *pst_file_list, unsigned int *ui_cnt);

    //文件名回放
    HK_NET_API hk_net_dev_play_back_by_name(HKHANDLE h, char *pc_name, int *i_handle);
    //时间回放
    HK_NET_API hk_net_dev_play_back_by_time(HKHANDLE h, unsigned int channel, HK_NVR_FILE_COND st_condition, int *i_handle);

    HK_NET_API hk_net_dev_play_back_stop(HKHANDLE h, int i_handle);
    //回放时下载文件
    HK_NET_API hk_net_dev_play_back_save_data(HKHANDLE h, int i_handle, char *pc_name);
    //回放时下载停止
    HK_NET_API hk_net_dev_play_back_stop_save(HKHANDLE h, int i_handle);

#ifndef _HK_PLAY_BACK_PACKET_ES_INFO_
#define _HK_PLAY_BACK_PACKET_ES_INFO_
    struct HK_PLAY_BACK_PACKET_ES_INFO{
        unsigned short us_width; //宽度
        unsigned short us_height; //调试
        unsigned long ul_time_stamp; //时间戳低位
        unsigned long ul_time_stamp_high; //时间戳高位
        unsigned short us_year; //时间
        unsigned short us_month;
        unsigned short us_day;
        unsigned short us_hour;
        unsigned short us_minute;
        unsigned short us_second;
        unsigned short us_millisecond;
        unsigned int ui_frame_num; //帧号
        unsigned int ui_frame_rate; //帧率
        unsigned int ui_packet_type; //包类型：0- 文件头，1- 视频I帧，2- 视频B帧， 3- 视频P帧， 10- 音频数据包， 11- 私有数据包
        unsigned int ui_packet_size; //包大小
        unsigned char *puc_packet_buffer; //缓冲区
    };
#endif

#ifndef _HK_PLAY_BACK_VIDEO_CB_FUNC_DEF_
#define _HK_PLAY_BACK_VIDEO_CB_FUNC_DEF_
    typedef bool(CALLBACK *PLAY_BACK_VIDEO_CB_FUNC)(unsigned int i_handle, HK_PLAY_BACK_PACKET_ES_INFO *pst_es_info, void *p_user_data);
#endif
    //回放数据帧回调
    HK_NET_API hk_net_dev_play_back_set_callback(HKHANDLE h, PLAY_BACK_VIDEO_CB_FUNC cb_func, void *p_user);

    //回放控制
    enum{
        PLAYBACK_START = 0,//开始播放
        PLAYBACK_STOP = 1,//停止播放
        PLAYBACK_PAUSE = 2,//暂停播放
        PLAYBACK_RESTART = 3,//恢复播放
        PLAYBACK_FAST = 4,//快放
        PLAYBACK_SLOW = 5,//慢放
        PLAYBACK_NORMAL = 6,//正常速度
    };
    HK_NET_API hk_net_dev_play_back_control(HKHANDLE h, unsigned int i_handle, int i_control);

    //以下所有接口在调用hk_net_dev_play_back_by_time时均不支持
    HK_NET_API hk_net_dev_play_back_set_pos(HKHANDLE h, unsigned int i_handle, int i_pos);
    //获取回放总时长与总帧数
    HK_NET_API hk_net_dev_play_back_get_total_time(HKHANDLE h, unsigned int i_handle, unsigned int *pui_times);
    HK_NET_API hk_net_dev_play_back_get_total_frames(HKHANDLE h, unsigned int i_handle, unsigned int *pui_frames);

    //获取回放当前进度相关接口,通过回调方式以下四个接口会return false
    HK_NET_API hk_net_dev_play_back_control_seek_time(HKHANDLE h, unsigned int i_handle, int i_year, int i_month, int i_day, int i_hour, int i_mintue, int i_second);
    HK_NET_API hk_net_dev_play_back_get_time(HKHANDLE h, unsigned int i_handle, unsigned int *pui_time);
    HK_NET_API hk_net_dev_play_back_get_frame(HKHANDLE h, unsigned int i_handle, unsigned int *pui_frame);
    HK_NET_API hk_net_dev_play_back_get_pos(HKHANDLE h, unsigned int i_handle, unsigned int *pui_pos);
//nvr--------------------------------------------------------end
#endif



#ifndef LIBRARY_SUPPORT_ONLY_HEIKA
    //判断是否支持调焦
    HK_NET_API hk_net_dev_get_len_adjust_method(HKHANDLE h, unsigned int *pui_method);
    HK_NET_API hk_net_dev_set_len_pos(HKHANDLE h, unsigned int ui_len_pos);
    HK_NET_API hk_net_dev_get_len_pos(HKHANDLE h, unsigned int *pui_len_pos);

    //自动聚集
    HK_NET_API hk_net_dev_auto_focus(HKHANDLE h, unsigned int ui_channel_no);

    //亮度与对比度设置
    HK_NET_API hk_net_dev_set_brightness_and_contrast(HKHANDLE h, unsigned int ui_channel_no, int i_brightness, int i_contrast);
    HK_NET_API hk_net_dev_get_brightness_and_contrast(HKHANDLE h, unsigned int ui_channel_no, int *pi_brightness, int *pi_contrast);
#endif

#ifdef __cplusplus
}
#endif

#endif
