#ifndef _GPRS_PROTOCOL_IDEACREATED_GASMETER_API_H_
#define _GPRS_PROTOCOL_IDEACREATED_GASMETER_API_H_

#include "define_all.h" 
#include "gprs_sundry_api.h"
#include "administrator.h"
#include "system_parameter.h"

/*协议帧固定的长度*/
#define PROTOCOL_HEAD_LENGTH sizeof(GPRS_PROTOCOL_HEAD_T) // 协议头固定长度
#define PROTOCOL_TAIL_LENGTH sizeof(GPRS_PROTOCOL_TAIL_T) // 协议尾固定长度

/*普通发送数据内容固定长度*/
#define PROTOCOL_NORMAL_DATA_HEAD_LENGTH sizeof(GPRS_PROTOCOL_NORMAL_DATA_HEAD_T) // 普通发送数据头固定长度
#define PROTOCOL_NORMAL_DATA_PACK_LENGTH sizeof(GPRS_PROTOCOL_NORMAL_DATA_PACK_T) // 普通发送数据包固定长度
#define PROTOCOL_NORMAL_DATA_PACK_1_LENGTH sizeof(GPRS_PROTOCOL_NORMAL_DATA_PACK_1_T) // 数据包1 固定长度
#define PROTOCOL_NORMAL_DATA_PACK_2_LENGTH sizeof(GPRS_PROTOCOL_NORMAL_DATA_PACK_2_T) // 数据包2 固定长度

/*设置命令应答数据内容固定长度*/
#define PROTOCOL_SET_CMD_DATA_BACK_LENGTH 1 // 所有平台下发的设置命令的返回数据长度

#define PROTOCOL_FUNC_PARA_LENGTH sizeof(struct func_para)
#define PROTOCOL_SEND_CFG_LENGTH sizeof(struct send_cfg)
#define PROTOCOL_IP_PARA_LENGTH sizeof(struct ip_para)
#define PROTOCOL_DEVICE_INFO_LENGTH sizeof(struct device_info)
#define PROTOCOL_BALANCE_ALARM_LENGTH sizeof(struct balance_alarm_para)	
#define PROTOCOL_FLOW_CLOSE_LENGTH sizeof(struct cumulate_flow_close_para)	

#define PROTOCOL_START_CODE 0x68 // 协议起始符
#define PROTOCOL_END_CODE 0x16   // 协议结束符
#define PROTOCOL_VERSION 0x40    // 协议版本
#define DATA_START_CODE 0x55     // 数据起始符

