Access Control is now enabled for Gitlab Pages so you can now restrict Pages to authorized users only. If needed, make your website publicly available : Navigate to your project's Settings > General > Visibility and select Everyone in pages section.

Modify the code with the solution proposed in the seance

parent fc23fd16
No preview for this file type
......@@ -80,10 +80,19 @@ char* readUID(int fd)
int bytes_to_read = 0;
char x;
//tant que les caractères sont vides (\n ou \r) lire
/*while(1){
read(fd, &x, 1);
if(strlen(x) >= 1) {
printf("Caractère non-nul \n");
break;
}
}*/
read(fd, &x, 1);
while(memcmp(&x, "", 1) == 0)read(fd, &x, 1);
while(x == '\0' || x == '\n' && x == '\r')read(fd, &x, 1);
while(x != '\n'){
while(x != '\n' && x != '\r'){
uidS[nbBytes++] = x;
if (nbBytes >= sizeof(uidS)) {
printf("there is an error");
......@@ -91,25 +100,7 @@ char* readUID(int fd)
}
read(fd, &x, 1);
}
/*
ioctl(fd, FIONREAD, &bytes_to_read);
//The uid is only 7bytes or 4bytes or 8bytes, so if the bytes_to_read isn't one of this two value, doesn't to read)
if (bytes_to_read != 0 && (bytes_to_read == 15 || bytes_to_read == 9 || bytes_to_read == 17)) {
//printf("Some data to read %d\n", bytes_to_read);
while(1){
read(fd, &x, 1);
//the reader send a LF for the last uid
if (x == '\n') {
break;
}
uidS[nbBytes++] = x;
if (nbBytes >= sizeof(uidS)) {
printf("there is an error");
return 0; // --> error!!!
}
}
}*/
uidS[nbBytes] = 0;
return uidS;
}
......
No preview for this file type
......@@ -89,7 +89,7 @@ void *mainReader(void *ptr)
char uid_old[MAX_UID];
int nbCheck = 0;
int fd = openSerial("/dev/ttS4");
int fd = openSerial("/dev/ttyACM0");
//Update the counter each time the GPIO file value changes from 0 to 1
while (running == 1)
......@@ -107,10 +107,10 @@ void *mainReader(void *ptr)
printf("New card %s\n", uid);
nbCheck = 1;
sendUID(uid, nbCheck);
strcpy(uid_old, uid);
strcpy(uid_old, uid);
}
//usleep(utime);
usleep(utime);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment