Update CSV data, refactor UART packet handling, and adjust TUI layout: modify person entries in CSV, change UART packet synchronization bytes, and update max_rows calculation in person listing.
This commit is contained in:
+3
-5
@@ -26,9 +26,7 @@
|
|||||||
28,Alena,Matouskova,3037,1,0,0
|
28,Alena,Matouskova,3037,1,0,0
|
||||||
29,Josef,Suchy,3038,1,0,0
|
29,Josef,Suchy,3038,1,0,0
|
||||||
30,Marketa,Rezacova,3039,1,0,0
|
30,Marketa,Rezacova,3039,1,0,0
|
||||||
31,Libor,Hanak,3040,1,0,0
|
31,Libor,Hanak,3040,1747561377,0,1
|
||||||
32,Libor,Hanak,3040,1,0,0
|
32,Libor,Hanak,3040,1,0,0
|
||||||
17267,Kamil,Novacek,2502,0,0,0
|
17767,Grzegorz,Brzeczyszczykiewicz,2502,0,0,0
|
||||||
17747,Kamil,Franta,2502,0,0,0
|
9158,Zima,Tomas,2440,1747561372,0,1
|
||||||
17767,Kamil,Filip,2502,0,0,0
|
|
||||||
9158,Jindrich,Sidlo,2440,0,0,0
|
|
||||||
|
|||||||
|
@@ -24,6 +24,6 @@ void *uartListener(void *arg);
|
|||||||
|
|
||||||
uint16_t parseIncommingPacket(BYTE *_packet);
|
uint16_t parseIncommingPacket(BYTE *_packet);
|
||||||
|
|
||||||
void sendPacketToDevice(BYTE *_packet);
|
void sendPacketToDevice(int _uart, node_t *_person);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+29
-3
@@ -96,7 +96,7 @@ void *uartListener(void *arg)
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case SYNC0:
|
case SYNC0:
|
||||||
if (byte == 0x55)
|
if (byte == 0xFF)
|
||||||
{
|
{
|
||||||
packet[0] = byte;
|
packet[0] = byte;
|
||||||
packet_index = 1;
|
packet_index = 1;
|
||||||
@@ -105,7 +105,7 @@ void *uartListener(void *arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SYNC1:
|
case SYNC1:
|
||||||
if (byte == 0xFF)
|
if (byte == 0x55)
|
||||||
{
|
{
|
||||||
packet[1] = byte;
|
packet[1] = byte;
|
||||||
packet_index = 2;
|
packet_index = 2;
|
||||||
@@ -130,7 +130,9 @@ void *uartListener(void *arg)
|
|||||||
if (crc == packet[5])
|
if (crc == packet[5])
|
||||||
{
|
{
|
||||||
uint16_t r_uuid = parseIncommingPacket(packet);
|
uint16_t r_uuid = parseIncommingPacket(packet);
|
||||||
addTimeEvent(searchPersonByUUID(person_list, r_uuid), person_list);
|
node_t *selected = searchPersonByUUID(person_list, r_uuid);
|
||||||
|
addTimeEvent(selected, person_list);
|
||||||
|
//sendPacketToDevice(uart, selected);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -154,4 +156,28 @@ uint16_t parseIncommingPacket(BYTE *_packet)
|
|||||||
memcpy(&r_event_type, &_packet[4], 1);
|
memcpy(&r_event_type, &_packet[4], 1);
|
||||||
|
|
||||||
return r_id;
|
return r_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sendPacketToDevice(int _uart, node_t *_person)
|
||||||
|
{
|
||||||
|
BYTE packet[72];
|
||||||
|
int offset = 0;
|
||||||
|
packet[0] = 0xFF;
|
||||||
|
packet[1] = 0X55;
|
||||||
|
offset += 2;
|
||||||
|
memcpy(packet + offset, _person->user.name, 32);
|
||||||
|
offset += 32;
|
||||||
|
memcpy(packet + offset, _person->user.surname, 32);
|
||||||
|
offset += 32;
|
||||||
|
time_t current_time = time(NULL);
|
||||||
|
memcpy(packet + offset, ¤t_time, sizeof(time_t));
|
||||||
|
offset += time(NULL);
|
||||||
|
BYTE crc = 0;
|
||||||
|
for (int i = 0; i < offset; i++)
|
||||||
|
{
|
||||||
|
crc ^= packet[i];
|
||||||
|
}
|
||||||
|
packet[offset] = crc;
|
||||||
|
offset += 1;
|
||||||
|
write(_uart, packet, 72);
|
||||||
}
|
}
|
||||||
@@ -260,7 +260,7 @@ void personListing(list_t *person_list, int terminal_x, int terminal_y)
|
|||||||
|
|
||||||
WINDOW *personlisting = newwin(win_height, win_width, start_y, start_x);
|
WINDOW *personlisting = newwin(win_height, win_width, start_y, start_x);
|
||||||
|
|
||||||
int max_rows = win_height - 2;
|
int max_rows = win_height - 3;
|
||||||
int total_count = 0;
|
int total_count = 0;
|
||||||
node_t *current = person_list->head;
|
node_t *current = person_list->head;
|
||||||
while (current)
|
while (current)
|
||||||
|
|||||||
Reference in New Issue
Block a user