#define PROTOCOL_NORMAL_SEND_CMD_U16 0x0101          // 普通上报命令标识
#define PROTOCOL_END_CMD_U16 0x0102                  // 结束帧命令标识
#define PROTOCOL_OPERATION_KEY_U16 0x0103            // 下发运营密钥
#define PROTOCOL_BACKSETTLE_INFO_U16 0x0104          // 推送后台结算信息
#define PROTOCOL_STARTEND_COUNT_U16 0x0201           // 启、停用
#define PROTOCOL_SET_FUN_PARA_U16 0x0202             // 设置功能参数
#define PROTOCOL_READ_FUN_PARA_U16 0x0203            // 读取功能参数
#define PROTOCOL_SET_ALARM_COUNT_U16 0x0204          // 设置报警控制字
#define PROTOCOL_READ_ALARM_COUNT_U16 0x0205         // 读取报警控制字
#define PROTOCOL_SET_SEND_CYCLE_U16 0x0206           // 上报周期设置
#define PROTOCOL_READ_SEND_CYCLE_U16 0x0207          // 读取上报周期
#define PROTOCOL_SET_METER_PARA_U16 0x0208           // 设置对接仪表参数
#define PROTOCOL_READ_METER_PARA_U16 0x0209          // 读取对接仪表参数
#define PROTOCOL_READ_EQUIP_PARA_U16 0x0220          // 读取设备信息
#define PROTOCOL_SET_TIME_CMD_U16 0x0221             // 设置时间命令标识
#define PROTOCOL_SET_IP_U16 0x0222                   // IP地址设置
#define PROTOCOL_READ_IP_U16 0x0223                  // 读取IP地址
#define PROTOCOL_CLEAR_EXCEPTION_U16 0x0224          // 清除异常
#define PROTOCOL_CLEAR_COUNT_U16 0x0225              // 总量清零
#define PROTOCOL_SAVE_TIME_POINT_U16 0x0230          // 日月记录保存时间点设置
#define PROTOCOL_READ_TIME_POINT_U16 0x0231          // 读取日月记录保存时间点
#define PROTOCOL_READ_HISTORY_U16 0x0232             // 读取历史记录
#define PROTOCOL_READ_VALVE_RECORD_U16 0x0233        // 读取阀门操作记录
#define PROTOCOL_READ_MODIFY_ACC_RECORD 0x0234       // 去读累积量修改记录
#define PROTOCOL_CONT_VALVE 0x0301                   // 阀门控制
#define PROTOCOL_SET_BALANCE_CLOSE_VALVE 0x0302      // 设置余额关阀
#define PROTOCOL_READ_BALANCE_CLOSE_VALVE 0x0303     // 读取余额关阀
#define PROTOCOL_SET_CLOSE_VALVE 0x0304              // 设置关阀控制功能
#define PROTOCOL_READ_CLOSE_VALVE 0x0305             // 读取关阀控制功能
#define PROTOCOL_SET_DONT_REPORT_CLOSE_VALVE 0x0306  // 设置无上报关阀天数
#define PROTOCOL_READ_DONT_REPORT_CLOSE_VALVE 0x0307 // 读无上报关阀天数
#define PROTOCOL_SET_DONT_USE_GAS_DAY 0x0308         // 设置无用气关阀天数
#define PROTOCOL_READ_DONT_USE_GAS_DAY 0x0309        // 读无用气关阀天数
#define PROTOCOL_SET_COUNT_CLOSE_VALVE 0x0310        // 设置累积量关阀
#define PROTOCOL_READ_NO_COUNT_CLOSE_VALVE 0x0311    // 读无累积量关阀

#define PROTOCOL_PAY_MONEYS_U16 0x0401   // 金额充值
#define PROTOCOL_ADJUST_PRICE_U16 0x0402 // 调价
#define PROTOCOL_READ_PRICE_U16 0x0403   // 读价

#define GPRS_PROTOCOL_SEND_FUNC_TABLE_NUM sizeof(gprs_protocol_send_tab_func) / sizeof(GPRS_PROTOCOL_SEND_FUNC_TABLE_DRV_T)
#define GPRS_PROTOCOL_RECV_FUNC_TABLE_NUM sizeof(gprs_protocol_recv_tab_func) / sizeof(GPRS_PROTOCOL_RECV_FUNC_TABLE_DRV_T)

typedef enum
{
  PROTOCOL_UNKOWN_STATUS = 0U,
  PROTOCOL_END_STATUS,

  PROTOCOL_NORMAL_SEND_CMD,
  PROTOCOL_ALARM_SEND_CMD,

  PROTOCOL_READ_FUNC_BACK,                    // 0x0203
  PROTOCOL_READ_ALARM_CONTROL_BACK,           // 0x0205
  PROTOCOL_READ_SEND_CYCLE_BACK,              // 0x0207
  PROTOCOL_READ_METER_PARA_BACK,              // 0x0209
  PROTOCOL_READ_EQUIP_PARA_BACK,              // 0x0220
  PROTOCOL_SET_IP_BACK,                       // 0x0222
  PROTOCOL_READ_IP_BACK,                      // 0x0223
  PROTOCOL_CLEAR_COUNT_BACK,                  // 0x0225
  PROTOCOL_READ_TIME_POINT_BACK,              // 0x0231
  PROTOCOL_READ_HISTORY_BACK,                 // 0x0232
  PROTOCOL_READ_VALVE_RECORD_BACK,            // 0x0233
  PROTOCOL_READ_MODIFY_ACC_RECORD_BACK,       // 0x0234
  PROTOCOL_READ_BALANCE_CLOSE_VALVE_BACK,     // 0x0303
  PROTOCOL_READ_CLOSE_VALVE_BACK,             // 0x0305
  PROTOCOL_READ_DONT_REPORT_CLOSE_VALVE_BACK, // 0x0307
  PROTOCOL_READ_DONT_USE_GAS_DAY_BACK,        // 0x0309
  PROTOCOL_READ_NO_COUNT_CLOSE_VALVE_BACK,    // 0x0311

  PROTOCOL_PAY_MONEYS_BACK,
	PROTOCOL_READ_PRICE_NOW_INF_BACK,           //  0x0403

  PROTOCOL_SET_RECV_SUCCORFAIL, // 设置接收通用返回
} GPRS_PROTOCOL_STATUS;


