144 lines
6.2 KiB
C
144 lines
6.2 KiB
C
#ifndef JT808_SET_TERM_PARAM_H_
|
||
#define JT808_SET_TERM_PARAM_H_
|
||
#include "jt808_protocol.h"
|
||
#include "jt808_config.h"
|
||
#include "jt808_electronic_fence.h"
|
||
|
||
|
||
#pragma pack(1)
|
||
|
||
|
||
// 本地围栏配置结构(用于预置电子围栏)
|
||
typedef struct {
|
||
uint32_t area_id; // 围栏区域ID
|
||
uint16_t area_att; // 区域属性:0x0001=景区围栏, 0x0002=禁停区围栏
|
||
uint16_t points_num; // 区域顶点数量
|
||
AreaPoint_t *points; // 区域顶点坐标(最多支持4边形)
|
||
} LocalFenceConfig_t;
|
||
|
||
|
||
// 终端参数设置项参数ID
|
||
typedef enum {
|
||
ID_HeartBeatInterval = 0x0001, // DWORD, 终端心跳发送间隔(s)
|
||
ID_MainServerAddr = 0x0013, //STRING, 主服务器地址,IP 或域名
|
||
ID_ServerPort = 0x0018, //DWORD, 服务器 TCP 端口
|
||
ID_DefaultTimeReportInterval = 0x0029, // DWORD, 缺省时间汇报间隔
|
||
ID_InflexionAngle = 0x0030, // DWORD, 拐点补传角度, < 180°
|
||
ID_MaxSpeed = 0x0055, // DWORD, 最高速度, km/h.
|
||
ID_ProvinceID = 0x0081, // WORD, 车辆所在的省域 ID
|
||
ID_CityID = 0x0082, // WORD, 车辆所在的市域 ID
|
||
ID_CarPlateNum = 0x0083, //STRING, 公安交通管理部门颁发的机动车号牌
|
||
ID_CarPlateColor = 0x0084, //BYTE 车牌颜色,按照 JT/T415-2006 的 5.4.12
|
||
|
||
ID_ManagerACC = 0xF001, //BYTE 管理员模式油门0~100%
|
||
ID_TouristACC = 0xF002, //BYTE 游客模式油门0~100%
|
||
ID_SpeedCutACC = 0xF003, //BYTE 自动减速油门0~100%
|
||
ID_BrakeLimit = 0xF004, //WORD 前进刹车距离
|
||
ID_SpeedCutLimit = 0xF005, //WORD 前进自动减速刹车距离
|
||
ID_BrakeLimit_B = 0xF006, //WORD 后退刹车距离
|
||
ID_SpeedCutLimit_B = 0xF007, //WORD 后退自动减速刹车距离
|
||
ID_Ban_Fence_Polygon_Delay_OFF = 0xF008, //BYTE 禁止围栏延时关闭时间, 单位秒
|
||
ID_RadarEN = 0xF009, //BYTE 雷达使能位, 0 代表关闭, 1 代表开启
|
||
}set_TermParamID_t;
|
||
typedef struct{
|
||
uint32_t HeartBeatInterval;// DWORD, 终端心跳发送间隔(s)
|
||
uint8_t MainServerAddr[20];//STRING, 主服务器地址,IP 或域名
|
||
uint32_t ServerPort;//DWORD, 服务器 TCP 端口
|
||
uint32_t DefaultTimeReportInterval;// DWORD, 缺省时间汇报间隔
|
||
uint32_t InflexionAngle;// DWORD, 拐点补传角度, < 180°
|
||
uint32_t MaxSpeed;// DWORD, 最高速度, km/h
|
||
uint16_t ProvinceID;// WORD, 车辆所在的省域 ID
|
||
uint16_t CityID;// WORD, 车辆所在的市域 ID
|
||
uint8_t CarPlateNum[10];//STRING, 公安交通管理部门颁发的机动车号牌
|
||
uint8_t CarPlateColor;//车牌颜色,按照 JT/T415-2006 的 5.4.12
|
||
|
||
uint8_t RadarEN; // 雷达使能位, 0 代表关闭, 1 代表开启
|
||
uint8_t ManagerACC; // 管理员模式油门0~100%
|
||
uint8_t TouristACC; // 游客模式油门0~100%
|
||
uint8_t SpeedCutACC; // 自动减速油门0~100%
|
||
uint16_t BrakeLimit; //前进刹车距离
|
||
uint16_t SpeedCutLimit; // 前进自动减速刹车距离
|
||
uint16_t BrakeLimit_B; // 后退刹车距离
|
||
uint16_t SpeedCutLimit_B; // 后退自动减速刹车距离
|
||
uint8_t Ban_Fence_Polygon_Delay_OFF; // 禁止围栏延时关闭时间, 单位秒
|
||
}set_TermParam_t;
|
||
|
||
// 支持的附加消息ID
|
||
typedef enum{
|
||
MileageID = 0x01,// 里程, 1/10km, 对应车上里程表读数, DWORD
|
||
OilMassID = 0x02,// 油量, 1/10L, 对应车上油量表读数, WORD
|
||
TachographSpeedID = 0x03,// 行驶记录功能获取的速度, 1/10km/h, WORD
|
||
AlarmCountID = 0x04,// 需要人工确认报警事件的 ID, 从 1 开始计数, WORD
|
||
OverSpeedAlarmID = 0x11,// 超速报警附加信息, BYTE or BYTE+DWORD
|
||
AccessAreaAlarmID = 0x12,// 进出区域/路线报警附加信息, BYTE+DWORD+BYTE
|
||
DrivingTimeAlarmID = 0x13,// 路段行驶时间不足/过长报警附加信息, DWORD+WORD+BYTE
|
||
VehicleSignalStatusID = 0x25,// 扩展车辆信号状态位, DWORD
|
||
IoStatusID = 0x2A,// IO 状态位, WORD
|
||
AnalogQuantityID = 0x2B,// 模拟量, DWORD
|
||
NetworkQuantityID = 0x30,// 无线通信网络信号强度, BYTE
|
||
GnssSatellitesID = 0x31,// GNSS 定位卫星数, BYTE
|
||
CustomInformationLengthID = 0xE0,// 后续自定义信息长度, BYTE
|
||
BAT_VoltageID = 0xE1, // 电池电压, 0.1V WORD
|
||
BAT_PercentageID = 0xE2, // 电池电量, % BYTE
|
||
Scenic_Fence_Polygon_area_ID = 0xE3, // 当前位置所在景区围栏多边形区域ID, DWORD
|
||
Ban_Fence_Polygon_area_ID = 0xE4, // 当前位置所在禁止围栏多边形区域ID, DWORD
|
||
Locked_Condition_ID = 0xE7, // 锁车状态, BYTE
|
||
}addi_infoID_t;
|
||
|
||
// big_标记的参数需以大端方式存储,需手动转换为大端
|
||
typedef struct {// 终端参数项
|
||
uint8_t phone_BCDnum[6];// 终端手机号
|
||
uint16_t msg_flow_num;// 累加的消息流水号
|
||
Term_RegInfo_t big_reg_info; // 注册信息
|
||
Term_Auth_t big_auth_info; // 终端鉴权信息
|
||
set_TermParam_t set_term_param; // 设置终端参数
|
||
GetTermAttrResp_t big_term_attr_resp; // 终端属性查询响应
|
||
GetSpecificTermParams_t big_specific_params; // 解析出的待查询指定终端参数列表
|
||
Term_Ctrl_t big_ctrl_info; // 解析出的终端控制信息
|
||
Term_Upgrade_t big_upgrade_info; // 解析出的升级信息
|
||
LocReport_t big_loc_report; // 位置信息汇报
|
||
LocTrackingCtrl_t big_loc_tracking_ctrl; // 临时位置跟踪控制
|
||
fence_Polygon_area_t *fence_polygon_area; // 围栏多边形区域
|
||
Data_SeriaNet_t big_data_up_SeriaNet; // 数据上行透传
|
||
}Term_Param_item_t;
|
||
#pragma pack()
|
||
|
||
extern Term_Param_item_t jt808_term_param_item;
|
||
|
||
extern osThreadFunc_t Autoreport_param_ThreadId;
|
||
|
||
extern uint8_t Rsp_locked_condition; // 锁车状态, BYTE
|
||
|
||
extern osMutexId_t Polygon_fence_mutex; // 多边形围栏互斥锁
|
||
|
||
|
||
// 控制车辆状态
|
||
void jt808_Set_CarStatus(uint8_t status);
|
||
|
||
// 获取车辆状态
|
||
uint8_t jt808_Get_CarStatus(void);
|
||
|
||
// 串口数据下传
|
||
int8_t jt808_data_down_SeriaNet(uint8_t type, uint8_t *data, uint16_t len);
|
||
// 串口数据上传
|
||
int8_t jt808_data_up_SeriaNet(uint8_t type, uint8_t *data, uint16_t len);
|
||
|
||
// 删除终端参数文件
|
||
void jt808_delete_TermParam(void);
|
||
|
||
// 设置终端参数
|
||
int jt808_setTermParam(set_TermParamID_t param_id, void *param, uint8_t param_len);
|
||
|
||
// 更新自动上报参数
|
||
void jt808_LocReport_param_update(void);
|
||
|
||
// 启动自动上报参数
|
||
void jt808_Autoreport_param_start(void);
|
||
|
||
// 停止自动上报参数
|
||
void jt808_Autoreport_param_stop(void);
|
||
|
||
// 初始化终端参数
|
||
void jt808_set_term_param_init(void);
|
||
|
||
#endif // JT808_SET_TERM_PARAM_H_
|