#include “myhead.h”
#define BEEP_ON 0 //蜂鸣器响
#define BEEP_OFF 1 //蜂鸣器灭
#define DEV_PATH3 “/dev/ttySAC3”
#define DEV_PATH1 “/dev/ttySAC1” // CON2
#define DEV_PATH2 “/dev/ttySAC2”
sqlite3 db = NULL;
volatile unsigned int cardid ;
char license[100];
char pic_name[100];
static struct timeval timeout;
/ int init_sql()
{
int ret;
char *sql = “create table if not exists data(cardid integer primary key not null,license text,picpaht text);”;
ret=sqlite3_open("./data.db", &db);
if(ret!=0)
{
perror(“sqlite3_open is fail\n”);
} ret=sqlite3_exec(&db,sql,NULL,NULL,NULL); if(ret!=0) {perror("sqlite3_exec is fail\n"); } return 0; 1234567
} */
int callback(void *p, int num_col, char **text, char **name)
{
int cnt = 0;
while(cnt<num_col) {printf("%-10s\t|", *(text+cnt));cnt++; } printf("\n_______________________________________________\n"); printf("\n"); return 0; 1234567891011
}
unsigned char CalBCC(unsigned char *buf, int n)
{
int i;
unsigned char bcc=0;
for(i = 0; i < n; i++)
{
bcc ^= *(buf+i); //buf[i]
}
return (~bcc);
}
int callback1(void *p, int num_of_col, char **text, char **name)
{
printf(“出库车辆车牌号是:%s\n”,text[1]);
printf(“卡号:%#x\n”,text[0]);
printf(“图片路径:%s\n”,text[2]);
int ret = remove(text[2]);
if(ret == 0)
{
printf(“success\n”);
}
else
{
printf(“error\n”);
}
return 0;
}
int uart_set(int uartfd)
{
struct termios myios; bzero(&myios,sizeof(myios)); //设置串口工作在本地模式 myios.c_cflag |= CLOCAL | CREAD123