#pragma pack(1)

/*开辟柔性数组*/
typedef struct
{
  uint8_t send_len;
  uint8_t send_buffer[];
} GPRS_PROTOCOL_SEND_BUFFER_T;

typedef union
{
  uint8_t union_buff[150];
  uint8_t secret_keys[8][16];
  struct recv_settle_data
  {
    uint8_t settle_time_bcd[6];         // 结算的时间
    int64_t settle_cumulate_sc;          // 结算的总量
    int64_t settle_balance;              // 结算的余额
    uint32_t settle_price;              // 结算的单价
    uint8_t settle_ladder;              // 结算的阶梯
    uint8_t settle_balance_small_state; // 结算的余额少额状态
    uint8_t last_pay_time[6];           // 上一次充值时间
    int64_t last_pay_money;              // 上一次充值的钱
    uint8_t reserve[19];
  } settle_data_s;
  uint8_t account_state; // 账户状态（启停用）
  struct func_para
  {
    uint8_t lcd_display_mode;
    uint8_t virtual_billing_state;
    uint8_t display_balance;
    uint8_t display_price;
    uint8_t gprs_usually_on_line; // 常在线
    uint8_t reserve[25];
  } func_para_s; // gprs协议功能参数格式
  struct send_cfg
  {
    uint8_t gprs_interval_type;
    uint16_t gprs_send_period_min_time;           // gprs发送的间隔分钟时间
    uint16_t extern_pwr_send_period_reserve;      // 外电发送间隔时间(预留)
    uint8_t gprs_reference_time_bcd[2];           // 基准时间 BCD（[0] = 小时 [1] = 分钟）
    uint8_t gprs_timed_number;                    // 定时次数
    uint8_t gprs_timing_time_bcd[12][2];          // 定时时间
    uint16_t gprs_timeout;                        // 超时时间
    uint16_t gprs_restart_send_interval_min_time; // gprs重新发送的间隔分钟时间
    uint8_t gprs_restart_number;                  // gprs重新发生次数
    uint8_t pack_or_independent_data;             // 打包上发or独立上发
    uint16_t save_data_period_min_time;           // 采集数据的间隔分钟时间
    uint16_t extern_pwr_save_period_reserve;      // 外电采集数据间隔时间（预留）
    uint8_t save_reference_time_bcd[2];           // 基准时间 BCD（[0] = 小时 [1] = 分钟）
    uint8_t reserve[13];
  } send_cfg_s; // gprs协议发送配置格式
  struct ip_para
  {
    uint8_t status_ip_1;
    uint8_t gprs_ip_1[4];
    uint16_t gprs_port_1;
    uint8_t gprs_link_type_1;
    uint8_t status_ip_2;
    uint8_t gprs_ip_2[4];
    uint16_t gprs_port_2;
    uint8_t gprs_link_type_2;
  } ip_para_s; // gprs协议ip参数格式
  struct balance_alarm_para
  {
    int32_t balance_small_value_1;
    uint8_t valve_cfg_flag_1;
    int32_t balance_small_value_2;
    uint8_t valve_cfg_flag_2;
    int32_t balance_small_value_3;
    uint8_t valve_cfg_flag_3;
    int32_t balance_small_value_4;
    uint8_t valve_cfg_flag_4;
    int32_t balance_small_value_5;
    uint8_t valve_cfg_flag_5;
  } balance_alarm_para_s;
  struct pay_moneys_para
  {
    uint8_t pay_moneys_flag;		//金额充值标识
    uint16_t pay_moneys_cnt;		//充值序号
    long long pay_value;				//充值金额
  } pay_moneys_para_s;
  struct cumulate_flow_close_para
  {
    uint32_t set_cumulate_flow_value;
    uint8_t valve_control_type;
  } cumulate_flow_close_para_s;
	struct price_cfg
	{
		uint16_t price_ver;
		uint8_t set_price_type_mode;
		uint32_t normal_price_now;
		uint8_t period_state;
	}price_cfg_s;
	struct device_info
	{
		uint8_t device_iccid[20];
		uint8_t device_imei[15];
		uint8_t device_net_info;
		uint8_t device_hardware_ver_bcd[4];
		uint8_t device_software_ver_bcd[4];
		uint8_t reserve[32];
	}device_info_s;
} GPRS_PTL_CMD_UNION_T;

