#include "uart_can.h"
#include "uart_utils.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#define PRINT_TIME_TAG
#define DBG_TAG "uart_can"
#define DBG_LVL DBG_INFO
#include "debug_print.h"
#define CRC32_POLY 0xEDB88320 // CRC32多项式
 
uint32_t CRC32_DIRECT(uint8_t *data, uint32_t length) {
    uint32_t crc = 0xFFFFFFFF; // 初始值通常设为0xFFFFFFFF
    for (size_t i = 0; i < length; i++) {
        crc ^= data[i];
        for (int j = 0; j < 8; j++) { // 对每个位进行处理
            if (crc & 1) {
                crc = (crc >> 1) ^ CRC32_POLY; // 多项式右移并异或
            } else {
                crc >>= 1; // 右移一位
            }
        }
    }
    return ~crc; // 最终结果取反，根据需要返回或使用原始值
}

uint16_t CRC16_XMODEM(uint8_t *puchMsg, uint32_t usDataLen)
{
    uint16_t wCRCin = 0x0000;
    uint16_t wCPoly = 0x1021;
    uint8_t wChar = 0;
    while (usDataLen--) {
        wChar = *(puchMsg++);
        wCRCin ^= (wChar << 8);

        for (int i = 0; i < 8; i++) {
            if (wCRCin & 0x8000) {
                wCRCin = (wCRCin << 1) ^ wCPoly;
            } else {
                wCRCin = wCRCin << 1;
            }
        }
    }
    return (wCRCin);
}

int uart_data_send_head(uart_utils_t *uart,uint8_t func,uint8_t wakeup_time,uint8_t timeout,uint16_t tag_num){
    int ret = 0;
    //uint8_t data_len=(tag_num*4+4)*2;
    uint8_t data_len=0;
    if(func==0x26){//&
        data_len=7+tag_num*2;
    }else{
        data_len=7+tag_num*4;
    }
    if(func==0x2A){//*
        tag_num=1;
        data_len=0x15;
    }
    if(func==0x52){//R
        tag_num=1;
        data_len=0x0B;
    }

    jt_head_package_t jt_head_package ={
        .pre=0x4040,//# 0x23 $ 0x24 @ 0x40
        .wakeupTime=wakeup_time,//5s,<120s
        .func=func,
        .len1=0x0000,
        .len2=data_len,
        .timeout=timeout,
        .reserve=0x00,
        .lableNum=ntohs(tag_num),
    };

    LOG_I("%s:HEAD:%04x,%02x,%02x,%04x,%02x,%02x,%02x,%04x\r\n",__func__,jt_head_package.pre,jt_head_package.wakeupTime,jt_head_package.func,
           jt_head_package.len1,jt_head_package.len2,jt_head_package.timeout,jt_head_package.reserve,jt_head_package.lableNum);

    if (uart == NULL){
        LOG_I("uart NULL pointer\n");
        ret = -1;
        goto error;
    }
    if(sizeof(jt_head_package) == write(uart->uart_fd, &jt_head_package, sizeof(jt_head_package))){
        ret = 0;
        //LOG_I("%s success\n",__func__);
    }else{
        //LOG_I("%s fail\n", __func__);
        ret = -2;
        goto error;
    }
error:
    return ret;
    return 0;
}

