#ifndef _UART_CAN_H
#define _UART_CAN_H
#include <stdint.h>
#include "uart_utils.h"
#if 0
typedef struct{
        uint8_t head;   //包首标识固定为 AA
        uint8_t frame_type;     //扩展帧标识:00 为标准帧,01 为扩展帧
        uint8_t frame_rtr;      //远程帧标识:00 为数据帧,01 为远程帧
        uint8_t datalength; //有效数据长度:范围 01~08,远程帧为请求数据长度
        uint8_t extcanid[2];    //2byte ID,扩展帧高位 29bit 有效
        uint8_t cabinetcanid;    //1byte cabinetCanid
        uint8_t boardcanid;    //1byte boardCanid
        uint8_t boardindex;//主板偏移
        uint8_t data[7];//data, max: 7bytes, 加boardindex 8byte 数据,有效数据不足 8byte 后面补 00
        uint8_t tail;   //包尾标识, 默认:7A
}__attribute__((packed)) uart_can_package_t;

int uart_can_data_receive(uart_utils_t *uart,int timeout,uint8_t *cabinet_can_id,uint8_t *board_can_id,uint8_t *index,char data[7]);
int uart_can_data_send(uart_utils_t *uart,uint8_t cabinet_can_id,uint8_t board_can_id,uint8_t index,uint8_t data[]);
#endif
typedef union
{
    struct{
        uint8_t color:3;
        uint8_t sound:1;
        uint8_t single:2;
        uint8_t flash:2;
    }s;
    uint8_t group;
}__attribute__((packed)) jt_led_or_group_package_t;

typedef struct
{
        uint8_t tag_1;
        uint8_t tag_2;
        uint8_t tag_3;
        jt_led_or_group_package_t tag_led_or_group;
}__attribute__((packed)) jt_tag_package_t;

typedef struct
{
        uint8_t group;
        jt_led_or_group_package_t tag_led_or_group;
}__attribute__((packed)) jt_group_package_t;

typedef struct
{
        uint16_t pre;
        uint8_t wakeupTime;
        uint8_t func;
        uint16_t len1;
        uint8_t len2;
        uint8_t timeout;
        uint8_t reserve;
        uint16_t lableNum;
}__attribute__((packed)) jt_head_package_t;

typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        uint16_t crc;
}__attribute__((packed)) jt_group1_package_t;

typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        uint16_t crc;
}__attribute__((packed)) jt_group2_package_t;

typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        uint16_t crc;
}__attribute__((packed)) jt_group3_package_t;

typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        uint16_t crc;
}__attribute__((packed)) jt_group4_package_t;

typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        uint16_t crc;
}__attribute__((packed)) jt_group5_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        uint16_t crc;
}__attribute__((packed)) jt_group6_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        uint16_t crc;
}__attribute__((packed)) jt_group7_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        uint16_t crc;
}__attribute__((packed)) jt_group8_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        uint16_t crc;
}__attribute__((packed)) jt_group9_package_t;

typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        uint16_t crc;
}__attribute__((packed)) jt_group10_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        uint16_t crc;
}__attribute__((packed)) jt_group11_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        uint16_t crc;
}__attribute__((packed)) jt_group12_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        uint16_t crc;
}__attribute__((packed)) jt_group13_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        uint16_t crc;
}__attribute__((packed)) jt_group14_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        uint16_t crc;
}__attribute__((packed)) jt_group15_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        uint16_t crc;
}__attribute__((packed)) jt_group16_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        uint16_t crc;
}__attribute__((packed)) jt_group17_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        uint16_t crc;
}__attribute__((packed)) jt_group18_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        uint16_t crc;
}__attribute__((packed)) jt_group19_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        jt_group_package_t group20;
        uint16_t crc;
}__attribute__((packed)) jt_group20_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        jt_group_package_t group20;
        jt_group_package_t group21;
        uint16_t crc;
}__attribute__((packed)) jt_group21_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        jt_group_package_t group20;
        jt_group_package_t group21;
        jt_group_package_t group22;
        uint16_t crc;
}__attribute__((packed)) jt_group22_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        jt_group_package_t group20;
        jt_group_package_t group21;
        jt_group_package_t group22;
        jt_group_package_t group23;
        uint16_t crc;
}__attribute__((packed)) jt_group23_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        jt_group_package_t group20;
        jt_group_package_t group21;
        jt_group_package_t group22;
        jt_group_package_t group23;
        jt_group_package_t group24;
        uint16_t crc;
}__attribute__((packed)) jt_group24_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        jt_group_package_t group20;
        jt_group_package_t group21;
        jt_group_package_t group22;
        jt_group_package_t group23;
        jt_group_package_t group24;
        jt_group_package_t group25;
        uint16_t crc;
}__attribute__((packed)) jt_group25_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        jt_group_package_t group20;
        jt_group_package_t group21;
        jt_group_package_t group22;
        jt_group_package_t group23;
        jt_group_package_t group24;
        jt_group_package_t group25;
        jt_group_package_t group26;
        uint16_t crc;
}__attribute__((packed)) jt_group26_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        jt_group_package_t group20;
        jt_group_package_t group21;
        jt_group_package_t group22;
        jt_group_package_t group23;
        jt_group_package_t group24;
        jt_group_package_t group25;
        jt_group_package_t group26;
        jt_group_package_t group27;
        uint16_t crc;
}__attribute__((packed)) jt_group27_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        jt_group_package_t group20;
        jt_group_package_t group21;
        jt_group_package_t group22;
        jt_group_package_t group23;
        jt_group_package_t group24;
        jt_group_package_t group25;
        jt_group_package_t group26;
        jt_group_package_t group27;
        jt_group_package_t group28;
        uint16_t crc;
}__attribute__((packed)) jt_group28_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        jt_group_package_t group20;
        jt_group_package_t group21;
        jt_group_package_t group22;
        jt_group_package_t group23;
        jt_group_package_t group24;
        jt_group_package_t group25;
        jt_group_package_t group26;
        jt_group_package_t group27;
        jt_group_package_t group28;
        jt_group_package_t group29;
        uint16_t crc;
}__attribute__((packed)) jt_group29_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_group_package_t group1;
        jt_group_package_t group2;
        jt_group_package_t group3;
        jt_group_package_t group4;
        jt_group_package_t group5;
        jt_group_package_t group6;
        jt_group_package_t group7;
        jt_group_package_t group8;
        jt_group_package_t group9;
        jt_group_package_t group10;
        jt_group_package_t group11;
        jt_group_package_t group12;
        jt_group_package_t group13;
        jt_group_package_t group14;
        jt_group_package_t group15;
        jt_group_package_t group16;
        jt_group_package_t group17;
        jt_group_package_t group18;
        jt_group_package_t group19;
        jt_group_package_t group20;
        jt_group_package_t group21;
        jt_group_package_t group22;
        jt_group_package_t group23;
        jt_group_package_t group24;
        jt_group_package_t group25;
        jt_group_package_t group26;
        jt_group_package_t group27;
        jt_group_package_t group28;
        jt_group_package_t group29;
        jt_group_package_t group30;
        uint16_t crc;
}__attribute__((packed)) jt_group30_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        uint16_t crc;
}__attribute__((packed)) jt_light_led1_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        uint16_t crc;
}__attribute__((packed)) jt_light_led2_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        uint16_t crc;
}__attribute__((packed)) jt_light_led3_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        uint16_t crc;
}__attribute__((packed)) jt_light_led4_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        uint16_t crc;
}__attribute__((packed)) jt_light_led5_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        uint16_t crc;
}__attribute__((packed)) jt_light_led6_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        uint16_t crc;
}__attribute__((packed)) jt_light_led7_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        uint16_t crc;
}__attribute__((packed)) jt_light_led8_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        uint16_t crc;
}__attribute__((packed)) jt_light_led9_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        uint16_t crc;
}__attribute__((packed)) jt_light_led10_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        uint16_t crc;
}__attribute__((packed)) jt_light_led11_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        uint16_t crc;
}__attribute__((packed)) jt_light_led12_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        uint16_t crc;
}__attribute__((packed)) jt_light_led13_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        uint16_t crc;
}__attribute__((packed)) jt_light_led14_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        uint16_t crc;
}__attribute__((packed)) jt_light_led15_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        uint16_t crc;
}__attribute__((packed)) jt_light_led16_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        uint16_t crc;
}__attribute__((packed)) jt_light_led17_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        uint16_t crc;
}__attribute__((packed)) jt_light_led18_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        uint16_t crc;
}__attribute__((packed)) jt_light_led19_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        jt_tag_package_t tag20;
        uint16_t crc;
}__attribute__((packed)) jt_light_led20_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        jt_tag_package_t tag20;
        jt_tag_package_t tag21;
        uint16_t crc;
}__attribute__((packed)) jt_light_led21_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        jt_tag_package_t tag20;
        jt_tag_package_t tag21;
        jt_tag_package_t tag22;
        uint16_t crc;
}__attribute__((packed)) jt_light_led22_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        jt_tag_package_t tag20;
        jt_tag_package_t tag21;
        jt_tag_package_t tag22;
        jt_tag_package_t tag23;
        uint16_t crc;
}__attribute__((packed)) jt_light_led23_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        jt_tag_package_t tag20;
        jt_tag_package_t tag21;
        jt_tag_package_t tag22;
        jt_tag_package_t tag23;
        jt_tag_package_t tag24;
        uint16_t crc;
}__attribute__((packed)) jt_light_led24_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        jt_tag_package_t tag20;
        jt_tag_package_t tag21;
        jt_tag_package_t tag22;
        jt_tag_package_t tag23;
        jt_tag_package_t tag24;
        jt_tag_package_t tag25;
        uint16_t crc;
}__attribute__((packed)) jt_light_led25_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        jt_tag_package_t tag20;
        jt_tag_package_t tag21;
        jt_tag_package_t tag22;
        jt_tag_package_t tag23;
        jt_tag_package_t tag24;
        jt_tag_package_t tag25;
        jt_tag_package_t tag26;
        uint16_t crc;
}__attribute__((packed)) jt_light_led26_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        jt_tag_package_t tag20;
        jt_tag_package_t tag21;
        jt_tag_package_t tag22;
        jt_tag_package_t tag23;
        jt_tag_package_t tag24;
        jt_tag_package_t tag25;
        jt_tag_package_t tag26;
        jt_tag_package_t tag27;
        uint16_t crc;
}__attribute__((packed)) jt_light_led27_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        jt_tag_package_t tag20;
        jt_tag_package_t tag21;
        jt_tag_package_t tag22;
        jt_tag_package_t tag23;
        jt_tag_package_t tag24;
        jt_tag_package_t tag25;
        jt_tag_package_t tag26;
        jt_tag_package_t tag27;
        jt_tag_package_t tag28;
        uint16_t crc;
}__attribute__((packed)) jt_light_led28_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        jt_tag_package_t tag20;
        jt_tag_package_t tag21;
        jt_tag_package_t tag22;
        jt_tag_package_t tag23;
        jt_tag_package_t tag24;
        jt_tag_package_t tag25;
        jt_tag_package_t tag26;
        jt_tag_package_t tag27;
        jt_tag_package_t tag28;
        jt_tag_package_t tag29;
        uint16_t crc;
}__attribute__((packed)) jt_light_led29_package_t;
typedef struct
{
        uint8_t len1;
        uint16_t len2;
        uint16_t customCode;
        jt_tag_package_t tag1;
        jt_tag_package_t tag2;
        jt_tag_package_t tag3;
        jt_tag_package_t tag4;
        jt_tag_package_t tag5;
        jt_tag_package_t tag6;
        jt_tag_package_t tag7;
        jt_tag_package_t tag8;
        jt_tag_package_t tag9;
        jt_tag_package_t tag10;
        jt_tag_package_t tag11;
        jt_tag_package_t tag12;
        jt_tag_package_t tag13;
        jt_tag_package_t tag14;
        jt_tag_package_t tag15;
        jt_tag_package_t tag16;
        jt_tag_package_t tag17;
        jt_tag_package_t tag18;
        jt_tag_package_t tag19;
        jt_tag_package_t tag20;
        jt_tag_package_t tag21;
        jt_tag_package_t tag22;
        jt_tag_package_t tag23;
        jt_tag_package_t tag24;
        jt_tag_package_t tag25;
        jt_tag_package_t tag26;
        jt_tag_package_t tag27;
        jt_tag_package_t tag28;
        jt_tag_package_t tag29;
        jt_tag_package_t tag30;
        uint16_t crc;
}__attribute__((packed)) jt_light_led30_package_t;

typedef struct
{
        uint8_t len;
        uint16_t customCode;
        uint8_t type;
        uint8_t bindStart;
        uint8_t bindEnd;
        uint32_t idStart;
        uint32_t idEnd;
        jt_led_or_group_package_t ledCtrl;
        uint16_t reserve;
        uint32_t crc;
}__attribute__((packed)) jt_id_package_t;

typedef struct
{
        uint16_t pre1;//$$ 0x2424
        uint16_t pre2;//$$ 0x2424
        uint16_t pre3;//$$ 0x2424 CC 0x4343 DD 0x4444
        uint16_t ack;//## 0x2323 complete TT 0x5454 timeout RR 0x5252 AP-reset EE 0x4545 AP-crc-error FF 0x4646 AP broadcast end
}__attribute__((packed)) jt_receive_package_t;
typedef struct
{
        uint16_t v1;
        uint16_t v2;
}__attribute__((packed)) jt_receive_version_package_t;
typedef struct
{
        uint16_t pre1;
        uint16_t pre2;
        uint16_t pre3;
        uint16_t pre4;
        uint16_t tagHead;
        uint32_t tag;
        uint8_t signal;
        uint8_t len;
        uint8_t featureCode;
        uint8_t count;
        uint8_t battery;
        uint16_t version;
        uint8_t ledCtrl;
        uint16_t signCode;
        uint16_t reserve;
        uint32_t lableParm;
        uint16_t crc;
}__attribute__((packed)) jt_data_back_package_t;