typedef struct
{
  uint8_t frame_start_code;     // 帧起始符
  uint8_t device_num[8];        // 表具编号
  uint8_t data_start_code;      // 数据起始符
  uint8_t device_time[6];       // 系统时间
  uint8_t protocol_ver;         // 协议版本
  uint16_t cmd_code_u16;        // 命令标识
  uint16_t frame_num;           // 帧序列号
  uint16_t frame_sum;           // 总帧数
  uint8_t key_ver;              // 密钥版本号
  uint16_t data_content_length; // 221101数据内容长度
} GPRS_PROTOCOL_HEAD_T;         // 固定的帧头数据

typedef struct
{
  uint16_t check_crc;     // crc校验
  uint8_t frame_end_code; // 帧结束符
} GPRS_PROTOCOL_TAIL_T;   // 固定的帧尾数据

typedef struct
{
  DEVICE_TYPE equipment_type;                            // 设备类型
  DEVICE_MODEL equipment_model;                          // 设备型号
  uint8_t sys_send_type;                                 // 上告方式
  int8_t iccid[20];                                     // iccid
  uint8_t signal_intensity;                              // 信号强度
  uint8_t signal_intensity_level;                        // 信号强度等级
  uint8_t net_info;                                      // 网络信息
  uint8_t software_version[4];                           // 软件版本号
  uint8_t account_state;                                 // 开户状态
  uint16_t alarm_word[SYS_ALARM_BYTES_TYPE_LENGTH >> 1]; // 报警字
  uint16_t valve_close_reason;                           // 关阀原因字
  uint8_t reserve[8];                                    // 保留
  uint8_t data_package_format;                           // 数据包格式
  uint8_t data_pack_num;                                 // 数据包条数
} GPRS_PROTOCOL_NORMAL_DATA_HEAD_T;                      // 普通数据的固定格式头

typedef struct
{
  GPRS_PROTOCOL_HEAD_T gprs_protocol_head;
  GPRS_PROTOCOL_TAIL_T gprs_protocol_tail;
  GPRS_PROTOCOL_NORMAL_DATA_HEAD_T gprs_protocol_normal_data_head;
} GPRS_PROTOCOL_HEAD_TAIL_T;

typedef struct
{
  uint8_t sample_time[6]; // 冻结时间
  uint64_t sc_cumulate;   // 正向标况总量，无符号
  uint64_t wc_cumulate;   // 正向工况总量，无符号
  int32_t sc_instant;     // 标况瞬时量，有符号
  int32_t wc_instant;     // 工况瞬时量，有符号
  float pressure;
  float temperature;
  int64_t balance;                                    // 剩余金额，有符号
  uint32_t uint_price;                                // 单价
  uint8_t lith_vcc;                                   // 锂电池电压
  int8_t lith_vcc_per;                               // 锂电池电压百分比
  uint8_t alka_vcc;                                   // 碱电池电压
  int8_t alka_vcc_per;                               // 碱电池电压百分比
  uint16_t status[SYS_STATUS_BYTES_TYPE_LENGTH >> 1]; // 状态字
//uint8_t reserved[40];
} GPRS_PROTOCOL_NORMAL_DATA_PACK_T;