int uart_data_send_lighton_or_group(uart_utils_t *uart,jt_tag_package_t tags[],uint8_t tag_num){
    LOG_I("%s\n",__func__);
    int ret = 0;
    if (uart == NULL){
        LOG_I("uart NULL pointer\n");
        ret = -1;
        goto error;
    }

    uint16_t tags_len2=(tag_num+1)*8;
    uint16_t custom_code=0x0001;
    uint8_t tags_len2_1=(tags_len2>>8)&0xFF;
    uint8_t tags_len2_2=(tags_len2)&0xFF;
    uint8_t custom_code_1=(custom_code>>8)&0xFF;
    uint8_t custom_code_2=(custom_code)&0xFF;


    if(tag_num==1){
        uint8_t crc_data[9] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led1_package_t jt_light_led1_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led1_package) == write(uart->uart_fd, &jt_light_led1_package, sizeof(jt_light_led1_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==2){
        uint8_t crc_data[13] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led2_package_t jt_light_led2_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led2_package) == write(uart->uart_fd, &jt_light_led2_package, sizeof(jt_light_led2_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==3){
        uint8_t crc_data[17] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led3_package_t jt_light_led3_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led3_package) == write(uart->uart_fd, &jt_light_led3_package, sizeof(jt_light_led3_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==4){
        uint8_t crc_data[21] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led4_package_t jt_light_led4_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led4_package) == write(uart->uart_fd, &jt_light_led4_package, sizeof(jt_light_led4_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==5){
        uint8_t crc_data[25] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led5_package_t jt_light_led5_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led5_package) == write(uart->uart_fd, &jt_light_led5_package, sizeof(jt_light_led5_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==6){
        uint8_t crc_data[29] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led6_package_t jt_light_led6_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led6_package) == write(uart->uart_fd, &jt_light_led6_package, sizeof(jt_light_led6_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==7){
        uint8_t crc_data[33] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led7_package_t jt_light_led7_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led7_package) == write(uart->uart_fd, &jt_light_led7_package, sizeof(jt_light_led7_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==8){
        uint8_t crc_data[37] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led8_package_t jt_light_led8_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led8_package) == write(uart->uart_fd, &jt_light_led8_package, sizeof(jt_light_led8_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==9){
        uint8_t crc_data[41] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led9_package_t jt_light_led9_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led9_package) == write(uart->uart_fd, &jt_light_led9_package, sizeof(jt_light_led9_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==10){
        uint8_t crc_data[45] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led10_package_t jt_light_led10_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led10_package) == write(uart->uart_fd, &jt_light_led10_package, sizeof(jt_light_led10_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==11){
        uint8_t crc_data[49] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led11_package_t jt_light_led11_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led11_package) == write(uart->uart_fd, &jt_light_led11_package, sizeof(jt_light_led11_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==12){
        uint8_t crc_data[53] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led12_package_t jt_light_led12_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led12_package) == write(uart->uart_fd, &jt_light_led12_package, sizeof(jt_light_led12_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==13){
        uint8_t crc_data[57] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led13_package_t jt_light_led13_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led13_package) == write(uart->uart_fd, &jt_light_led13_package, sizeof(jt_light_led13_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==14){
        uint8_t crc_data[61] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led14_package_t jt_light_led14_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led14_package) == write(uart->uart_fd, &jt_light_led14_package, sizeof(jt_light_led14_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==15){
        uint8_t crc_data[65] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led15_package_t jt_light_led15_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led15_package) == write(uart->uart_fd, &jt_light_led15_package, sizeof(jt_light_led15_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==16){
        uint8_t crc_data[69] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led16_package_t jt_light_led16_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led16_package) == write(uart->uart_fd, &jt_light_led16_package, sizeof(jt_light_led16_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==17){
        uint8_t crc_data[73] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led17_package_t jt_light_led17_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led17_package) == write(uart->uart_fd, &jt_light_led17_package, sizeof(jt_light_led17_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==18){
        uint8_t crc_data[77] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led18_package_t jt_light_led18_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led18_package) == write(uart->uart_fd, &jt_light_led18_package, sizeof(jt_light_led18_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==19){
        uint8_t crc_data[81] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led19_package_t jt_light_led19_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led19_package) == write(uart->uart_fd, &jt_light_led19_package, sizeof(jt_light_led19_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==20){
        uint8_t crc_data[85] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group,
                                tags[19].tag_1,tags[19].tag_2,tags[19].tag_3,tags[19].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led20_package_t jt_light_led20_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .tag20=tags[19],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led20_package) == write(uart->uart_fd, &jt_light_led20_package, sizeof(jt_light_led20_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==21){
        uint8_t crc_data[89] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group,
                                tags[19].tag_1,tags[19].tag_2,tags[19].tag_3,tags[19].tag_led_or_group.group,
                                tags[20].tag_1,tags[20].tag_2,tags[20].tag_3,tags[20].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led21_package_t jt_light_led21_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .tag20=tags[19],
            .tag21=tags[20],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led21_package) == write(uart->uart_fd, &jt_light_led21_package, sizeof(jt_light_led21_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==22){
        uint8_t crc_data[93] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group,
                                tags[19].tag_1,tags[19].tag_2,tags[19].tag_3,tags[19].tag_led_or_group.group,
                                tags[20].tag_1,tags[20].tag_2,tags[20].tag_3,tags[20].tag_led_or_group.group,
                                tags[21].tag_1,tags[21].tag_2,tags[21].tag_3,tags[21].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led22_package_t jt_light_led22_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .tag20=tags[19],
            .tag21=tags[20],
            .tag22=tags[21],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led22_package) == write(uart->uart_fd, &jt_light_led22_package, sizeof(jt_light_led22_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==23){
        uint8_t crc_data[97] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group,
                                tags[19].tag_1,tags[19].tag_2,tags[19].tag_3,tags[19].tag_led_or_group.group,
                                tags[20].tag_1,tags[20].tag_2,tags[20].tag_3,tags[20].tag_led_or_group.group,
                                tags[21].tag_1,tags[21].tag_2,tags[21].tag_3,tags[21].tag_led_or_group.group,
                                tags[22].tag_1,tags[22].tag_2,tags[22].tag_3,tags[22].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led23_package_t jt_light_led23_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .tag20=tags[19],
            .tag21=tags[20],
            .tag22=tags[21],
            .tag23=tags[22],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led23_package) == write(uart->uart_fd, &jt_light_led23_package, sizeof(jt_light_led23_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==24){
        uint8_t crc_data[101] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group,
                                tags[19].tag_1,tags[19].tag_2,tags[19].tag_3,tags[19].tag_led_or_group.group,
                                tags[20].tag_1,tags[20].tag_2,tags[20].tag_3,tags[20].tag_led_or_group.group,
                                tags[21].tag_1,tags[21].tag_2,tags[21].tag_3,tags[21].tag_led_or_group.group,
                                tags[22].tag_1,tags[22].tag_2,tags[22].tag_3,tags[22].tag_led_or_group.group,
                                tags[23].tag_1,tags[23].tag_2,tags[23].tag_3,tags[23].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led24_package_t jt_light_led24_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .tag20=tags[19],
            .tag21=tags[20],
            .tag22=tags[21],
            .tag23=tags[22],
            .tag24=tags[23],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led24_package) == write(uart->uart_fd, &jt_light_led24_package, sizeof(jt_light_led24_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==25){
        uint8_t crc_data[105] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group,
                                tags[19].tag_1,tags[19].tag_2,tags[19].tag_3,tags[19].tag_led_or_group.group,
                                tags[20].tag_1,tags[20].tag_2,tags[20].tag_3,tags[20].tag_led_or_group.group,
                                tags[21].tag_1,tags[21].tag_2,tags[21].tag_3,tags[21].tag_led_or_group.group,
                                tags[22].tag_1,tags[22].tag_2,tags[22].tag_3,tags[22].tag_led_or_group.group,
                                tags[23].tag_1,tags[23].tag_2,tags[23].tag_3,tags[23].tag_led_or_group.group,
                                tags[24].tag_1,tags[24].tag_2,tags[24].tag_3,tags[24].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led25_package_t jt_light_led25_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .tag20=tags[19],
            .tag21=tags[20],
            .tag22=tags[21],
            .tag23=tags[22],
            .tag24=tags[23],
            .tag25=tags[24],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led25_package) == write(uart->uart_fd, &jt_light_led25_package, sizeof(jt_light_led25_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==26){
        uint8_t crc_data[109] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group,
                                tags[19].tag_1,tags[19].tag_2,tags[19].tag_3,tags[19].tag_led_or_group.group,
                                tags[20].tag_1,tags[20].tag_2,tags[20].tag_3,tags[20].tag_led_or_group.group,
                                tags[21].tag_1,tags[21].tag_2,tags[21].tag_3,tags[21].tag_led_or_group.group,
                                tags[22].tag_1,tags[22].tag_2,tags[22].tag_3,tags[22].tag_led_or_group.group,
                                tags[23].tag_1,tags[23].tag_2,tags[23].tag_3,tags[23].tag_led_or_group.group,
                                tags[24].tag_1,tags[24].tag_2,tags[24].tag_3,tags[24].tag_led_or_group.group,
                                tags[25].tag_1,tags[25].tag_2,tags[25].tag_3,tags[25].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led26_package_t jt_light_led26_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .tag20=tags[19],
            .tag21=tags[20],
            .tag22=tags[21],
            .tag23=tags[22],
            .tag24=tags[23],
            .tag25=tags[24],
            .tag26=tags[25],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led26_package) == write(uart->uart_fd, &jt_light_led26_package, sizeof(jt_light_led26_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==27){
        uint8_t crc_data[113] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group,
                                tags[19].tag_1,tags[19].tag_2,tags[19].tag_3,tags[19].tag_led_or_group.group,
                                tags[20].tag_1,tags[20].tag_2,tags[20].tag_3,tags[20].tag_led_or_group.group,
                                tags[21].tag_1,tags[21].tag_2,tags[21].tag_3,tags[21].tag_led_or_group.group,
                                tags[22].tag_1,tags[22].tag_2,tags[22].tag_3,tags[22].tag_led_or_group.group,
                                tags[23].tag_1,tags[23].tag_2,tags[23].tag_3,tags[23].tag_led_or_group.group,
                                tags[24].tag_1,tags[24].tag_2,tags[24].tag_3,tags[24].tag_led_or_group.group,
                                tags[25].tag_1,tags[25].tag_2,tags[25].tag_3,tags[25].tag_led_or_group.group,
                                tags[26].tag_1,tags[26].tag_2,tags[26].tag_3,tags[26].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led27_package_t jt_light_led27_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .tag20=tags[19],
            .tag21=tags[20],
            .tag22=tags[21],
            .tag23=tags[22],
            .tag24=tags[23],
            .tag25=tags[24],
            .tag26=tags[25],
            .tag27=tags[26],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led27_package) == write(uart->uart_fd, &jt_light_led27_package, sizeof(jt_light_led27_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==28){
        uint8_t crc_data[117] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group,
                                tags[19].tag_1,tags[19].tag_2,tags[19].tag_3,tags[19].tag_led_or_group.group,
                                tags[20].tag_1,tags[20].tag_2,tags[20].tag_3,tags[20].tag_led_or_group.group,
                                tags[21].tag_1,tags[21].tag_2,tags[21].tag_3,tags[21].tag_led_or_group.group,
                                tags[22].tag_1,tags[22].tag_2,tags[22].tag_3,tags[22].tag_led_or_group.group,
                                tags[23].tag_1,tags[23].tag_2,tags[23].tag_3,tags[23].tag_led_or_group.group,
                                tags[24].tag_1,tags[24].tag_2,tags[24].tag_3,tags[24].tag_led_or_group.group,
                                tags[25].tag_1,tags[25].tag_2,tags[25].tag_3,tags[25].tag_led_or_group.group,
                                tags[26].tag_1,tags[26].tag_2,tags[26].tag_3,tags[26].tag_led_or_group.group,
                                tags[27].tag_1,tags[27].tag_2,tags[27].tag_3,tags[27].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led28_package_t jt_light_led28_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .tag20=tags[19],
            .tag21=tags[20],
            .tag22=tags[21],
            .tag23=tags[22],
            .tag24=tags[23],
            .tag25=tags[24],
            .tag26=tags[25],
            .tag27=tags[26],
            .tag28=tags[27],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led28_package) == write(uart->uart_fd, &jt_light_led28_package, sizeof(jt_light_led28_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==29){
        uint8_t crc_data[121] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group,
                                tags[19].tag_1,tags[19].tag_2,tags[19].tag_3,tags[19].tag_led_or_group.group,
                                tags[20].tag_1,tags[20].tag_2,tags[20].tag_3,tags[20].tag_led_or_group.group,
                                tags[21].tag_1,tags[21].tag_2,tags[21].tag_3,tags[21].tag_led_or_group.group,
                                tags[22].tag_1,tags[22].tag_2,tags[22].tag_3,tags[22].tag_led_or_group.group,
                                tags[23].tag_1,tags[23].tag_2,tags[23].tag_3,tags[23].tag_led_or_group.group,
                                tags[24].tag_1,tags[24].tag_2,tags[24].tag_3,tags[24].tag_led_or_group.group,
                                tags[25].tag_1,tags[25].tag_2,tags[25].tag_3,tags[25].tag_led_or_group.group,
                                tags[26].tag_1,tags[26].tag_2,tags[26].tag_3,tags[26].tag_led_or_group.group,
                                tags[27].tag_1,tags[27].tag_2,tags[27].tag_3,tags[27].tag_led_or_group.group,
                                tags[28].tag_1,tags[28].tag_2,tags[28].tag_3,tags[28].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led29_package_t jt_light_led29_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .tag20=tags[19],
            .tag21=tags[20],
            .tag22=tags[21],
            .tag23=tags[22],
            .tag24=tags[23],
            .tag25=tags[24],
            .tag26=tags[25],
            .tag27=tags[26],
            .tag28=tags[27],
            .tag29=tags[28],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led29_package) == write(uart->uart_fd, &jt_light_led29_package, sizeof(jt_light_led29_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==30){
        uint8_t crc_data[125] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                tags[0].tag_1,tags[0].tag_2,tags[0].tag_3,tags[0].tag_led_or_group.group,
                                tags[1].tag_1,tags[1].tag_2,tags[1].tag_3,tags[1].tag_led_or_group.group,
                                tags[2].tag_1,tags[2].tag_2,tags[2].tag_3,tags[2].tag_led_or_group.group,
                                tags[3].tag_1,tags[3].tag_2,tags[3].tag_3,tags[3].tag_led_or_group.group,
                                tags[4].tag_1,tags[4].tag_2,tags[4].tag_3,tags[4].tag_led_or_group.group,
                                tags[5].tag_1,tags[5].tag_2,tags[5].tag_3,tags[5].tag_led_or_group.group,
                                tags[6].tag_1,tags[6].tag_2,tags[6].tag_3,tags[6].tag_led_or_group.group,
                                tags[7].tag_1,tags[7].tag_2,tags[7].tag_3,tags[7].tag_led_or_group.group,
                                tags[8].tag_1,tags[8].tag_2,tags[8].tag_3,tags[8].tag_led_or_group.group,
                                tags[9].tag_1,tags[9].tag_2,tags[9].tag_3,tags[9].tag_led_or_group.group,
                                tags[10].tag_1,tags[10].tag_2,tags[10].tag_3,tags[10].tag_led_or_group.group,
                                tags[11].tag_1,tags[11].tag_2,tags[11].tag_3,tags[11].tag_led_or_group.group,
                                tags[12].tag_1,tags[12].tag_2,tags[12].tag_3,tags[12].tag_led_or_group.group,
                                tags[13].tag_1,tags[13].tag_2,tags[13].tag_3,tags[13].tag_led_or_group.group,
                                tags[14].tag_1,tags[14].tag_2,tags[14].tag_3,tags[14].tag_led_or_group.group,
                                tags[15].tag_1,tags[15].tag_2,tags[15].tag_3,tags[15].tag_led_or_group.group,
                                tags[16].tag_1,tags[16].tag_2,tags[16].tag_3,tags[16].tag_led_or_group.group,
                                tags[17].tag_1,tags[17].tag_2,tags[17].tag_3,tags[17].tag_led_or_group.group,
                                tags[18].tag_1,tags[18].tag_2,tags[18].tag_3,tags[18].tag_led_or_group.group,
                                tags[19].tag_1,tags[19].tag_2,tags[19].tag_3,tags[19].tag_led_or_group.group,
                                tags[20].tag_1,tags[20].tag_2,tags[20].tag_3,tags[20].tag_led_or_group.group,
                                tags[21].tag_1,tags[21].tag_2,tags[21].tag_3,tags[21].tag_led_or_group.group,
                                tags[22].tag_1,tags[22].tag_2,tags[22].tag_3,tags[22].tag_led_or_group.group,
                                tags[23].tag_1,tags[23].tag_2,tags[23].tag_3,tags[23].tag_led_or_group.group,
                                tags[24].tag_1,tags[24].tag_2,tags[24].tag_3,tags[24].tag_led_or_group.group,
                                tags[25].tag_1,tags[25].tag_2,tags[25].tag_3,tags[25].tag_led_or_group.group,
                                tags[26].tag_1,tags[26].tag_2,tags[26].tag_3,tags[26].tag_led_or_group.group,
                                tags[27].tag_1,tags[27].tag_2,tags[27].tag_3,tags[27].tag_led_or_group.group,
                                tags[28].tag_1,tags[28].tag_2,tags[28].tag_3,tags[28].tag_led_or_group.group,
                                tags[29].tag_1,tags[29].tag_2,tags[29].tag_3,tags[29].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_light_led30_package_t jt_light_led30_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .tag1=tags[0],
            .tag2=tags[1],
            .tag3=tags[2],
            .tag4=tags[3],
            .tag5=tags[4],
            .tag6=tags[5],
            .tag7=tags[6],
            .tag8=tags[7],
            .tag9=tags[8],
            .tag10=tags[9],
            .tag11=tags[10],
            .tag12=tags[11],
            .tag13=tags[12],
            .tag14=tags[13],
            .tag15=tags[14],
            .tag16=tags[15],
            .tag17=tags[16],
            .tag18=tags[17],
            .tag19=tags[18],
            .tag20=tags[19],
            .tag21=tags[20],
            .tag22=tags[21],
            .tag23=tags[22],
            .tag24=tags[23],
            .tag25=tags[24],
            .tag26=tags[25],
            .tag27=tags[26],
            .tag28=tags[27],
            .tag29=tags[28],
            .tag30=tags[29],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_light_led30_package) == write(uart->uart_fd, &jt_light_led30_package, sizeof(jt_light_led30_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }

error:
    return ret;
    return 0;
}

int uart_data_send_lighton_by_group(uart_utils_t *uart,jt_group_package_t groups[],uint8_t tag_num){
    int ret = 0;
    if (uart == NULL){
        LOG_I("uart NULL pointer\n");
        ret = -1;
        goto error;
    }

    uint16_t tags_len2=(tag_num*2+4)*2;
    uint16_t custom_code=0x0001;
    uint8_t tags_len2_1=(tags_len2>>8)&0xFF;
    uint8_t tags_len2_2=(tags_len2)&0xFF;
    uint8_t custom_code_1=(custom_code>>8)&0xFF;
    uint8_t custom_code_2=(custom_code)&0xFF;

    if(tag_num==1){
        uint8_t crc_data[7] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group1_package_t jt_group1_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group1_package) == write(uart->uart_fd, &jt_group1_package, sizeof(jt_group1_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==2){
        uint8_t crc_data[9] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group2_package_t jt_group2_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group2_package) == write(uart->uart_fd, &jt_group2_package, sizeof(jt_group2_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==3){
        uint8_t crc_data[11] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group3_package_t jt_group3_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group3_package) == write(uart->uart_fd, &jt_group3_package, sizeof(jt_group3_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==4){
        uint8_t crc_data[13] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group4_package_t jt_group4_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group4_package) == write(uart->uart_fd, &jt_group4_package, sizeof(jt_group4_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==5){
        uint8_t crc_data[15] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group5_package_t jt_group5_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group5_package) == write(uart->uart_fd, &jt_group5_package, sizeof(jt_group5_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==6){
        uint8_t crc_data[17] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group6_package_t jt_group6_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group6_package) == write(uart->uart_fd, &jt_group6_package, sizeof(jt_group6_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==7){
        uint8_t crc_data[19] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group7_package_t jt_group7_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group7_package) == write(uart->uart_fd, &jt_group7_package, sizeof(jt_group7_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==8){
        uint8_t crc_data[21] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group8_package_t jt_group8_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group8_package) == write(uart->uart_fd, &jt_group8_package, sizeof(jt_group8_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==9){
        uint8_t crc_data[23] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group9_package_t jt_group9_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group9_package) == write(uart->uart_fd, &jt_group9_package, sizeof(jt_group9_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==10){
        uint8_t crc_data[25] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group10_package_t jt_group10_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group10_package) == write(uart->uart_fd, &jt_group10_package, sizeof(jt_group10_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==11){
        uint8_t crc_data[27] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group11_package_t jt_group11_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group11_package) == write(uart->uart_fd, &jt_group11_package, sizeof(jt_group11_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==12){
        uint8_t crc_data[29] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group12_package_t jt_group12_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group12_package) == write(uart->uart_fd, &jt_group12_package, sizeof(jt_group12_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==13){
        uint8_t crc_data[31] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group13_package_t jt_group13_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group13_package) == write(uart->uart_fd, &jt_group13_package, sizeof(jt_group13_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==14){
        uint8_t crc_data[33] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group14_package_t jt_group14_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group14_package) == write(uart->uart_fd, &jt_group14_package, sizeof(jt_group14_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==15){
        uint8_t crc_data[35] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group15_package_t jt_group15_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group15_package) == write(uart->uart_fd, &jt_group15_package, sizeof(jt_group15_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==16){
        uint8_t crc_data[37] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group16_package_t jt_group16_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group16_package) == write(uart->uart_fd, &jt_group16_package, sizeof(jt_group16_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==17){
        uint8_t crc_data[39] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group17_package_t jt_group17_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group17_package) == write(uart->uart_fd, &jt_group17_package, sizeof(jt_group17_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==18){
        uint8_t crc_data[41] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group18_package_t jt_group18_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group18_package) == write(uart->uart_fd, &jt_group18_package, sizeof(jt_group18_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==19){
        uint8_t crc_data[43] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group19_package_t jt_group19_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group19_package) == write(uart->uart_fd, &jt_group19_package, sizeof(jt_group19_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==20){
        uint8_t crc_data[45] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group,
                                groups[19].group,groups[19].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group20_package_t jt_group20_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .group20=groups[19],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group20_package) == write(uart->uart_fd, &jt_group20_package, sizeof(jt_group20_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==21){
        uint8_t crc_data[47] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group,
                                groups[19].group,groups[19].tag_led_or_group.group,
                                groups[20].group,groups[20].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group21_package_t jt_group21_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .group20=groups[19],
            .group21=groups[20],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group21_package) == write(uart->uart_fd, &jt_group21_package, sizeof(jt_group21_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==22){
        uint8_t crc_data[49] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group,
                                groups[19].group,groups[19].tag_led_or_group.group,
                                groups[20].group,groups[20].tag_led_or_group.group,
                                groups[21].group,groups[21].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group22_package_t jt_group22_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .group20=groups[19],
            .group21=groups[20],
            .group22=groups[21],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group22_package) == write(uart->uart_fd, &jt_group22_package, sizeof(jt_group22_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==23){
        uint8_t crc_data[51] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group,
                                groups[19].group,groups[19].tag_led_or_group.group,
                                groups[20].group,groups[20].tag_led_or_group.group,
                                groups[21].group,groups[21].tag_led_or_group.group,
                                groups[22].group,groups[22].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group23_package_t jt_group23_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .group20=groups[19],
            .group21=groups[20],
            .group22=groups[21],
            .group23=groups[22],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group23_package) == write(uart->uart_fd, &jt_group23_package, sizeof(jt_group23_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==24){
        uint8_t crc_data[53] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group,
                                groups[19].group,groups[19].tag_led_or_group.group,
                                groups[20].group,groups[20].tag_led_or_group.group,
                                groups[21].group,groups[21].tag_led_or_group.group,
                                groups[22].group,groups[22].tag_led_or_group.group,
                                groups[23].group,groups[23].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group24_package_t jt_group24_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .group20=groups[19],
            .group21=groups[20],
            .group22=groups[21],
            .group23=groups[22],
            .group24=groups[23],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group24_package) == write(uart->uart_fd, &jt_group24_package, sizeof(jt_group24_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==25){
        uint8_t crc_data[55] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group,
                                groups[19].group,groups[19].tag_led_or_group.group,
                                groups[20].group,groups[20].tag_led_or_group.group,
                                groups[21].group,groups[21].tag_led_or_group.group,
                                groups[22].group,groups[22].tag_led_or_group.group,
                                groups[23].group,groups[23].tag_led_or_group.group,
                                groups[24].group,groups[24].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group25_package_t jt_group25_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .group20=groups[19],
            .group21=groups[20],
            .group22=groups[21],
            .group23=groups[22],
            .group24=groups[23],
            .group25=groups[24],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group25_package) == write(uart->uart_fd, &jt_group25_package, sizeof(jt_group25_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==26){
        uint8_t crc_data[57] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group,
                                groups[19].group,groups[19].tag_led_or_group.group,
                                groups[20].group,groups[20].tag_led_or_group.group,
                                groups[21].group,groups[21].tag_led_or_group.group,
                                groups[22].group,groups[22].tag_led_or_group.group,
                                groups[23].group,groups[23].tag_led_or_group.group,
                                groups[24].group,groups[24].tag_led_or_group.group,
                                groups[25].group,groups[25].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group26_package_t jt_group26_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .group20=groups[19],
            .group21=groups[20],
            .group22=groups[21],
            .group23=groups[22],
            .group24=groups[23],
            .group25=groups[24],
            .group26=groups[25],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group26_package) == write(uart->uart_fd, &jt_group26_package, sizeof(jt_group26_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==27){
        uint8_t crc_data[59] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group,
                                groups[19].group,groups[19].tag_led_or_group.group,
                                groups[20].group,groups[20].tag_led_or_group.group,
                                groups[21].group,groups[21].tag_led_or_group.group,
                                groups[22].group,groups[22].tag_led_or_group.group,
                                groups[23].group,groups[23].tag_led_or_group.group,
                                groups[24].group,groups[24].tag_led_or_group.group,
                                groups[25].group,groups[25].tag_led_or_group.group,
                                groups[26].group,groups[26].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group27_package_t jt_group27_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .group20=groups[19],
            .group21=groups[20],
            .group22=groups[21],
            .group23=groups[22],
            .group24=groups[23],
            .group25=groups[24],
            .group26=groups[25],
            .group27=groups[26],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group27_package) == write(uart->uart_fd, &jt_group27_package, sizeof(jt_group27_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==28){
        uint8_t crc_data[61] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group,
                                groups[19].group,groups[19].tag_led_or_group.group,
                                groups[20].group,groups[20].tag_led_or_group.group,
                                groups[21].group,groups[21].tag_led_or_group.group,
                                groups[22].group,groups[22].tag_led_or_group.group,
                                groups[23].group,groups[23].tag_led_or_group.group,
                                groups[24].group,groups[24].tag_led_or_group.group,
                                groups[25].group,groups[25].tag_led_or_group.group,
                                groups[26].group,groups[26].tag_led_or_group.group,
                                groups[27].group,groups[27].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group28_package_t jt_group28_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .group20=groups[19],
            .group21=groups[20],
            .group22=groups[21],
            .group23=groups[22],
            .group24=groups[23],
            .group25=groups[24],
            .group26=groups[25],
            .group27=groups[26],
            .group28=groups[27],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group28_package) == write(uart->uart_fd, &jt_group28_package, sizeof(jt_group28_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==29){
        uint8_t crc_data[63] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group,
                                groups[19].group,groups[19].tag_led_or_group.group,
                                groups[20].group,groups[20].tag_led_or_group.group,
                                groups[21].group,groups[21].tag_led_or_group.group,
                                groups[22].group,groups[22].tag_led_or_group.group,
                                groups[23].group,groups[23].tag_led_or_group.group,
                                groups[24].group,groups[24].tag_led_or_group.group,
                                groups[25].group,groups[25].tag_led_or_group.group,
                                groups[26].group,groups[26].tag_led_or_group.group,
                                groups[27].group,groups[27].tag_led_or_group.group,
                                groups[28].group,groups[28].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group29_package_t jt_group29_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .group20=groups[19],
            .group21=groups[20],
            .group22=groups[21],
            .group23=groups[22],
            .group24=groups[23],
            .group25=groups[24],
            .group26=groups[25],
            .group27=groups[26],
            .group28=groups[27],
            .group29=groups[28],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group29_package) == write(uart->uart_fd, &jt_group29_package, sizeof(jt_group29_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }else if(tag_num==30){
        uint8_t crc_data[65] = {0x00,tags_len2_1,tags_len2_2,custom_code_1,custom_code_2,
                                groups[0].group,groups[0].tag_led_or_group.group,
                                groups[1].group,groups[1].tag_led_or_group.group,
                                groups[2].group,groups[2].tag_led_or_group.group,
                                groups[3].group,groups[3].tag_led_or_group.group,
                                groups[4].group,groups[4].tag_led_or_group.group,
                                groups[5].group,groups[5].tag_led_or_group.group,
                                groups[6].group,groups[6].tag_led_or_group.group,
                                groups[7].group,groups[7].tag_led_or_group.group,
                                groups[8].group,groups[8].tag_led_or_group.group,
                                groups[9].group,groups[9].tag_led_or_group.group,
                                groups[10].group,groups[10].tag_led_or_group.group,
                                groups[11].group,groups[11].tag_led_or_group.group,
                                groups[12].group,groups[12].tag_led_or_group.group,
                                groups[13].group,groups[13].tag_led_or_group.group,
                                groups[14].group,groups[14].tag_led_or_group.group,
                                groups[15].group,groups[15].tag_led_or_group.group,
                                groups[16].group,groups[16].tag_led_or_group.group,
                                groups[17].group,groups[17].tag_led_or_group.group,
                                groups[18].group,groups[18].tag_led_or_group.group,
                                groups[19].group,groups[19].tag_led_or_group.group,
                                groups[20].group,groups[20].tag_led_or_group.group,
                                groups[21].group,groups[21].tag_led_or_group.group,
                                groups[22].group,groups[22].tag_led_or_group.group,
                                groups[23].group,groups[23].tag_led_or_group.group,
                                groups[24].group,groups[24].tag_led_or_group.group,
                                groups[25].group,groups[25].tag_led_or_group.group,
                                groups[26].group,groups[26].tag_led_or_group.group,
                                groups[27].group,groups[27].tag_led_or_group.group,
                                groups[28].group,groups[28].tag_led_or_group.group,
                                groups[29].group,groups[29].tag_led_or_group.group};
        uint16_t crc_c=CRC16_XMODEM(crc_data,sizeof(crc_data));
        for(int i=0;i<sizeof(crc_data);i++){
            printf("%02x ",crc_data[i]);
        }
        LOG_I("\r\n");
        LOG_I("%s XModem_CRC16 = %04x\r\n",__func__,crc_c);
        jt_group30_package_t jt_group30_package ={
            .len1=0x00,
            .len2=ntohs(tags_len2),
            .customCode=ntohs(custom_code),
            .group1=groups[0],
            .group2=groups[1],
            .group3=groups[2],
            .group4=groups[3],
            .group5=groups[4],
            .group6=groups[5],
            .group7=groups[6],
            .group8=groups[7],
            .group9=groups[8],
            .group10=groups[9],
            .group11=groups[10],
            .group12=groups[11],
            .group13=groups[12],
            .group14=groups[13],
            .group15=groups[14],
            .group16=groups[15],
            .group17=groups[16],
            .group18=groups[17],
            .group19=groups[18],
            .group20=groups[19],
            .group21=groups[20],
            .group22=groups[21],
            .group23=groups[22],
            .group24=groups[23],
            .group25=groups[24],
            .group26=groups[25],
            .group27=groups[26],
            .group28=groups[27],
            .group29=groups[28],
            .group30=groups[29],
            .crc=ntohs(crc_c),
        };
        if(sizeof(jt_group30_package) == write(uart->uart_fd, &jt_group30_package, sizeof(jt_group30_package))){
            ret = 0;
            //LOG_I("%s success\n",__func__);
        }else{
            //LOG_I("%s fail\n", __func__);
            ret = -2;
            goto error;
        }
    }
error:
    return ret;
    return 0;
}

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 ret = 0;
    if (uart == NULL){
        LOG_I("uart NULL pointer\n");
        ret = -1;
        goto error;
    }

    uint16_t custom_code=0x0001;
    uint8_t custom_code_1=(custom_code>>8)&0xFF;
    uint8_t custom_code_2=(custom_code)&0xFF;

    uint8_t id_start_1=(id_start>>24)&0xFF;
    uint8_t id_start_2=(id_start>>16)&0xFF;
    uint8_t id_start_3=(id_start>>8)&0xFF;
    uint8_t id_start_4=(id_start)&0xFF;
    
    uint8_t id_end_1=(id_end>>24)&0xFF;
    uint8_t id_end_2=(id_end>>16)&0xFF;
    uint8_t id_end_3=(id_end>>8)&0xFF;
    uint8_t id_end_4=(id_end)&0xFF;
     
    uint8_t reserve_1=(reserve>>8)&0xFF;
    uint8_t reserve_2=(reserve)&0xFF;

    uint8_t crc_data[17] = {0x14,custom_code_1,custom_code_2,0xFF,bind_start,bind_end,id_start_1,id_start_2,id_start_3,id_start_4,
                           id_end_1,id_end_2,id_end_3,id_end_4,led_ctrl.group,reserve_1,reserve_2};
    uint32_t crc_c=CRC32_DIRECT(crc_data,sizeof(crc_data));
    for(int i=0;i<sizeof(crc_data);i++){
        printf("%02x ",crc_data[i]);
    }
    LOG_I("\r\n");
    LOG_I("%s DIRECT_CRC32 = %04x\r\n",__func__,crc_c);
    jt_id_package_t jt_id_package ={
        .len=0x14,
        .customCode=ntohs(custom_code),
        .type=0xFF,
        .bindStart=bind_start,
        .bindEnd=bind_end,
        .idStart=ntohl(id_start),
        .idEnd=ntohl(id_end),
        .ledCtrl=led_ctrl,
        .reserve=ntohs(reserve),
        .crc=ntohl(crc_c),
    };
    if(sizeof(jt_id_package) == write(uart->uart_fd, &jt_id_package, sizeof(jt_id_package))){
        ret = 0;
        //LOG_I("%s success\n",__func__);
    }else{
        //LOG_I("%s fail\n", __func__);
        ret = -2;
        goto error;
    }

error:
    return ret;
    return 0;
}

int uart_data_receive_ack(uart_utils_t *uart,uint16_t *parm_ack){
    int ret = 0;
    jt_receive_package_t jt_receive_package;
    ret = uart_read_until_time(uart->uart_fd,(char *)&jt_receive_package,sizeof(jt_receive_package_t), 1000, 50);
    if(ret == sizeof(jt_receive_package_t)){
        LOG_I("%s success:%04x,%04x,%04x,%04x\n", __func__,jt_receive_package.pre1,jt_receive_package.pre2,
                                                           jt_receive_package.pre3,jt_receive_package.ack);
        if((jt_receive_package.pre1 == 0x2424)
                &&(jt_receive_package.pre2 == 0x2424)
                &&(jt_receive_package.pre3 == 0x2424)){
                *parm_ack=jt_receive_package.ack;
        }else{
            LOG_I("%s failed\n", __func__);
            ret = -2;
        }
    }else{
        LOG_I("%s, failed, time out\n", __func__);
        ret = -1;
    }

    return ret;
}

int uart_data_receive_version(uart_utils_t *uart){
    int ret = 0;
    jt_receive_version_package_t jt_receive_version_package;
    ret = uart_read_until_time(uart->uart_fd,(char *)&jt_receive_version_package,sizeof(jt_receive_version_package_t), 1000, 50);
    if(ret == sizeof(jt_receive_version_package_t)){
        LOG_I("%s success:%04x,%04x\n", __func__,jt_receive_version_package.v1,jt_receive_version_package.v2);
    }else{
        LOG_I("%s, failed, time out\n", __func__);
        ret = -1;
    }

    return ret;
}


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 ret = 0;
    jt_data_back_package_t jt_data_back_package;
    ret = uart_read_until_time(uart->uart_fd,(char *)&jt_data_back_package,sizeof(jt_data_back_package_t), 1000, 50);
    if(ret == sizeof(jt_data_back_package_t)){
        //LOG_I("%s success\n", __func__);
        if((jt_data_back_package.pre1 == 0x2424)
                &&(jt_data_back_package.pre2 == 0x2424)
                &&(jt_data_back_package.pre3 == 0x2424)){
                uint8_t version_1=(ntohs(jt_data_back_package.version)>>8)&0xFF;
                uint8_t version_2=(ntohs(jt_data_back_package.version))&0xFF;
                uint8_t signCode_1=(ntohs(jt_data_back_package.signCode)>>8)&0xFF;
                uint8_t signCode_2=(ntohs(jt_data_back_package.signCode))&0xFF;
                uint8_t reserve_1=(ntohs(jt_data_back_package.reserve)>>8)&0xFF;
                uint8_t reserve_2=(ntohs(jt_data_back_package.reserve))&0xFF;
                uint8_t lableParm_1=(ntohl(jt_data_back_package.lableParm)>>24)&0xFF;
                uint8_t lableParm_2=(ntohl(jt_data_back_package.lableParm)>>16)&0xFF;
                uint8_t lableParm_3=(ntohl(jt_data_back_package.lableParm)>>8)&0xFF;
                uint8_t lableParm_4=(ntohl(jt_data_back_package.lableParm))&0xFF;

                uint8_t test1[15] = {jt_data_back_package.len,jt_data_back_package.featureCode,
                                     jt_data_back_package.count,jt_data_back_package.battery,version_1,version_2,
                                     jt_data_back_package.ledCtrl,signCode_1,signCode_2,reserve_1,reserve_2,
                                     lableParm_1,lableParm_2,lableParm_3,lableParm_4};
                uint16_t crc_c=CRC16_XMODEM(test1,15);
                //for(int i=0;i<15;i++){
                //    printf("%02x ",test1[i]);
                //}
                //LOG_I("%s:XModem_CRC16 = %04x\r\n",__func__,crc_c);
                //LOG_I("CRC = %04x\r\n",ntohs(jt_data_back_package.crc));

                *parmAck=ntohs(jt_data_back_package.pre4);
                *tagCodeHead=ntohs(jt_data_back_package.tagHead);
                *tagCode=ntohl(jt_data_back_package.tag);
                *tagSignal=jt_data_back_package.signal;
                *totalLen=jt_data_back_package.len;
                *tagFeature=jt_data_back_package.featureCode;
                *count=jt_data_back_package.count;
                *batteryV=jt_data_back_package.battery;
                *version=ntohs(jt_data_back_package.version);
                *ledCtrl=jt_data_back_package.ledCtrl;
                *signCode=ntohs(jt_data_back_package.signCode);
                *reserve=ntohs(jt_data_back_package.reserve);
                *lableParm=ntohl(jt_data_back_package.lableParm);
        }else{
           // LOG_I("%s failed\n", __func__);
            ret = -2;
        }
    }else{
        //LOG_I("%s, failed, time out\n", __func__);
        ret = -1;
    }

    return ret;
}