uint32_t CRC32_DIRECT(uint8_t *data, uint32_t length);
uint16_t CRC16_XMODEM(uint8_t *puchMsg, uint32_t usDataLen);

int uart_data_send_head(uart_utils_t *uart,uint8_t func,uint8_t wakeup_time,uint8_t timeout,uint16_t tag_num);

int uart_data_send_lighton_or_group(uart_utils_t *uart,jt_tag_package_t tags[],uint8_t tag_num);
int uart_data_send_lighton_by_group(uart_utils_t *uart,jt_group_package_t groups[],uint8_t tag_num);
int uart_data_send_lighton_by_id(uart_utils_t *uart,uint8_t bind_start,uint8_t bind_end,
                                 uint32_t id_start,uint32_t id_end,jt_led_or_group_package_t led_ctrl,uint16_t reserve);
int uart_data_receive_data_back(uart_utils_t *uart,uint16_t *parmAck,uint16_t *tagCodeHead,uint32_t *tagCode,uint8_t *tagSignal,
                               uint8_t *totalLen,uint8_t *tagFeature,uint8_t *count,uint8_t *batteryV,uint16_t *version,uint8_t *ledCtrl,
                               uint16_t *signCode,uint16_t *reserve,uint32_t *lableParm);
int uart_data_receive_ack(uart_utils_t *uart,uint16_t *parm_ack);
int uart_data_receive_version(uart_utils_t *uart);
#endif