typedef struct
{
  uint8_t sample_time[6];        // 冻结时间
  uint64_t sc_cumulate;          // 正向标况总量
  uint64_t wc_cumulate;          // 正向工况总量
  int32_t sc_instant;            // 标况瞬时量
  int32_t wc_instant;            // 工况瞬时量
  float pressure;                // 压力
  float temperature;             // 温度
  int64_t balance;               // 剩余金额
  uint32_t uint_price;           // 单价
  uint8_t lith_vcc;              // 锂电池电压
  int8_t lith_vcc_per;          // 锂电池电压百分比
  uint8_t alka_vcc;              // 碱电池电压
  int8_t alka_vcc_per;          // 碱电池电压百分比
  uint8_t signal_noise_ratio_a1; // 信噪比A1
  uint8_t signal_noise_ratio_b1; // 信噪比B1
  uint8_t gain_a1;               // 增益A1
  uint8_t gain_b1;               // 增益B1
  uint8_t signal_intensity_a1;   // 信号强度
  uint8_t signal_intensity_b1;
  float channel_time_a1; // 通道时间
  float channel_time_b1;
  float Channel_sound_v;   // 通道声速
  float Channel_flow_rate; // 通道流速
  uint16_t status[SYS_STATUS_BYTES_TYPE_LENGTH >> 1];
} GPRS_PROTOCOL_NORMAL_DATA_PACK_1_T;

typedef struct
{
  uint8_t sample_time[6];        // 冻结时间
  uint64_t sc_cumulate;          // 正向标况总量，无符号
  uint64_t wc_cumulate;          // 正向工况总量，无符号
  uint64_t re_sc_cumulate;       // 反向标况总量
  uint64_t re_wc_cumulate;       // 反向工况总量
  int32_t sc_instant;            // 标况瞬时量，有符号
  int32_t wc_instant;            // 工况瞬时量，有符号
  float pressure;                // 压力
  float temperature;             // 温度
  float temp_environment;        // 环境温度
  int64_t balance;               // 剩余金额，有符号
  uint32_t uint_price;           // 单价
  uint8_t lith_vcc;              // 锂电池电压
  int8_t lith_vcc_per;          // 锂电池电压百分比
  uint8_t alka_vcc;              // 碱电池电压
  int8_t alka_vcc_per;          // 碱电池电压百分比
  uint8_t signal_noise_ratio_a1; // 信噪比A1
  uint8_t signal_noise_ratio_b1; // 信噪比B1
  uint8_t signal_noise_ratio_a2; // 信噪比A2
  uint8_t signal_noise_ratio_b2; // 信噪比B2
  uint8_t signal_noise_ratio_a3; // 信噪比A3
  uint8_t signal_noise_ratio_b3; // 信噪比B3
  uint8_t gain_a1;               // 增益
  uint8_t gain_b1;
  uint8_t gain_a2;
  uint8_t gain_b2;
  uint8_t gain_a3;
  uint8_t gain_b3;
  uint8_t signal_intensity_a1; // 信号强度
  uint8_t signal_intensity_b1;
  uint8_t signal_intensity_a2;
  uint8_t signal_intensity_b2;
  uint8_t signal_intensity_a3;
  uint8_t signal_intensity_b3;
  float channel_time_a1; // 通道时间
  float channel_time_b1;
  float channel_time_a2;
  float channel_time_b2;
  float channel_time_a3;
  float channel_time_b3;
  float Channel_sound_v1; // 通道声速
  float Channel_sound_v2;
  float Channel_sound_v3;
  float Channel_flow_rate1; // 通道流速
  float Channel_flow_rate2;
  float Channel_flow_rate3;
  uint16_t status[SYS_STATUS_BYTES_TYPE_LENGTH >> 1];
} GPRS_PROTOCOL_NORMAL_DATA_PACK_2_T;

typedef struct
{
  __IO GPRS_PROTOCOL_STATUS gprs_protocol_type;
} GPRS_PROTOCOL_PARA_T;

typedef void (*pGprs_Protocol_Send_FuncHandler)(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail);
typedef struct
{
  const GPRS_PROTOCOL_STATUS gprs_protocol_cmd_table;
  pGprs_Protocol_Send_FuncHandler GprsProtocolSendFuncHandler;
} GPRS_PROTOCOL_SEND_FUNC_TABLE_DRV_T; /*发送协议表驱动*/

typedef GPRS_PROTOCOL_STATUS (*pGprs_Protocol_Recv_FuncHandler)(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
typedef struct
{
  const uint16_t gprs_protocol_cmd_table_u16;
  pGprs_Protocol_Recv_FuncHandler GprsProtocolRecvFuncHandler;
} GPRS_PROTOCOL_RECV_FUNC_TABLE_DRV_T; /*接收协议表驱动*/

#pragma pack()

extern GPRS_PROTOCOL_HEAD_TAIL_T gprs_protocol_head_tail_g;
extern GPRS_PROTOCOL_PARA_T gprs_protocol_para_g;

uint16_t Gprs_Protocol_DataLength(uint8_t send_type, GPRS_PROTOCOL_ENCRYPT_PARA *gprs_protocol_encrypt_para_p);


/************************************** Send Data **************************************************************/
void Gprs_Protocol_SendSetTimeResultHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);
void Gprs_Protocol_SendNormalDataHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);
void Gprs_Protocol_SendDataConfig(uint8_t send_type, uint8_t *pSendData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);
void Gprs_Protocol_SendReadFunHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);                  // 读表具功能参数0x0203
void Gprs_Protocol_SendReadAlarmContHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);            // 读取报警控制字0x0205
void Gprs_Protocol_SendReadSendCycleHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);            // 读取上报周期0x0207
void Gprs_Protocol_SendReadMeterParaHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);            // 读取对接仪表参数0x0209
void Gprs_Protocol_SendReadEquipParaHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);            // 读取设备信息0x0220
void Gprs_Protocol_SendSetIpaddrHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);                // IP地址设置0x0222
void Gprs_Protocol_SendReadIpaddrHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);               // 读取IP地址设置0x0223
void Gprs_Protocol_SendClearCountHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);               // 总量清零0x0225
void Gprs_Protocol_SendSaveTimePointHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);            // 日月记录保存时间点设置0x0230
void Gprs_Protocol_SendReadTimePointHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);            // 读取日月记录保存时间点0x0231
void Gprs_Protocol_SendReadHistoryHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);              // 读历史记录0x0232
void Gprs_Protocol_SendReadValveRecordHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);          // 读取阀门操作记录0x0233
void Gprs_Protocol_SendReadModifyAccRecordHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);      // 读累积量修改记录0x0234
void Gprs_Protocol_SendReadBalanceCloseValveHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);    // 读取余额关阀0x0303
void Gprs_Protocol_SendSetCloseValveKeyHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);         // 读取关阀控制字0x0305
void Gprs_Protocol_SendReadDontReportCloseValveHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p); // 读无上报关阀天数0x0307
void Gprs_Protocol_SendReadDontUseGasDayHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);        // 读无用气关阀天数0x0309
void Gprs_Protocol_SendSetCountCloseValveHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);       // 设置累积量关阀0x0310
void Gprs_Protocol_SendReadNoCountCloseValveHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);    // 读无累积量关阀0x0311

void Gprs_Protocol_SendPayMoneysBackHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p); // 充钱应答返回
void Gprs_Protocol_SendPriceNowInfHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p);//读取当前价格信息0x0403

void Gprs_Protocol_SetRecvSuccOrFail(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p); // 设置接收成功/失败
/************************************** Recv Data **************************************************************/
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvDataConfig(uint8_t *pRecvData, uint16_t recv_data_length);

GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvNormalDataHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvEndHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvOperaKeyHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvBackSettleInfoHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvStartEndCountHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetFunParaHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetAlarmContHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetSendCycleHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetMeterParaHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetTimeHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetIpaddrHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvClearExceptionHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvClearCountHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSaveTimePointHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvReadHistoryHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvReadValveRecordHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvReadModifyAccRecordHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvContValveHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetBalanceCloseValveHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetCloseValveHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetDontReportCloseValveHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetDontUseGasDayHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetCountCloseValveHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);

GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvPayMoneysHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvAdjustPriceHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);

GPRS_PROTOCOL_STATUS Gprs_Protocol_Recv_ReadCmdGeneralHandler(GPRS_PTL_CMD_UNION_T *pGprs_ptl_cmd_union);

#endif
